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: do not evaluate modifier ':[...]' in pars...



details:   https://anonhg.NetBSD.org/src/rev/54e0f440a801
branches:  trunk
changeset: 1019588:54e0f440a801
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Mar 14 19:29:37 2021 +0000

description:
make: do not evaluate modifier ':[...]' in parse-only mode

In parse-only mode, variable expressions in the argument to that
modifier are not resolved.  This led to the error message about the 'Bad
modifier' in var-eval-short.mk.

diffstat:

 usr.bin/make/unit-tests/var-eval-short.exp |  2 --
 usr.bin/make/var.c                         |  7 +++++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r a38245240dbb -r 54e0f440a801 usr.bin/make/unit-tests/var-eval-short.exp
--- a/usr.bin/make/unit-tests/var-eval-short.exp        Sun Mar 14 19:25:05 2021 +0000
+++ b/usr.bin/make/unit-tests/var-eval-short.exp        Sun Mar 14 19:29:37 2021 +0000
@@ -1,5 +1,3 @@
-make: Bad modifier ":[${FAIL" for variable ""
-make: "var-eval-short.mk" line 43: Malformed conditional (0 && ${:Uword:[${FAIL}]})
 make: "var-eval-short.mk" line 63: Invalid time value: ${FAIL}}
 make: "var-eval-short.mk" line 63: Malformed conditional (0 && ${:Uword:gmtime=${FAIL}})
 make: "var-eval-short.mk" line 77: Invalid time value: ${FAIL}}
diff -r a38245240dbb -r 54e0f440a801 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Mar 14 19:25:05 2021 +0000
+++ b/usr.bin/make/var.c        Sun Mar 14 19:29:37 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.876 2021/03/14 19:25:05 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.877 2021/03/14 19:29:37 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.876 2021/03/14 19:25:05 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.877 2021/03/14 19:29:37 rillig Exp $");
 
 typedef enum VarFlags {
        VFL_NONE        = 0,
@@ -3151,6 +3151,9 @@
        if (!IsDelimiter(**pp, st))
                goto bad_modifier;              /* Found junk after ']' */
 
+       if (!(expr->eflags & VARE_WANTRES))
+               goto ok;
+
        if (estr[0] == '\0')
                goto bad_modifier;                      /* Found ":[]". */
 



Home | Main Index | Thread Index | Old Index