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: internally return false for irrelevant le...



details:   https://anonhg.NetBSD.org/src/rev/deba321e0d54
branches:  trunk
changeset: 1029282:deba321e0d54
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Dec 30 00:22:20 2021 +0000

description:
make: internally return false for irrelevant leaves in conditions

The result of irrelevant leaves is effectively ignored by CondParser_And
and CondParser_Or.  Use the 'doEval &&' pattern to make the code
consistent with CondParser_Comparison and CondParser_FuncCall.

No functional change.

diffstat:

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

diffs (36 lines):

diff -r 68dd194bfff0 -r deba321e0d54 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Wed Dec 29 23:59:37 2021 +0000
+++ b/usr.bin/make/cond.c       Thu Dec 30 00:22:20 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.316 2021/12/29 08:23:40 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.317 2021/12/30 00:22:20 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
 #include "dir.h"
 
 /*     "@(#)cond.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: cond.c,v 1.316 2021/12/29 08:23:40 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.317 2021/12/30 00:22:20 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -725,7 +725,7 @@
                tok = TOK_ERROR;
        else {
                cpp_skip_whitespace(&val.str);
-               tok = val.str[0] != '\0' && doEval ? TOK_FALSE : TOK_TRUE;
+               tok = ToToken(doEval && val.str[0] == '\0');
        }
 
        FStr_Done(&val);
@@ -814,7 +814,7 @@
         * after .if must have been taken literally, so the argument cannot
         * be empty - even if it contained a variable expansion.
         */
-       t = ToToken(!doEval || EvalBare(par, arg));
+       t = ToToken(doEval && EvalBare(par, arg));
        free(arg);
        return t;
 }



Home | Main Index | Thread Index | Old Index