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: clean up comments related to pattern matc...



details:   https://anonhg.NetBSD.org/src/rev/2176722211aa
branches:  trunk
changeset: 376573:2176722211aa
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jun 22 09:09:08 2023 +0000

description:
make: clean up comments related to pattern matching

diffstat:

 usr.bin/make/dir.c                        |  10 +++++-----
 usr.bin/make/unit-tests/cond-func-make.mk |   7 ++++++-
 usr.bin/make/unit-tests/varmod-match.exp  |   4 ++--
 usr.bin/make/unit-tests/varmod-match.mk   |   9 ++++++---
 4 files changed, 19 insertions(+), 11 deletions(-)

diffs (93 lines):

diff -r a52d3fe35479 -r 2176722211aa usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Thu Jun 22 08:55:33 2023 +0000
+++ b/usr.bin/make/dir.c        Thu Jun 22 09:09:08 2023 +0000
@@ -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);
        }
 }
 
diff -r a52d3fe35479 -r 2176722211aa usr.bin/make/unit-tests/cond-func-make.mk
--- a/usr.bin/make/unit-tests/cond-func-make.mk Thu Jun 22 08:55:33 2023 +0000
+++ b/usr.bin/make/unit-tests/cond-func-make.mk Thu Jun 22 09:09:08 2023 +0000
@@ -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:
        : $@
diff -r a52d3fe35479 -r 2176722211aa usr.bin/make/unit-tests/varmod-match.exp
--- a/usr.bin/make/unit-tests/varmod-match.exp  Thu Jun 22 08:55:33 2023 +0000
+++ b/usr.bin/make/unit-tests/varmod-match.exp  Thu Jun 22 09:09:08 2023 +0000
@@ -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
diff -r a52d3fe35479 -r 2176722211aa usr.bin/make/unit-tests/varmod-match.mk
--- a/usr.bin/make/unit-tests/varmod-match.mk   Thu Jun 22 08:55:33 2023 +0000
+++ b/usr.bin/make/unit-tests/varmod-match.mk   Thu Jun 22 09:09:08 2023 +0000
@@ -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
 



Home | Main Index | Thread Index | Old Index