Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make PR: 41998
details: https://anonhg.NetBSD.org/src/rev/bcb1f6f0b1ec
branches: trunk
changeset: 747266:bcb1f6f0b1ec
user: sjg <sjg%NetBSD.org@localhost>
date: Mon Sep 07 17:56:23 2009 +0000
description:
PR: 41998
:Ufu\:goo
should expand to fu:goo even when it appears in :M${:Ufu\:goo}
When scanning for :M do not compress \: if we know we have
to call Var_Subst.
diffstat:
usr.bin/make/unit-tests/modmatch | 7 +++++++
usr.bin/make/unit-tests/test.exp | 1 +
usr.bin/make/var.c | 17 ++++++++++++-----
3 files changed, 20 insertions(+), 5 deletions(-)
diffs (94 lines):
diff -r ac16a6c0f7f1 -r bcb1f6f0b1ec usr.bin/make/unit-tests/modmatch
--- a/usr.bin/make/unit-tests/modmatch Mon Sep 07 16:41:37 2009 +0000
+++ b/usr.bin/make/unit-tests/modmatch Mon Sep 07 17:56:23 2009 +0000
@@ -9,8 +9,15 @@
LIB?=a
+var = head
+res = no
+.if !empty(var:M${:Uhead\:tail:C/:.*//})
+res = OK
+.endif
+
all:
@for x in $X; do ${.MAKE} -f ${MAKEFILE} show LIB=$$x; done
+ @echo "Mscanner=${res}"
show:
@echo 'LIB=${LIB} X_LIBS:M$${LIB$${LIB:tu}} is "${X_LIBS:M${LIB${LIB:tu}}}"'
diff -r ac16a6c0f7f1 -r bcb1f6f0b1ec usr.bin/make/unit-tests/test.exp
--- a/usr.bin/make/unit-tests/test.exp Mon Sep 07 16:41:37 2009 +0000
+++ b/usr.bin/make/unit-tests/test.exp Mon Sep 07 17:56:23 2009 +0000
@@ -97,6 +97,7 @@
LIB=e X_LIBS:M${LIB${LIB:tu}} is "/tmp/libe.a"
LIB=e X_LIBS:M*/lib${LIB}.a is "/tmp/libe.a"
LIB=e X_LIBS:M*/lib${LIB}.a:tu is "/TMP/LIBE.A"
+Mscanner=OK
path=':/bin:/usr/bin::/sbin:/usr/sbin:.:/home/user/bin:.'
path='/bin:/usr/bin:/sbin:/usr/sbin:/home/user/bin'
path='/bin:/usr/bin:/sbin:/usr/sbin:/homes/user/bin'
diff -r ac16a6c0f7f1 -r bcb1f6f0b1ec usr.bin/make/var.c
--- a/usr.bin/make/var.c Mon Sep 07 16:41:37 2009 +0000
+++ b/usr.bin/make/var.c Mon Sep 07 17:56:23 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.152 2009/06/16 05:44:06 sjg Exp $ */
+/* $NetBSD: var.c,v 1.153 2009/09/07 17:56:24 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.152 2009/06/16 05:44:06 sjg Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.153 2009/09/07 17:56:24 sjg 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.152 2009/06/16 05:44:06 sjg Exp $");
+__RCSID("$NetBSD: var.c,v 1.153 2009/09/07 17:56:24 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -2763,9 +2763,11 @@
const char *endpat; /* points just after end of pattern */
char *cp2;
Boolean copy; /* pattern should be, or has been, copied */
+ Boolean needSubst;
int nest;
copy = FALSE;
+ needSubst = FALSE;
nest = 1;
/*
* In the loop below, ignore ':' unless we are at
@@ -2780,10 +2782,15 @@
if (*cp == '\\' &&
(cp[1] == ':' ||
cp[1] == endc || cp[1] == startc)) {
- copy = TRUE;
+ if (!needSubst) {
+ copy = TRUE;
+ }
cp++;
continue;
}
+ if (*cp == '$') {
+ needSubst = TRUE;
+ }
if (*cp == '(' || *cp == '{')
++nest;
if (*cp == ')' || *cp == '}') {
@@ -2822,7 +2829,7 @@
*/
pattern = bmake_strndup(tstr+1, endpat - (tstr + 1));
}
- if (strchr(pattern, '$') != NULL) {
+ if (needSubst) {
/*
* pattern contains embedded '$', so use Var_Subst to
* expand it.
Home |
Main Index |
Thread Index |
Old Index