The parser used to break dependency lines at ';' without regard
for substitution patterns. This (perhaps coupled with the new handling of .for variables in ${:U<value>...) caused interesting results for lines like: .for file in ${LIST} for-subst: ${file:S;^;${here}/;g} add a unit-test to keep an eye on this.
This commit is contained in:
parent
7affbacab9
commit
baca35f4e0
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: parse.c,v 1.157 2009/01/23 21:26:30 dsl Exp $ */
|
||||
/* $NetBSD: parse.c,v 1.158 2009/10/07 16:40:30 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -69,14 +69,14 @@
|
|||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: parse.c,v 1.157 2009/01/23 21:26:30 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: parse.c,v 1.158 2009/10/07 16:40:30 sjg Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: parse.c,v 1.157 2009/01/23 21:26:30 dsl Exp $");
|
||||
__RCSID("$NetBSD: parse.c,v 1.158 2009/10/07 16:40:30 sjg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
@ -2590,15 +2590,30 @@ Parse_File(const char *name, int fd)
|
|||
/*
|
||||
* For some reason - probably to make the parser impossible -
|
||||
* a ';' can be used to separate commands from dependencies.
|
||||
* No attempt is made to avoid ';' inside substitution patterns.
|
||||
* Attempt to avoid ';' inside substitution patterns.
|
||||
*/
|
||||
for (cp = line; *cp != 0; cp++) {
|
||||
if (*cp == '\\' && cp[1] != 0) {
|
||||
cp++;
|
||||
continue;
|
||||
{
|
||||
int level = 0;
|
||||
|
||||
for (cp = line; *cp != 0; cp++) {
|
||||
if (*cp == '\\' && cp[1] != 0) {
|
||||
cp++;
|
||||
continue;
|
||||
}
|
||||
if (*cp == '$' &&
|
||||
(cp[1] == '(' || cp[1] == '{')) {
|
||||
level++;
|
||||
continue;
|
||||
}
|
||||
if (level > 0) {
|
||||
if (*cp == ')' || *cp == '}') {
|
||||
level--;
|
||||
continue;
|
||||
}
|
||||
} else if (*cp == ';') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (*cp == ';')
|
||||
break;
|
||||
}
|
||||
if (*cp != 0)
|
||||
/* Terminate the dependency list at the ';' */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.23 2008/10/25 22:27:39 apb Exp $
|
||||
# $NetBSD: Makefile,v 1.24 2009/10/07 16:40:30 sjg Exp $
|
||||
#
|
||||
# Unit tests for make(1)
|
||||
# The main targets are:
|
||||
|
@ -24,6 +24,7 @@ SUBFILES= \
|
|||
export \
|
||||
export-all \
|
||||
dotwait \
|
||||
forsubst \
|
||||
moderrs \
|
||||
modmatch \
|
||||
modmisc \
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
# $Id: forsubst,v 1.1 2009/10/07 16:40:30 sjg Exp $
|
||||
|
||||
all: for-subst
|
||||
|
||||
here := ${.PARSEDIR}
|
||||
# this should not run foul of the parser
|
||||
.for file in ${.PARSEFILE}
|
||||
for-subst: ${file:S;^;${here}/;g}
|
||||
@echo ".for with :S;... OK"
|
||||
.endfor
|
|
@ -67,6 +67,7 @@ make: Graph cycles through `cycle.2.98'
|
|||
make: Graph cycles through `cycle.2.97'
|
||||
cycle.1.99
|
||||
cycle.1.99
|
||||
.for with :S;... OK
|
||||
Expect: Unknown modifier 'Z'
|
||||
make: Unknown modifier 'Z'
|
||||
VAR:Z=
|
||||
|
|
Loading…
Reference in New Issue