Module Name:    src
Committed By:   rillig
Date:           Mon Oct  5 18:29:20 UTC 2020

Modified Files:
        src/usr.bin/make: cond.c

Log Message:
make(1): fix test for .ifndef when compiled with -DUSE_UCHAR_BOOLEAN

In that compilation variant, TRUE is defined to 255, to see whether all
boolean expressions evaluate to either 1 or 0.  The field If.doNot in
cond.c doesn't do this since it uses the actual value of TRUE.
Therefore, change the evaluation slightly to also handle this case.


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/usr.bin/make/cond.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.157 src/usr.bin/make/cond.c:1.158
--- src/usr.bin/make/cond.c:1.157	Sat Oct  3 21:19:54 2020
+++ src/usr.bin/make/cond.c	Mon Oct  5 18:29:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.157 2020/10/03 21:19:54 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.158 2020/10/05 18:29:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.157 2020/10/03 21:19:54 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.158 2020/10/05 18:29:20 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -537,7 +537,7 @@ EvalNotEmpty(CondParser *par, const char
 	return lhs[0] != 0;
 
     /* Otherwise action default test ... */
-    return par->if_info->defProc(strlen(lhs), lhs) != par->if_info->doNot;
+    return par->if_info->defProc(strlen(lhs), lhs) == !par->if_info->doNot;
 }
 
 /* Evaluate a numerical comparison, such as in ".if ${VAR} >= 9". */
@@ -785,7 +785,7 @@ CondParser_Func(CondParser *par, Boolean
      * after .if must have been taken literally, so the argument cannot
      * be empty - even if it contained a variable expansion.
      */
-    t = !doEval || par->if_info->defProc(arglen, arg) != par->if_info->doNot;
+    t = !doEval || par->if_info->defProc(arglen, arg) == !par->if_info->doNot;
     free(arg);
     return t;
 }

Reply via email to