Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make Behave like gmake: empty string does not match ...
details: https://anonhg.NetBSD.org/src/rev/be2c6a02cea2
branches: trunk
changeset: 1009871:be2c6a02cea2
user: christos <christos%NetBSD.org@localhost>
date: Wed May 06 02:30:10 2020 +0000
description:
Behave like gmake: empty string does not match % pattern
diffstat:
usr.bin/make/str.c | 10 +++++++---
usr.bin/make/unit-tests/sysv.exp | 1 +
usr.bin/make/unit-tests/sysv.mk | 9 +++++++--
3 files changed, 15 insertions(+), 5 deletions(-)
diffs (73 lines):
diff -r 1ad659d3c999 -r be2c6a02cea2 usr.bin/make/str.c
--- a/usr.bin/make/str.c Tue May 05 22:12:06 2020 +0000
+++ b/usr.bin/make/str.c Wed May 06 02:30:10 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: str.c,v 1.41 2020/05/03 12:10:28 rillig Exp $ */
+/* $NetBSD: str.c,v 1.42 2020/05/06 02:30:10 christos Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: str.c,v 1.41 2020/05/03 12:10:28 rillig Exp $";
+static char rcsid[] = "$NetBSD: str.c,v 1.42 2020/05/06 02:30:10 christos Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)str.c 5.8 (Berkeley) 6/1/90";
#else
-__RCSID("$NetBSD: str.c,v 1.41 2020/05/03 12:10:28 rillig Exp $");
+__RCSID("$NetBSD: str.c,v 1.42 2020/05/06 02:30:10 christos Exp $");
#endif
#endif /* not lint */
#endif
@@ -471,6 +471,10 @@
if ((m = strchr(p, '%')) != NULL) {
*hasPercent = TRUE;
+ if (*w == '\0') {
+ /* empty word does not match pattern */
+ return NULL;
+ }
/* check that the prefix matches */
for (; p != m && *w && *w == *p; w++, p++)
continue;
diff -r 1ad659d3c999 -r be2c6a02cea2 usr.bin/make/unit-tests/sysv.exp
--- a/usr.bin/make/unit-tests/sysv.exp Tue May 05 22:12:06 2020 +0000
+++ b/usr.bin/make/unit-tests/sysv.exp Wed May 06 02:30:10 2020 +0000
@@ -11,4 +11,5 @@
asam.c.c
asam.c
a.c.c
+
exit status 0
diff -r 1ad659d3c999 -r be2c6a02cea2 usr.bin/make/unit-tests/sysv.mk
--- a/usr.bin/make/unit-tests/sysv.mk Tue May 05 22:12:06 2020 +0000
+++ b/usr.bin/make/unit-tests/sysv.mk Wed May 06 02:30:10 2020 +0000
@@ -1,4 +1,4 @@
-# $Id: sysv.mk,v 1.3 2020/04/25 18:20:57 christos Exp $
+# $Id: sysv.mk,v 1.4 2020/05/06 02:30:10 christos Exp $
FOO ?=
FOOBAR = ${FOO:=bar}
@@ -11,7 +11,7 @@
SUN = the Sun
# we expect nothing when FOO is empty
-all: foo fun sam
+all: foo fun sam bla
foo:
@echo FOOBAR = ${FOOBAR}
@@ -36,3 +36,8 @@
@echo ${SAM:%=a%.c}
@echo ${SAM:%.c=a%.c}
@echo ${SAM:sam%=a%.c}
+
+BLA=
+
+bla:
+ @echo $(BLA:%=foo/%x)
Home |
Main Index |
Thread Index |
Old Index