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): reword condition in CondParser_String



details:   https://anonhg.NetBSD.org/src/rev/770b3696808e
branches:  trunk
changeset: 945797:770b3696808e
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 07 20:35:04 2020 +0000

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

diffstat:

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

diffs (31 lines):

diff -r 9c8820a8d10d -r 770b3696808e usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Sat Nov 07 20:14:15 2020 +0000
+++ b/usr.bin/make/cond.c       Sat Nov 07 20:35:04 2020 +0000
@@ -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 @@
            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,



Home | Main Index | Thread Index | Old Index