diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2002-04-17 16:45:03 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2002-04-17 16:45:03 +0000 |
commit | a8cbf744b2c7222985a6e376e25edb08bf105a45 (patch) | |
tree | b60d9badcdbb041aec39041b784f91187d16a10e | |
parent | f7ebc7e6e576ca7f1958c73c9eaf818fe5f6b3ff (diff) |
Disallow condTop from ever becoming <0. Fixes regress/mk17 mk18.
ok millert@
-rw-r--r-- | usr.bin/make/cond.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c index d93477e3f04..4f2333e40eb 100644 --- a/usr.bin/make/cond.c +++ b/usr.bin/make/cond.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: cond.c,v 1.26 2001/05/29 12:53:39 espie Exp $ */ +/* $OpenBSD: cond.c,v 1.27 2002/04/17 16:45:02 espie Exp $ */ /* $NetBSD: cond.c,v 1.7 1996/11/06 17:59:02 christos Exp $ */ /* @@ -976,6 +976,7 @@ Cond_Eval(line) /* This is the one case where we can definitely proclaim a fatal * error. If we don't, we're hosed. */ Parse_Error(PARSE_FATAL, "Too many nested if's. %d max.", MAXIF); + condTop = 0; return COND_INVALID; } else { condStack[condTop].value = value; @@ -992,8 +993,9 @@ Cond_End() int i; if (condTop != MAXIF) { - Parse_Error(PARSE_FATAL, "%d open conditional%s", MAXIF-condTop, - MAXIF-condTop == 1 ? "" : "s"); + Parse_Error(PARSE_FATAL, "%s%d open conditional%s", + condTop == 0 ? "at least ": "", MAXIF-condTop, + MAXIF-condTop == 1 ? "" : "s"); for (i = MAXIF-1; i >= condTop; i--) { fprintf(stderr, "\t at line %lu of %s\n", condStack[i].lineno, condStack[i].filename); |