Module Name: src
Committed By: rillig
Date: Sat Nov 7 20:35:04 UTC 2020
Modified Files:
src/usr.bin/make: cond.c
Log Message:
make(1): reword condition in CondParser_String
The parentheses were confusing for human readers.
The compiler doesn't really care about the wording of the condition, GCC
5 on amd64 generates non-obvious but nice code anyway, replacing the
logical or with a logical and.
To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 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.183 src/usr.bin/make/cond.c:1.184
--- src/usr.bin/make/cond.c:1.183 Sat Nov 7 20:14:15 2020
+++ src/usr.bin/make/cond.c Sat Nov 7 20:35:04 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cond.c,v 1.183 2020/11/07 20:14:15 rillig Exp $ */
+/* $NetBSD: cond.c,v 1.184 2020/11/07 20:35:04 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.183 2020/11/07 20:14:15 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.184 2020/11/07 20:35:04 rillig Exp $");
/*
* The parsing of conditional expressions is based on this grammar:
@@ -442,8 +442,10 @@ CondParser_String(CondParser *par, Boole
continue;
case '$':
/* if we are in quotes, an undefined variable is ok */
- eflags = ((!qt && doEval) ? VARE_UNDEFERR : 0) |
- (doEval ? VARE_WANTRES : 0);
+ eflags = doEval && !qt ? VARE_UNDEFERR | VARE_WANTRES :
+ doEval ? VARE_WANTRES :
+ VARE_NONE;
+
nested_p = par->p;
atStart = nested_p == start;
parseResult = Var_Parse(&nested_p, VAR_CMDLINE, eflags, &str,