Module Name: src
Committed By: rillig
Date: Mon Feb 1 21:56:03 UTC 2021
Modified Files:
src/usr.bin/make: parse.c
src/usr.bin/make/unit-tests: var-op-assign.exp varname.exp
Log Message:
make: replace parse error "Need an operator" with better message
The previous error message is not easily understandable since it is
missing a crucial detail, the column where the operator is needed.
Without this information, the author of the makefile gets no useful
hint. Furthermore, there are several types of operators in makefiles:
the dependency operators ':', '!', '::',
the variable assignment operators '=', '!=', '+=', '?=', ':=',
the conditional operators '&&', '||', '!',
the comparison operators '==', '!=', '>', '>=', '<', '<='.
This leaves too much ambiguity.
Replace this error message with "Invalid line type", which is more
generic, more accurate and thus less misleading.
To generate a diff of this commit:
cvs rdiff -u -r1.534 -r1.535 src/usr.bin/make/parse.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/var-op-assign.exp
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varname.exp
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/parse.c
diff -u src/usr.bin/make/parse.c:1.534 src/usr.bin/make/parse.c:1.535
--- src/usr.bin/make/parse.c:1.534 Sat Jan 30 20:53:29 2021
+++ src/usr.bin/make/parse.c Mon Feb 1 21:56:03 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.534 2021/01/30 20:53:29 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.535 2021/02/01 21:56:03 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.534 2021/01/30 20:53:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.535 2021/02/01 21:56:03 rillig Exp $");
/* types and constants */
@@ -1018,7 +1018,7 @@ ParseErrorNoDependency(const char *lstar
Parse_Error(PARSE_FATAL, "Unknown directive \"%.*s\"",
(int)(dirend - dirstart), dirstart);
} else
- Parse_Error(PARSE_FATAL, "Need an operator");
+ Parse_Error(PARSE_FATAL, "Invalid line type");
}
static void
Index: src/usr.bin/make/unit-tests/var-op-assign.exp
diff -u src/usr.bin/make/unit-tests/var-op-assign.exp:1.4 src/usr.bin/make/unit-tests/var-op-assign.exp:1.5
--- src/usr.bin/make/unit-tests/var-op-assign.exp:1.4 Sun Nov 15 20:20:58 2020
+++ src/usr.bin/make/unit-tests/var-op-assign.exp Mon Feb 1 21:56:03 2021
@@ -1,5 +1,5 @@
this will be evaluated later
-make: "var-op-assign.mk" line 59: Need an operator
+make: "var-op-assign.mk" line 59: Invalid line type
make: "var-op-assign.mk" line 93: Parsing still continues until here.
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
Index: src/usr.bin/make/unit-tests/varname.exp
diff -u src/usr.bin/make/unit-tests/varname.exp:1.9 src/usr.bin/make/unit-tests/varname.exp:1.10
--- src/usr.bin/make/unit-tests/varname.exp:1.9 Sat Nov 7 13:09:13 2020
+++ src/usr.bin/make/unit-tests/varname.exp Mon Feb 1 21:56:03 2021
@@ -14,7 +14,7 @@ Var_Parse: ${:UVAR\(\(\(}= try2 with VAR
Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
Result of ${:UVAR\(\(\(} is "VAR\(\(\(" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
Global:.ALLTARGETS = VAR(((=) VAR\(\(\(=
-make: "varname.mk" line 35: Need an operator
+make: "varname.mk" line 35: Invalid line type
Var_Parse: ${VARNAME} with VARE_WANTRES
Global:VAR((( = try3
Global:.MAKEFLAGS = -r -k -d v -d