Module Name:    src
Committed By:   rillig
Date:           Sat Jul  4 17:41:04 UTC 2020

Modified Files:
        src/usr.bin/make: var.c
        src/usr.bin/make/unit-tests: modmisc.exp modmisc.mk

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


To generate a diff of this commit:
cvs rdiff -u -r1.254 -r1.255 src/usr.bin/make/var.c
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/modmisc.exp
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/modmisc.mk

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/var.c
diff -u src/usr.bin/make/var.c:1.254 src/usr.bin/make/var.c:1.255
--- src/usr.bin/make/var.c:1.254	Sat Jul  4 17:10:33 2020
+++ src/usr.bin/make/var.c	Sat Jul  4 17:41:04 2020
@@ -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 @@ VarModify(GNode *ctx, Var_Parse_State *v
 	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);
 

Index: src/usr.bin/make/unit-tests/modmisc.exp
diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.11 src/usr.bin/make/unit-tests/modmisc.exp:1.12
--- src/usr.bin/make/unit-tests/modmisc.exp:1.11	Sat Jul  4 17:10:33 2020
+++ src/usr.bin/make/unit-tests/modmisc.exp	Sat Jul  4 17:41:04 2020
@@ -31,5 +31,5 @@ make: Unclosed substitution for  (, miss
 :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

Index: src/usr.bin/make/unit-tests/modmisc.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.10 src/usr.bin/make/unit-tests/modmisc.mk:1.11
--- src/usr.bin/make/unit-tests/modmisc.mk:1.10	Sat Jul  4 17:10:33 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk	Sat Jul  4 17:41:04 2020
@@ -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 @@ mod-at-varname:
 # 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}:

Reply via email to