Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make(1): remove "warning" from missing closing ...
details: https://anonhg.NetBSD.org/src/rev/05071de1b053
branches: trunk
changeset: 958841:05071de1b053
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Jan 22 00:12:01 2021 +0000
description:
make(1): remove "warning" from missing closing parenthesis
This only affects the diagnostics for parse errors that involve a
missing closing parenthesis. Whether or not this is a parse error is
still the same.
It may look redundant to pass both the CondParser and the parsing
position pp to the functions, but that's necessary since during parsing,
not every code path updates the main parsing position immediately.
diffstat:
usr.bin/make/cond.c | 26 +++++++++++++-------------
usr.bin/make/unit-tests/cond-func-defined.exp | 6 ++----
usr.bin/make/unit-tests/cond-func.exp | 9 +++------
3 files changed, 18 insertions(+), 23 deletions(-)
diffs (111 lines):
diff -r 01aa212c9a85 -r 05071de1b053 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c Thu Jan 21 23:32:28 2021 +0000
+++ b/usr.bin/make/cond.c Fri Jan 22 00:12:01 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cond.c,v 1.252 2021/01/21 23:32:28 rillig Exp $ */
+/* $NetBSD: cond.c,v 1.253 2021/01/22 00:12:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
#include "dir.h"
/* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: cond.c,v 1.252 2021/01/21 23:32:28 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.253 2021/01/22 00:12:01 rillig Exp $");
/*
* The parsing of conditional expressions is based on this grammar:
@@ -228,7 +228,7 @@
* Return the length of the argument, or 0 on error.
*/
static size_t
-ParseFuncArg(const char **pp, Boolean doEval, const char *func,
+ParseFuncArg(CondParser *par, const char **pp, Boolean doEval, const char *func,
char **out_arg)
{
const char *p = *pp;
@@ -288,10 +288,9 @@
cpp_skip_hspace(&p);
if (func != NULL && *p++ != ')') {
- Parse_Error(PARSE_WARNING,
- "Missing closing parenthesis for %s()",
- func);
- /* The PARSE_FATAL follows in CondEvalExpression. */
+ Parse_Error(PARSE_FATAL,
+ "Missing closing parenthesis for %s()", func);
+ par->printedError = TRUE;
return 0;
}
@@ -731,8 +730,9 @@
*/
/*ARGSUSED*/
static size_t
-ParseEmptyArg(const char **pp, Boolean doEval,
- const char *func MAKE_ATTR_UNUSED, char **out_arg)
+ParseEmptyArg(CondParser *par MAKE_ATTR_UNUSED, const char **pp,
+ Boolean doEval, const char *func MAKE_ATTR_UNUSED,
+ char **out_arg)
{
FStr val;
size_t magic_res;
@@ -780,8 +780,8 @@
static const struct fn_def {
const char *fn_name;
size_t fn_name_len;
- size_t (*fn_parse)(const char **, Boolean, const char *,
- char **);
+ size_t (*fn_parse)(CondParser *, const char **, Boolean,
+ const char *, char **);
Boolean (*fn_eval)(size_t, const char *);
} fns[] = {
{ "defined", 7, ParseFuncArg, FuncDefined },
@@ -806,7 +806,7 @@
if (*cp != '(')
break;
- arglen = fn->fn_parse(&cp, doEval, fn->fn_name, &arg);
+ arglen = fn->fn_parse(par, &cp, doEval, fn->fn_name, &arg);
if (arglen == 0 || arglen == (size_t)-1) {
par->p = cp;
*out_token = arglen == 0 ? TOK_FALSE : TOK_ERROR;
@@ -852,7 +852,7 @@
* syntax would be invalid if we did "defined(a)" - so instead treat
* as an expression.
*/
- arglen = ParseFuncArg(&cp, doEval, NULL, &arg);
+ arglen = ParseFuncArg(par, &cp, doEval, NULL, &arg);
cp1 = cp;
cpp_skip_whitespace(&cp1);
if (*cp1 == '=' || *cp1 == '!')
diff -r 01aa212c9a85 -r 05071de1b053 usr.bin/make/unit-tests/cond-func-defined.exp
--- a/usr.bin/make/unit-tests/cond-func-defined.exp Thu Jan 21 23:32:28 2021 +0000
+++ b/usr.bin/make/unit-tests/cond-func-defined.exp Fri Jan 22 00:12:01 2021 +0000
@@ -1,7 +1,5 @@
-make: "cond-func-defined.mk" line 23: warning: Missing closing parenthesis for defined()
-make: "cond-func-defined.mk" line 23: Malformed conditional (!defined(A B))
-make: "cond-func-defined.mk" line 33: warning: Missing closing parenthesis for defined()
-make: "cond-func-defined.mk" line 33: Malformed conditional (defined(DEF)
+make: "cond-func-defined.mk" line 23: Missing closing parenthesis for defined()
+make: "cond-func-defined.mk" line 33: Missing closing parenthesis for defined()
make: "cond-func-defined.mk" line 45: In .for loops, variable expressions for the loop variables are
make: "cond-func-defined.mk" line 46: substituted at evaluation time. There is no actual variable
make: "cond-func-defined.mk" line 47: involved, even if it feels like it.
diff -r 01aa212c9a85 -r 05071de1b053 usr.bin/make/unit-tests/cond-func.exp
--- a/usr.bin/make/unit-tests/cond-func.exp Thu Jan 21 23:32:28 2021 +0000
+++ b/usr.bin/make/unit-tests/cond-func.exp Fri Jan 22 00:12:01 2021 +0000
@@ -1,9 +1,6 @@
-make: "cond-func.mk" line 36: warning: Missing closing parenthesis for defined()
-make: "cond-func.mk" line 36: Malformed conditional (!defined(A B))
-make: "cond-func.mk" line 51: warning: Missing closing parenthesis for defined()
-make: "cond-func.mk" line 51: Malformed conditional (!defined(A&B))
-make: "cond-func.mk" line 54: warning: Missing closing parenthesis for defined()
-make: "cond-func.mk" line 54: Malformed conditional (!defined(A|B))
+make: "cond-func.mk" line 36: Missing closing parenthesis for defined()
+make: "cond-func.mk" line 51: Missing closing parenthesis for defined()
+make: "cond-func.mk" line 54: Missing closing parenthesis for defined()
make: "cond-func.mk" line 94: The empty variable is never defined.
make: "cond-func.mk" line 102: A plain function name is parsed as !empty(...).
make: "cond-func.mk" line 109: A plain function name is parsed as !empty(...).
Home |
Main Index |
Thread Index |
Old Index