Module Name: src
Committed By: rillig
Date: Tue Aug 6 17:46:01 UTC 2024
Modified Files:
src/usr.bin/make: arch.c cond.c
src/usr.bin/make/unit-tests: cond-func-defined.exp cond-func-defined.mk
cond-func.exp cond-func.mk varname.exp varname.mk
Log Message:
make: add details to error messages about missing ')'
To generate a diff of this commit:
cvs rdiff -u -r1.221 -r1.222 src/usr.bin/make/arch.c
cvs rdiff -u -r1.366 -r1.367 src/usr.bin/make/cond.c
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cond-func-defined.exp \
src/usr.bin/make/unit-tests/cond-func.exp
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cond-func-defined.mk
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/cond-func.mk
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varname.exp
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varname.mk
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/arch.c
diff -u src/usr.bin/make/arch.c:1.221 src/usr.bin/make/arch.c:1.222
--- src/usr.bin/make/arch.c:1.221 Sun Jul 7 07:50:57 2024
+++ src/usr.bin/make/arch.c Tue Aug 6 17:46:01 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: arch.c,v 1.221 2024/07/07 07:50:57 rillig Exp $ */
+/* $NetBSD: arch.c,v 1.222 2024/08/06 17:46:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
#include "config.h"
/* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: arch.c,v 1.221 2024/07/07 07:50:57 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.222 2024/08/06 17:46:01 rillig Exp $");
typedef struct List ArchList;
typedef struct ListNode ArchListNode;
@@ -266,8 +266,7 @@ Arch_ParseArchive(char **pp, GNodeList *
if (*cp == '\0') {
Parse_Error(PARSE_FATAL,
- "No closing parenthesis "
- "in archive specification");
+ "Missing ')' in archive specification");
return false;
}
Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.366 src/usr.bin/make/cond.c:1.367
--- src/usr.bin/make/cond.c:1.366 Sat Jul 6 21:21:09 2024
+++ src/usr.bin/make/cond.c Tue Aug 6 17:46:01 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cond.c,v 1.366 2024/07/06 21:21:09 rillig Exp $ */
+/* $NetBSD: cond.c,v 1.367 2024/08/06 17:46:01 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.366 2024/07/06 21:21:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.367 2024/08/06 17:46:01 rillig Exp $");
/*
* Conditional expressions conform to this grammar:
@@ -266,7 +266,8 @@ ParseFuncArg(CondParser *par, const char
len++;
Parse_Error(PARSE_FATAL,
- "Missing closing parenthesis for %.*s()", len, func);
+ "Missing ')' after argument '%s' for '%.*s'",
+ res, len, func);
par->printedError = true;
free(res);
return NULL;
Index: src/usr.bin/make/unit-tests/cond-func-defined.exp
diff -u src/usr.bin/make/unit-tests/cond-func-defined.exp:1.10 src/usr.bin/make/unit-tests/cond-func-defined.exp:1.11
--- src/usr.bin/make/unit-tests/cond-func-defined.exp:1.10 Thu Jul 4 20:18:40 2024
+++ src/usr.bin/make/unit-tests/cond-func-defined.exp Tue Aug 6 17:46:01 2024
@@ -1,5 +1,5 @@
-make: "cond-func-defined.mk" line 24: Missing closing parenthesis for defined()
-make: "cond-func-defined.mk" line 34: Missing closing parenthesis for defined()
+make: "cond-func-defined.mk" line 24: Missing ')' after argument 'A' for 'defined'
+make: "cond-func-defined.mk" line 34: Missing ')' after argument 'DEF' for 'defined'
make: Fatal errors encountered -- cannot continue
make: stopped making "all" in unit-tests
exit status 1
Index: src/usr.bin/make/unit-tests/cond-func.exp
diff -u src/usr.bin/make/unit-tests/cond-func.exp:1.10 src/usr.bin/make/unit-tests/cond-func.exp:1.11
--- src/usr.bin/make/unit-tests/cond-func.exp:1.10 Sat Jul 6 21:21:10 2024
+++ src/usr.bin/make/unit-tests/cond-func.exp Tue Aug 6 17:46:01 2024
@@ -1,12 +1,12 @@
-make: "cond-func.mk" line 37: Missing closing parenthesis for defined()
-make: "cond-func.mk" line 53: Missing closing parenthesis for defined()
-make: "cond-func.mk" line 57: Missing closing parenthesis for defined()
+make: "cond-func.mk" line 37: Missing ')' after argument 'A' for 'defined'
+make: "cond-func.mk" line 53: Missing ')' after argument 'A' for 'defined'
+make: "cond-func.mk" line 57: Missing ')' after argument 'A' for 'defined'
make: "cond-func.mk" line 91: Unknown operator '&'
make: "cond-func.mk" line 107: A plain function name is parsed as defined(...).
make: "cond-func.mk" line 115: A plain function name is parsed as defined(...).
make: "cond-func.mk" line 126: Symbols may start with a function name.
make: "cond-func.mk" line 132: Symbols may start with a function name.
-make: "cond-func.mk" line 138: Missing closing parenthesis for defined()
+make: "cond-func.mk" line 138: Missing ')' after argument '' for 'defined'
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
Index: src/usr.bin/make/unit-tests/cond-func-defined.mk
diff -u src/usr.bin/make/unit-tests/cond-func-defined.mk:1.12 src/usr.bin/make/unit-tests/cond-func-defined.mk:1.13
--- src/usr.bin/make/unit-tests/cond-func-defined.mk:1.12 Tue Apr 23 22:51:28 2024
+++ src/usr.bin/make/unit-tests/cond-func-defined.mk Tue Aug 6 17:46:01 2024
@@ -1,4 +1,4 @@
-# $NetBSD: cond-func-defined.mk,v 1.12 2024/04/23 22:51:28 rillig Exp $
+# $NetBSD: cond-func-defined.mk,v 1.13 2024/08/06 17:46:01 rillig Exp $
#
# Tests for the defined() function in .if conditions.
@@ -20,7 +20,7 @@ ${:UA B}= variable name with spaces
.endif
# The argument of a function must not directly contain whitespace.
-# expect+1: Missing closing parenthesis for defined()
+# expect+1: Missing ')' after argument 'A' for 'defined'
.if !defined(A B)
. error
.endif
@@ -30,7 +30,7 @@ ${:UA B}= variable name with spaces
. error
.endif
-# expect+1: Missing closing parenthesis for defined()
+# expect+1: Missing ')' after argument 'DEF' for 'defined'
.if defined(DEF
. error
.else
Index: src/usr.bin/make/unit-tests/cond-func.mk
diff -u src/usr.bin/make/unit-tests/cond-func.mk:1.15 src/usr.bin/make/unit-tests/cond-func.mk:1.16
--- src/usr.bin/make/unit-tests/cond-func.mk:1.15 Sat Jul 6 21:21:10 2024
+++ src/usr.bin/make/unit-tests/cond-func.mk Tue Aug 6 17:46:01 2024
@@ -1,4 +1,4 @@
-# $NetBSD: cond-func.mk,v 1.15 2024/07/06 21:21:10 rillig Exp $
+# $NetBSD: cond-func.mk,v 1.16 2024/08/06 17:46:01 rillig Exp $
#
# Tests for those parts of the functions in .if conditions that are common
# among several functions.
@@ -33,7 +33,7 @@ ${VARNAME_UNBALANCED_BRACES}= variable n
.endif
# The argument of a function must not directly contain whitespace.
-# expect+1: Missing closing parenthesis for defined()
+# expect+1: Missing ')' after argument 'A' for 'defined'
.if !defined(A B)
. error
.endif
@@ -49,11 +49,11 @@ ${VARNAME_UNBALANCED_BRACES}= variable n
#
# It's not entirely clear why these characters are forbidden.
# The most plausible reason seems to be typo detection.
-# expect+1: Missing closing parenthesis for defined()
+# expect+1: Missing ')' after argument 'A' for 'defined'
.if !defined(A&B)
. error
.endif
-# expect+1: Missing closing parenthesis for defined()
+# expect+1: Missing ')' after argument 'A' for 'defined'
.if !defined(A|B)
. error
.endif
@@ -134,7 +134,7 @@ defined-var= # defined but empty
. error
.endif
-# expect+1: Missing closing parenthesis for defined()
+# expect+1: Missing ')' after argument '' for 'defined'
.if defined(
. error
.else
Index: src/usr.bin/make/unit-tests/varname.exp
diff -u src/usr.bin/make/unit-tests/varname.exp:1.21 src/usr.bin/make/unit-tests/varname.exp:1.22
--- src/usr.bin/make/unit-tests/varname.exp:1.21 Thu Jul 4 20:18:40 2024
+++ src/usr.bin/make/unit-tests/varname.exp Tue Aug 6 17:46:01 2024
@@ -5,7 +5,7 @@ Var_Parse: ${VARNAME} (eval)
Global: VAR((( = 3 open parentheses
Var_Parse: ${VAR(((}}}}" != "3 open parentheses}}}" (eval)
Global: .ALLTARGETS = VAR(((=)
-make: "varname.mk" line 32: No closing parenthesis in archive specification
+make: "varname.mk" line 32: Missing ')' in archive specification
make: "varname.mk" line 32: Error in archive specification: "VAR"
Var_Parse: ${:UVAR\(\(\(}= try2 (eval-defined)
Evaluating modifier ${:U...} on value "" (eval-defined, undefined)
Index: src/usr.bin/make/unit-tests/varname.mk
diff -u src/usr.bin/make/unit-tests/varname.mk:1.14 src/usr.bin/make/unit-tests/varname.mk:1.15
--- src/usr.bin/make/unit-tests/varname.mk:1.14 Sun Nov 19 21:47:52 2023
+++ src/usr.bin/make/unit-tests/varname.mk Tue Aug 6 17:46:01 2024
@@ -1,4 +1,4 @@
-# $NetBSD: varname.mk,v 1.14 2023/11/19 21:47:52 rillig Exp $
+# $NetBSD: varname.mk,v 1.15 2024/08/06 17:46:01 rillig Exp $
#
# Tests for special variables, such as .MAKE or .PARSEDIR.
# And for variable names in general.
@@ -28,7 +28,7 @@ ${VARNAME}= 3 open parentheses
# balanced. At the end of the line, there are still 3 levels open, which
# means the variable name is not finished.
# expect+2: Error in archive specification: "VAR"
-# expect+1: No closing parenthesis in archive specification
+# expect+1: Missing ')' in archive specification
${:UVAR(((}= try1
# On the left-hand side of a variable assignments, the backslash is not parsed
# as an escape character, therefore the parentheses still count to the nesting