Module Name:    src
Committed By:   rillig
Date:           Sun Dec 10 20:12:28 UTC 2023

Modified Files:
        src/usr.bin/make: var.c
        src/usr.bin/make/unit-tests: cond-late.exp cond-late.mk
            varmod-ifelse.exp varmod-ifelse.mk

Log Message:
make: remove redundant text from diagnostic about bad '?:' modifier


To generate a diff of this commit:
cvs rdiff -u -r1.1080 -r1.1081 src/usr.bin/make/var.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-late.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-late.mk
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/varmod-ifelse.exp
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/make/unit-tests/varmod-ifelse.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/var.c
diff -u src/usr.bin/make/var.c:1.1080 src/usr.bin/make/var.c:1.1081
--- src/usr.bin/make/var.c:1.1080	Sun Dec 10 20:03:30 2023
+++ src/usr.bin/make/var.c	Sun Dec 10 20:12:28 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1080 2023/12/10 20:03:30 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1081 2023/12/10 20:12:28 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1080 2023/12/10 20:03:30 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1081 2023/12/10 20:12:28 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -3476,8 +3476,8 @@ ApplyModifier_IfElse(const char **pp, Mo
 	if (cond_rc == CR_ERROR) {
 		Substring thenExpr = LazyBuf_Get(&thenBuf);
 		Substring elseExpr = LazyBuf_Get(&elseBuf);
-		Error("Bad conditional expression '%s' in '%s?%.*s:%.*s'",
-		    expr->name, expr->name,
+		Error("Bad conditional expression '%s' before '?%.*s:%.*s'",
+		    expr->name,
 		    (int)Substring_Length(thenExpr), thenExpr.start,
 		    (int)Substring_Length(elseExpr), elseExpr.start);
 		LazyBuf_Done(&thenBuf);

Index: src/usr.bin/make/unit-tests/cond-late.exp
diff -u src/usr.bin/make/unit-tests/cond-late.exp:1.4 src/usr.bin/make/unit-tests/cond-late.exp:1.5
--- src/usr.bin/make/unit-tests/cond-late.exp:1.4	Mon Apr 19 22:22:27 2021
+++ src/usr.bin/make/unit-tests/cond-late.exp	Sun Dec 10 20:12:28 2023
@@ -1,4 +1,4 @@
-make: Bad conditional expression ' != "no"' in ' != "no"?:'
+make: Bad conditional expression ' != "no"' before '?:'
 yes
 no
 exit status 0

Index: src/usr.bin/make/unit-tests/cond-late.mk
diff -u src/usr.bin/make/unit-tests/cond-late.mk:1.5 src/usr.bin/make/unit-tests/cond-late.mk:1.6
--- src/usr.bin/make/unit-tests/cond-late.mk:1.5	Sun Nov 19 21:47:52 2023
+++ src/usr.bin/make/unit-tests/cond-late.mk	Sun Dec 10 20:12:28 2023
@@ -1,4 +1,4 @@
-# $NetBSD: cond-late.mk,v 1.5 2023/11/19 21:47:52 rillig Exp $
+# $NetBSD: cond-late.mk,v 1.6 2023/12/10 20:12:28 rillig Exp $
 #
 # Using the :? modifier, expressions can contain conditional
 # expressions that are evaluated late, at expansion time.
@@ -31,6 +31,6 @@ cond-literal:
 
 VAR=	${${UNDEF} != "no":?:}
 # expect-reset
-# expect: make: Bad conditional expression ' != "no"' in ' != "no"?:'
+# expect: make: Bad conditional expression ' != "no"' before '?:'
 .if empty(VAR:Mpattern)
 .endif

Index: src/usr.bin/make/unit-tests/varmod-ifelse.exp
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.18 src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.19
--- src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.18	Sun Nov 19 21:47:52 2023
+++ src/usr.bin/make/unit-tests/varmod-ifelse.exp	Sun Dec 10 20:12:28 2023
@@ -1,14 +1,14 @@
-make: Bad conditional expression 'bare words == "literal"' in 'bare words == "literal"?bad:bad'
+make: Bad conditional expression 'bare words == "literal"' before '?bad:bad'
 make: "varmod-ifelse.mk" line 28: Malformed conditional (${${:Ubare words} == "literal":?bad:bad})
-make: Bad conditional expression ' == ""' in ' == ""?bad-assign:bad-assign'
-make: Bad conditional expression ' == ""' in ' == ""?bad-cond:bad-cond'
+make: Bad conditional expression ' == ""' before '?bad-assign:bad-assign'
+make: Bad conditional expression ' == ""' before '?bad-cond:bad-cond'
 make: "varmod-ifelse.mk" line 46: Malformed conditional (${${UNDEF} == "":?bad-cond:bad-cond})
-make: Bad conditional expression '1 == == 2' in '1 == == 2?yes:no'
+make: Bad conditional expression '1 == == 2' before '?yes:no'
 make: "varmod-ifelse.mk" line 69: Malformed conditional (${1 == == 2:?yes:no} != "")
 CondParser_Eval: "${1 == == 2:?yes:no}" != ""
 CondParser_Eval: 1 == == 2
 Comparing 1.000000 == 0.000000
-make: Bad conditional expression '1 == == 2' in '1 == == 2?yes:no'
+make: Bad conditional expression '1 == == 2' before '?yes:no'
 Comparing "" != ""
 make: "varmod-ifelse.mk" line 96: warning: Oops, the parse error should have been propagated.
 CondParser_Eval: ${ ${:U\$}{VAR} == value:?ok:bad} != "ok"
@@ -17,15 +17,15 @@ Comparing "value" == "value"
 Comparing "ok" != "ok"
 make: "varmod-ifelse.mk" line 158: no.
 make: "varmod-ifelse.mk" line 162: Comparison with '>=' requires both operands 'no' and '10' to be numeric
-make: Bad conditional expression 'string == "literal" || no >= 10' in 'string == "literal" || no >= 10?yes:no'
+make: Bad conditional expression 'string == "literal" || no >= 10' before '?yes:no'
 make: "varmod-ifelse.mk" line 162: .
-make: Bad conditional expression 'string == "literal" &&  >= 10' in 'string == "literal" &&  >= 10?yes:no'
+make: Bad conditional expression 'string == "literal" &&  >= 10' before '?yes:no'
 make: "varmod-ifelse.mk" line 169: .
-make: Bad conditional expression 'string == "literal" ||  >= 10' in 'string == "literal" ||  >= 10?yes:no'
+make: Bad conditional expression 'string == "literal" ||  >= 10' before '?yes:no'
 make: "varmod-ifelse.mk" line 172: .
 make: "varmod-ifelse.mk" line 180: <true>
 make: "varmod-ifelse.mk" line 183: <false>
-make: Bad conditional expression '	' in '	?true:false'
+make: Bad conditional expression '	' before '?true:false'
 make: "varmod-ifelse.mk" line 186: <>
 CondParser_Eval: 0 && ${1:?${:Uthen0:S,}},,}:${:Uelse0:S,}},,}} != "not evaluated"
 CondParser_Eval: 1 && ${0:?${:Uthen1:S,}},,}:${:Uelse1:S,}},,}} != "else1"

