Module Name: src
Committed By: rillig
Date: Thu Jun 22 09:09:08 UTC 2023
Modified Files:
src/usr.bin/make: dir.c
src/usr.bin/make/unit-tests: cond-func-make.mk varmod-match.exp
varmod-match.mk
Log Message:
make: clean up comments related to pattern matching
To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/usr.bin/make/dir.c
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-func-make.mk
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-match.exp
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmod-match.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/dir.c
diff -u src/usr.bin/make/dir.c:1.280 src/usr.bin/make/dir.c:1.281
--- src/usr.bin/make/dir.c:1.280 Tue Jan 24 00:24:02 2023
+++ src/usr.bin/make/dir.c Thu Jun 22 09:09:08 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.280 2023/01/24 00:24:02 sjg Exp $ */
+/* $NetBSD: dir.c,v 1.281 2023/06/22 09:09:08 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -138,7 +138,7 @@
#include "job.h"
/* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: dir.c,v 1.280 2023/01/24 00:24:02 sjg Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.281 2023/06/22 09:09:08 rillig Exp $");
/*
* A search path is a list of CachedDir structures. A CachedDir has in it the
@@ -822,14 +822,14 @@ DirExpandCurly(const char *word, const c
}
-/* Expand the word in each of the directories from the path. */
+/* Expand the pattern in each of the directories from the path. */
static void
-DirExpandPath(const char *word, SearchPath *path, StringList *expansions)
+DirExpandPath(const char *pattern, SearchPath *path, StringList *expansions)
{
SearchPathNode *ln;
for (ln = path->dirs.first; ln != NULL; ln = ln->next) {
CachedDir *dir = ln->datum;
- DirMatchFiles(word, dir, expansions);
+ DirMatchFiles(pattern, dir, expansions);
}
}
Index: src/usr.bin/make/unit-tests/cond-func-make.mk
diff -u src/usr.bin/make/unit-tests/cond-func-make.mk:1.3 src/usr.bin/make/unit-tests/cond-func-make.mk:1.4
--- src/usr.bin/make/unit-tests/cond-func-make.mk:1.3 Fri Sep 25 20:11:06 2020
+++ src/usr.bin/make/unit-tests/cond-func-make.mk Thu Jun 22 09:09:08 2023
@@ -1,4 +1,4 @@
-# $NetBSD: cond-func-make.mk,v 1.3 2020/09/25 20:11:06 rillig Exp $
+# $NetBSD: cond-func-make.mk,v 1.4 2023/06/22 09:09:08 rillig Exp $
#
# Tests for the make() function in .if conditions, which tests whether
# the argument has been passed as a target via the command line or later
@@ -20,5 +20,10 @@
. error
.endif
+# TODO: warn about the malformed pattern
+.if make([)
+. error
+.endif
+
via-cmdline via-dot-makeflags:
: $@
Index: src/usr.bin/make/unit-tests/varmod-match.exp
diff -u src/usr.bin/make/unit-tests/varmod-match.exp:1.7 src/usr.bin/make/unit-tests/varmod-match.exp:1.8
--- src/usr.bin/make/unit-tests/varmod-match.exp:1.7 Sat Jun 11 09:15:49 2022
+++ src/usr.bin/make/unit-tests/varmod-match.exp Thu Jun 22 09:09:08 2023
@@ -10,8 +10,8 @@ CondParser_Eval: ${:Ua \$ sign:M*$$*} !=
Comparing "$" != "$"
CondParser_Eval: ${:Ua \$ sign any-asterisk:M*\$*} != "any-asterisk"
Comparing "any-asterisk" != "any-asterisk"
-make: "varmod-match.mk" line 157: Unknown modifier "]"
-make: "varmod-match.mk" line 157: Malformed conditional (${ ${:U\:} ${:U\:\:} :L:M[:]} != ":")
+make: "varmod-match.mk" line 160: Unknown modifier "]"
+make: "varmod-match.mk" line 160: Malformed conditional (${ ${:U\:} ${:U\:\:} :L:M[:]} != ":")
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
Index: src/usr.bin/make/unit-tests/varmod-match.mk
diff -u src/usr.bin/make/unit-tests/varmod-match.mk:1.12 src/usr.bin/make/unit-tests/varmod-match.mk:1.13
--- src/usr.bin/make/unit-tests/varmod-match.mk:1.12 Wed Aug 24 21:03:57 2022
+++ src/usr.bin/make/unit-tests/varmod-match.mk Thu Jun 22 09:09:08 2023
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-match.mk,v 1.12 2022/08/24 21:03:57 rillig Exp $
+# $NetBSD: varmod-match.mk,v 1.13 2023/06/22 09:09:08 rillig Exp $
#
# Tests for the :M variable modifier, which filters words that match the
# given pattern.
@@ -33,8 +33,11 @@ NUMBERS= One Two Three Four five six sev
.if ${:U****************:M****************b}
.endif
-# As of 2022-06-11, this expression calls Str_Match 5,242,223 times.
-# Adding another '*?' to the pattern calls Str_Match 41,261,143 times.
+# As of 2023-06-22, this expression calls Str_Match 2,621,112 times.
+# Adding another '*?' to the pattern calls Str_Match 20,630,572 times.
+# Adding another '*?' to the pattern calls Str_Match 136,405,672 times.
+# Adding another '*?' to the pattern calls Str_Match 773,168,722 times.
+# Adding another '*?' to the pattern calls Str_Match 3,815,481,072 times.
.if ${:U..................................................b:M*?*?*?*?*?a}
.endif