make(1): reduce the scope where recursive expressions are detected
Only the call to Var_Subst needs to be protected since the other functions have nothing to do with expanding variables.
This commit is contained in:
parent
a29ccc8f84
commit
33f5cc827c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.417 2020/10/31 09:35:58 rillig Exp $ */
|
||||
/* $NetBSD: main.c,v 1.418 2020/10/31 11:34:30 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -118,7 +118,7 @@
|
|||
#include "trace.h"
|
||||
|
||||
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: main.c,v 1.417 2020/10/31 09:35:58 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: main.c,v 1.418 2020/10/31 11:34:30 rillig Exp $");
|
||||
#if defined(MAKE_NATIVE) && !defined(lint)
|
||||
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
|
||||
"The Regents of the University of California. "
|
||||
|
@ -1827,7 +1827,7 @@ Error(const char *fmt, ...)
|
|||
|
||||
/* Produce a Fatal error message, then exit immediately.
|
||||
*
|
||||
* If jobs are running, waits for them to finish. */
|
||||
* If jobs are running, wait for them to finish. */
|
||||
void
|
||||
Fatal(const char *fmt, ...)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: var.c,v 1.614 2020/10/31 09:57:47 rillig Exp $ */
|
||||
/* $NetBSD: var.c,v 1.615 2020/10/31 11:34:30 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -129,7 +129,7 @@
|
|||
#include "metachar.h"
|
||||
|
||||
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: var.c,v 1.614 2020/10/31 09:57:47 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: var.c,v 1.615 2020/10/31 11:34:30 rillig Exp $");
|
||||
|
||||
#define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
|
||||
#define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
|
||||
|
@ -3662,12 +3662,8 @@ Var_Parse(const char **pp, GNode *ctxt, VarEvalFlags eflags,
|
|||
free(varname);
|
||||
}
|
||||
|
||||
if (v->flags & VAR_IN_USE) {
|
||||
if (v->flags & VAR_IN_USE)
|
||||
Fatal("Variable %s is recursive.", v->name);
|
||||
/*NOTREACHED*/
|
||||
} else {
|
||||
v->flags |= VAR_IN_USE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Before doing any modification, we have to make sure the value
|
||||
|
@ -3683,13 +3679,13 @@ Var_Parse(const char **pp, GNode *ctxt, VarEvalFlags eflags,
|
|||
VarEvalFlags nested_eflags = eflags;
|
||||
if (DEBUG(LINT))
|
||||
nested_eflags &= ~(unsigned)VARE_UNDEFERR;
|
||||
v->flags |= VAR_IN_USE;
|
||||
(void)Var_Subst(nstr, ctxt, nested_eflags, &nstr);
|
||||
v->flags &= ~(unsigned)VAR_IN_USE;
|
||||
/* TODO: handle errors */
|
||||
*freePtr = nstr;
|
||||
}
|
||||
|
||||
v->flags &= ~(unsigned)VAR_IN_USE;
|
||||
|
||||
if (haveModifier || extramodifiers != NULL) {
|
||||
void *extraFree;
|
||||
|
||||
|
|
Loading…
Reference in New Issue