Module Name: src Committed By: rillig Date: Sun Jan 21 15:22:55 UTC 2024
Modified Files: src/usr.bin/make: cond.c Log Message: make: clean up parsing of conditions No functional change. To generate a diff of this commit: cvs rdiff -u -r1.359 -r1.360 src/usr.bin/make/cond.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/cond.c diff -u src/usr.bin/make/cond.c:1.359 src/usr.bin/make/cond.c:1.360 --- src/usr.bin/make/cond.c:1.359 Fri Dec 29 12:59:43 2023 +++ src/usr.bin/make/cond.c Sun Jan 21 15:22:55 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.359 2023/12/29 12:59:43 rillig Exp $ */ +/* $NetBSD: cond.c,v 1.360 2024/01/21 15:22:55 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "dir.h" /* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: cond.c,v 1.359 2023/12/29 12:59:43 rillig Exp $"); +MAKE_RCSID("$NetBSD: cond.c,v 1.360 2024/01/21 15:22:55 rillig Exp $"); /* * Conditional expressions conform to this grammar: @@ -937,20 +937,6 @@ CondParser_Or(CondParser *par, bool doEv return res; } -static CondResult -CondParser_Eval(CondParser *par) -{ - CondResult res; - - DEBUG1(COND, "CondParser_Eval: %s\n", par->p); - - res = CondParser_Or(par, true); - if (res != CR_ERROR && CondParser_Token(par, false) != TOK_EOF) - return CR_ERROR; - - return res; -} - /* * Evaluate the condition, including any side effects from the * expressions in the condition. The condition consists of &&, ||, !, @@ -974,7 +960,10 @@ CondEvalExpression(const char *cond, boo par.curr = TOK_NONE; par.printedError = false; - rval = CondParser_Eval(&par); + DEBUG1(COND, "CondParser_Eval: %s\n", par.p); + rval = CondParser_Or(&par, true); + if (par.curr != TOK_EOF) + rval = CR_ERROR; if (rval == CR_ERROR && eprint && !par.printedError) Parse_Error(PARSE_FATAL, "Malformed conditional (%s)", cond);