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): expand the test for variable expansion...



details:   https://anonhg.NetBSD.org/src/rev/426a03f4b079
branches:  trunk
changeset: 935524:426a03f4b079
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jul 04 17:41:04 2020 +0000

description:
make(1): expand the test for variable expansion in the :@ modifier

diffstat:

 usr.bin/make/unit-tests/modmisc.exp |   2 +-
 usr.bin/make/unit-tests/modmisc.mk  |   9 ++++++---
 usr.bin/make/var.c                  |  11 ++++++++---
 3 files changed, 15 insertions(+), 7 deletions(-)

diffs (72 lines):

diff -r 769733a77d14 -r 426a03f4b079 usr.bin/make/unit-tests/modmisc.exp
--- a/usr.bin/make/unit-tests/modmisc.exp       Sat Jul 04 17:20:45 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.exp       Sat Jul 04 17:41:04 2020 +0000
@@ -31,5 +31,5 @@
 :a c:
 :x__ 3 x__ 3:
 :+one+ +two+ +three+:
-mod-at-resolve:w1a2w w1b2w w1a2 1b${RES2}w:
+mod-at-resolve:w1d2d3w w2i3w w1i2d3 2i${RES3}w w1d2d3 2i${RES3} 1i${RES2}w:
 exit status 0
diff -r 769733a77d14 -r 426a03f4b079 usr.bin/make/unit-tests/modmisc.mk
--- a/usr.bin/make/unit-tests/modmisc.mk        Sat Jul 04 17:20:45 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.mk        Sat Jul 04 17:41:04 2020 +0000
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.10 2020/07/04 17:10:33 rillig Exp $
+# $Id: modmisc.mk,v 1.11 2020/07/04 17:41:04 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -84,9 +84,12 @@
 # The :@ modifier resolves the variables a little more often than expected.
 # In particular, it resolves _all_ variables from the context, and not only
 # the loop variable (in this case v).
+#
+# The d means direct reference, the i means indirect reference.
 RESOLVE=       ${RES1} $${RES1}
-RES1=          1a${RES2} 1b$${RES2}
-RES2=          2
+RES1=          1d${RES2} 1i$${RES2}
+RES2=          2d${RES3} 2i$${RES3}
+RES3=          3
 
 mod-at-resolve:
        @echo $@:${RESOLVE:@v@w${v}w@:Q}:
diff -r 769733a77d14 -r 426a03f4b079 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sat Jul 04 17:20:45 2020 +0000
+++ b/usr.bin/make/var.c        Sat Jul 04 17:41:04 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.254 2020/07/04 17:10:33 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.255 2020/07/04 17:41:04 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.254 2020/07/04 17:10:33 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.255 2020/07/04 17:41:04 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.254 2020/07/04 17:10:33 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.255 2020/07/04 17:41:04 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1737,6 +1737,11 @@
        av = brk_string(str, &ac, FALSE, &as);
     }
 
+    if (DEBUG(VAR)) {
+       fprintf(debug_file, "VarModify: split \"%s\" into %d words\n",
+               str, ac);
+    }
+
     for (i = 0; i < ac; i++)
        addSpace = modProc(ctx, vpstate, av[i], addSpace, &buf, datum);
 



Home | Main Index | Thread Index | Old Index