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): improve explanation of tests for the S...



details:   https://anonhg.NetBSD.org/src/rev/ddaad9a9f012
branches:  trunk
changeset: 946630:ddaad9a9f012
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Dec 05 13:01:33 2020 +0000

description:
make(1): improve explanation of tests for the SysV modifier

diffstat:

 usr.bin/make/unit-tests/varmod-sysv.exp |   4 ++--
 usr.bin/make/unit-tests/varmod-sysv.mk  |  16 ++++++++++------
 usr.bin/make/var.c                      |   6 +++---
 3 files changed, 15 insertions(+), 11 deletions(-)

diffs (80 lines):

diff -r f552a3a0a2fa -r ddaad9a9f012 usr.bin/make/unit-tests/varmod-sysv.exp
--- a/usr.bin/make/unit-tests/varmod-sysv.exp   Sat Dec 05 11:18:21 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-sysv.exp   Sat Dec 05 13:01:33 2020 +0000
@@ -1,5 +1,5 @@
-make: Unfinished modifier for word203 ('=' missing)
-make: "varmod-sysv.mk" line 210: Malformed conditional (${word203:L:from${:D=}to})
+make: Unfinished modifier for word214 ('=' missing)
+make: "varmod-sysv.mk" line 214: Malformed conditional (${word214:L:from${:D=}to})
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1
diff -r f552a3a0a2fa -r ddaad9a9f012 usr.bin/make/unit-tests/varmod-sysv.mk
--- a/usr.bin/make/unit-tests/varmod-sysv.mk    Sat Dec 05 11:18:21 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-sysv.mk    Sat Dec 05 13:01:33 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-sysv.mk,v 1.11 2020/11/01 22:28:52 rillig Exp $
+# $NetBSD: varmod-sysv.mk,v 1.12 2020/12/05 13:01:33 rillig Exp $
 #
 # Tests for the ${VAR:from=to} variable modifier, which replaces the suffix
 # "from" with "to".  It can also use '%' as a wildcard.
@@ -77,13 +77,16 @@
 # If the variable value is empty, it is debatable whether it consists of a
 # single empty word, or no word at all.  The :from=to modifier treats it as
 # no word at all.
+#
+# See SysVMatch, which doesn't handle w_len == p_len specially.
 .if ${:L:=suffix} != ""
 .  error
 .endif
 
 # If the variable value is empty, it is debatable whether it consists of a
-# single empty word, or no word at all.  The :from=to modifier treats it as
-# no word at all.
+# single empty word (before 2020-05-06), or no word at all (since 2020-05-06).
+#
+# See SysVMatch, percent != NULL && w[0] == '\0'.
 .if ${:L:%=suffix} != ""
 .  error
 .endif
@@ -205,9 +208,10 @@
 
 # This is not a SysV modifier since the nested variable expression expands
 # to an empty string.  The '=' in it should be irrelevant during parsing.
-# As of 2020-11-01, this seemingly correct modifier leads to a parse error.
-# XXX
-.if ${word203:L:from${:D=}to}
+# XXX: As of 2020-12-05, this expression generates an "Unfinished modifier"
+# error, while the correct error message would be "Unknown modifier" since
+# there is no modifier named "fromto".
+.if ${word214:L:from${:D=}to}
 .  error
 .endif
 
diff -r f552a3a0a2fa -r ddaad9a9f012 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sat Dec 05 11:18:21 2020 +0000
+++ b/usr.bin/make/var.c        Sat Dec 05 13:01:33 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.701 2020/12/04 22:47:57 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.702 2020/12/05 13:01:33 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.701 2020/12/04 22:47:57 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.702 2020/12/05 13:01:33 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -1195,7 +1195,7 @@
     percent = strchr(p, '%');
     if (percent != NULL) {     /* ${VAR:...%...=...} */
        *out_hasPercent = TRUE;
-       if (*w == '\0')
+       if (w[0] == '\0')
            return NULL;        /* empty word does not match pattern */
 
        /* check that the prefix matches */



Home | Main Index | Thread Index | Old Index