Index: src/usr.bin/make/unit-tests/varmod-ifelse.mk
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.25 src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.26
--- src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.25	Sun Nov 19 21:47:52 2023
+++ src/usr.bin/make/unit-tests/varmod-ifelse.mk	Sun Dec 10 20:12:28 2023
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-ifelse.mk,v 1.25 2023/11/19 21:47:52 rillig Exp $
+# $NetBSD: varmod-ifelse.mk,v 1.26 2023/12/10 20:12:28 rillig Exp $
 #
 # Tests for the ${cond:?then:else} variable modifier, which evaluates either
 # the then-expression or the else-expression, depending on the condition.
@@ -157,17 +157,17 @@ NUMBER=		no		# not really a number
 # expect+1: no.
 .info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}.
 # expect+3: Comparison with '>=' requires both operands 'no' and '10' to be numeric
-# expect: make: Bad conditional expression 'string == "literal" || no >= 10' in 'string == "literal" || no >= 10?yes:no'
+# expect: make: Bad conditional expression 'string == "literal" || no >= 10' before '?yes:no'
 # expect+1: .
 .info ${${STRING} == "literal" || ${NUMBER} >= 10:?yes:no}.
 
 # The following situation occasionally occurs with MKINET6 or similar
 # variables.
 NUMBER=		# empty, not really a number either
-# expect: make: Bad conditional expression 'string == "literal" &&  >= 10' in 'string == "literal" &&  >= 10?yes:no'
+# expect: make: Bad conditional expression 'string == "literal" &&  >= 10' before '?yes:no'
 # expect+1: .
 .info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}.
-# expect: make: Bad conditional expression 'string == "literal" ||  >= 10' in 'string == "literal" ||  >= 10?yes:no'
+# expect: make: Bad conditional expression 'string == "literal" ||  >= 10' before '?yes:no'
 # expect+1: .
 .info ${${STRING} == "literal" || ${NUMBER} >= 10:?yes:no}.
 

Reply via email to