Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): fix test for .ifndef when compiled wit...



details:   https://anonhg.NetBSD.org/src/rev/6edde8d73033
branches:  trunk
changeset: 944653:6edde8d73033
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Oct 05 18:29:20 2020 +0000

description:
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.

diffstat:

 usr.bin/make/cond.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 5b18e2d79ddb -r 6edde8d73033 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Mon Oct 05 18:04:57 2020 +0000
+++ b/usr.bin/make/cond.c       Mon Oct 05 18:29:20 2020 +0000
@@ -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 @@
        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 @@
      * 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;
 }



Home | Main Index | Thread Index | Old Index