Module Name: src
Committed By: rillig
Date: Thu Dec 30 00:22:20 UTC 2021
Modified Files:
src/usr.bin/make: cond.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.316 -r1.317 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.316 src/usr.bin/make/cond.c:1.317
--- src/usr.bin/make/cond.c:1.316 Wed Dec 29 08:23:40 2021
+++ src/usr.bin/make/cond.c Thu Dec 30 00:22:20 2021
@@ -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 @@ CondParser_FuncCallEmpty(CondParser *par
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 @@ CondParser_ComparisonOrLeaf(CondParser *
* 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;
}