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 unnecessary evaluation of variable...



details:   https://anonhg.NetBSD.org/src/rev/2ac561ae8b71
branches:  trunk
changeset: 1011526:2ac561ae8b71
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jul 02 16:52:34 2020 +0000

description:
make(1): fix unnecessary evaluation of variables in :@var@ modifier

diffstat:

 usr.bin/make/unit-tests/cond-short.exp |   3 ---
 usr.bin/make/var.c                     |  12 ++++++------
 2 files changed, 6 insertions(+), 9 deletions(-)

diffs (66 lines):

diff -r 88f546c9b218 -r 2ac561ae8b71 usr.bin/make/unit-tests/cond-short.exp
--- a/usr.bin/make/unit-tests/cond-short.exp    Thu Jul 02 16:46:57 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-short.exp    Thu Jul 02 16:52:34 2020 +0000
@@ -4,9 +4,6 @@
 expected U23 condition
 expected VAR23
 expected M pattern
-unexpected @ modifier
-unexpected @ modifier
-unexpected @ modifier
 expected or
 expected or exists
 expected or empty
diff -r 88f546c9b218 -r 2ac561ae8b71 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Thu Jul 02 16:46:57 2020 +0000
+++ b/usr.bin/make/var.c        Thu Jul 02 16:52:34 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.232 2020/07/02 16:46:57 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.233 2020/07/02 16:52:34 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.232 2020/07/02 16:46:57 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.233 2020/07/02 16:52:34 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c      8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.232 2020/07/02 16:46:57 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.233 2020/07/02 16:52:34 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -279,7 +279,7 @@
     int                tvarLen;
     char       *str;           /* string to expand */
     int                strLen;
-    int                errnum;         /* errnum for not defined */
+    Varf_Flags flags;
 } VarLoop_t;
 
 #ifndef NO_REGEX
@@ -1843,7 +1843,7 @@
 
     if (word && *word) {
         Var_Set_Flags(loop->tvar, word, loop->ctxt, VAR_NO_EXPORT);
-        s = Var_Subst(NULL, loop->str, loop->ctxt, loop->errnum | VARF_WANTRES);
+        s = Var_Subst(NULL, loop->str, loop->ctxt, loop->flags);
         if (s != NULL && *s != '\0') {
             if (addSpace && *s != '\n')
                 Buf_AddByte(buf, ' ');
@@ -2759,7 +2759,7 @@
                termc = *cp;
                delim = '\0';
 
-               loop.errnum = flags & VARF_UNDEFERR;
+               loop.flags = flags & (VARF_UNDEFERR | VARF_WANTRES);
                loop.ctxt = ctxt;
                newStr = VarModify(ctxt, &parsestate, nstr, VarLoopExpand,
                                   &loop);



Home | Main Index | Thread Index | Old Index