Module Name:    src
Committed By:   rillig
Date:           Sat Aug  8 13:03:13 UTC 2020

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

Log Message:
make(1): add test for unknown sub-modifier of the :S modifier


To generate a diff of this commit:
cvs rdiff -u -r1.423 -r1.424 src/usr.bin/make/var.c
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/make/unit-tests/modmisc.exp
cvs rdiff -u -r1.34 -r1.35 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.423 src/usr.bin/make/var.c:1.424
--- src/usr.bin/make/var.c:1.423	Sat Aug  8 13:00:07 2020
+++ src/usr.bin/make/var.c	Sat Aug  8 13:03:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.423 2020/08/08 13:00:07 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.424 2020/08/08 13:03:13 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.423 2020/08/08 13:00:07 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.424 2020/08/08 13:03:13 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.423 2020/08/08 13:00:07 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.424 2020/08/08 13:03:13 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1297,7 +1297,7 @@ ModifyWord_Subst(const char *word, SepBu
 	return;
     }
 
-    /* unanchored */
+    /* unanchored case, may match more than once */
     while ((match = Str_FindSubstring(word, args->lhs)) != NULL) {
 	SepBuf_AddBytesBetween(buf, word, match);
 	SepBuf_AddBytes(buf, args->rhs, args->rhsLen);

Index: src/usr.bin/make/unit-tests/modmisc.exp
diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.36 src/usr.bin/make/unit-tests/modmisc.exp:1.37
--- src/usr.bin/make/unit-tests/modmisc.exp:1.36	Fri Aug  7 20:10:35 2020
+++ src/usr.bin/make/unit-tests/modmisc.exp	Sat Aug  8 13:03:13 2020
@@ -27,6 +27,8 @@ mod-subst:
 12345
 mod-subst-chain:
 A B c.
+make: Unknown modifier 'i'
+.
 mod-regex:
 :a b b c:
 :a b b c:

Index: src/usr.bin/make/unit-tests/modmisc.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.34 src/usr.bin/make/unit-tests/modmisc.mk:1.35
--- src/usr.bin/make/unit-tests/modmisc.mk:1.34	Fri Aug  7 20:10:35 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk	Sat Aug  8 13:03:13 2020
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.34 2020/08/07 20:10:35 rillig Exp $
+# $Id: modmisc.mk,v 1.35 2020/08/08 13:03:13 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -148,6 +148,11 @@ mod-subst:
 mod-subst-chain:
 	@echo $@:
 	@echo ${:Ua b c:S,a,A,S,b,B,}.
+	# There is no 'i' modifier for the :S or :C modifiers.
+	# The error message is "make: Unknown modifier 'i'", which is
+	# kind of correct, although it is mixing the terms for variable
+	# modifiers with the matching modifiers.
+	@echo ${:Uvalue:S,a,x,i}.
 
 mod-regex:
 	@echo $@:

Reply via email to