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: use straight quotes for error 'Bad condit...



details:   https://anonhg.NetBSD.org/src/rev/30fa23921a82
branches:  trunk
changeset: 961447:30fa23921a82
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Apr 19 22:22:27 2021 +0000

description:
make: use straight quotes for error 'Bad conditional expression'

This diagnostic was supposed to be an error, see ApplyModifier_IfElse.

When such an error occurs while the makefiles are read, make stops with
an error, as can be expected.  But when such an error occurs later,
after all makefiles have been read, the message is printed but make does
not stop.

In lint mode (-dL), make stops in such a case.  I didn't dare to make
this the default behavior, out of fear of breaking existing build
infrastructure, not only in NetBSD or pkgsrc, but also FreeBSD and other
operating systems that use the bmake distribution, generated from the
same source code.

diffstat:

 usr.bin/make/unit-tests/cond-late.exp     |   2 +-
 usr.bin/make/unit-tests/cond1.exp         |   2 +-
 usr.bin/make/unit-tests/varmod-ifelse.exp |  12 ++++++------
 usr.bin/make/unit-tests/varmod-ifelse.mk  |   3 +--
 usr.bin/make/var.c                        |   6 +++---
 5 files changed, 12 insertions(+), 13 deletions(-)

diffs (93 lines):

diff -r 740d18c09fe7 -r 30fa23921a82 usr.bin/make/unit-tests/cond-late.exp
--- a/usr.bin/make/unit-tests/cond-late.exp     Mon Apr 19 22:05:29 2021 +0000
+++ b/usr.bin/make/unit-tests/cond-late.exp     Mon Apr 19 22:22:27 2021 +0000
@@ -1,4 +1,4 @@
-make: Bad conditional expression ` != "no"' in  != "no"?:
+make: Bad conditional expression ' != "no"' in ' != "no"?:'
 yes
 no
 exit status 0
diff -r 740d18c09fe7 -r 30fa23921a82 usr.bin/make/unit-tests/cond1.exp
--- a/usr.bin/make/unit-tests/cond1.exp Mon Apr 19 22:05:29 2021 +0000
+++ b/usr.bin/make/unit-tests/cond1.exp Mon Apr 19 22:22:27 2021 +0000
@@ -17,7 +17,7 @@
 5 is  prime
 
 make: String comparison operator must be either == or !=
-make: Bad conditional expression `"0" > 0' in "0" > 0?OK:No
+make: Bad conditional expression '"0" > 0' in '"0" > 0?OK:No'
 
 OK
 exit status 0
diff -r 740d18c09fe7 -r 30fa23921a82 usr.bin/make/unit-tests/varmod-ifelse.exp
--- a/usr.bin/make/unit-tests/varmod-ifelse.exp Mon Apr 19 22:05:29 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-ifelse.exp Mon Apr 19 22:22:27 2021 +0000
@@ -1,21 +1,21 @@
-make: Bad conditional expression `variable expression == "literal"' in variable expression == "literal"?bad:bad
+make: Bad conditional expression 'variable expression == "literal"' in 'variable expression == "literal"?bad:bad'
 make: "varmod-ifelse.mk" line 27: Malformed conditional (${${:Uvariable expression} == "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 ' == ""' in ' == ""?bad-assign:bad-assign'
+make: Bad conditional expression ' == ""' in ' == ""?bad-cond:bad-cond'
 make: "varmod-ifelse.mk" line 44: Malformed conditional (${${UNDEF} == "":?bad-cond:bad-cond})
-make: Bad conditional expression `1 == == 2' in 1 == == 2?yes:no
+make: Bad conditional expression '1 == == 2' in '1 == == 2?yes:no'
 make: "varmod-ifelse.mk" line 66: Malformed conditional (${1 == == 2:?yes:no} != "")
 CondParser_Eval: "${1 == == 2:?yes:no}" != ""
 CondParser_Eval: 1 == == 2
 lhs = 1.000000, rhs = 0.000000, op = ==
-make: Bad conditional expression `1 == == 2' in 1 == == 2?yes:no
+make: Bad conditional expression '1 == == 2' in '1 == == 2?yes:no'
 lhs = "", rhs = "", op = !=
 make: "varmod-ifelse.mk" line 92: warning: Oops, the parse error should have been propagated.
 CondParser_Eval: ${ ${:U\$}{VAR} == value :?ok:bad} != "ok"
 CondParser_Eval: ${VAR} == value 
 lhs = "value", rhs = "value", op = ==
 lhs = "ok", rhs = "ok", op = !=
-make: Bad conditional expression `string == "literal" && no >= 10' in string == "literal" && no >= 10?yes:no
+make: Bad conditional expression 'string == "literal" && no >= 10' in 'string == "literal" && no >= 10?yes:no'
 make: "varmod-ifelse.mk" line 127: .
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
diff -r 740d18c09fe7 -r 30fa23921a82 usr.bin/make/unit-tests/varmod-ifelse.mk
--- a/usr.bin/make/unit-tests/varmod-ifelse.mk  Mon Apr 19 22:05:29 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-ifelse.mk  Mon Apr 19 22:22:27 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-ifelse.mk,v 1.12 2021/04/19 22:05:29 rillig Exp $
+# $NetBSD: varmod-ifelse.mk,v 1.13 2021/04/19 22:22:27 rillig Exp $
 #
 # Tests for the ${cond:?then:else} variable modifier, which evaluates either
 # the then-expression or the else-expression, depending on the condition.
@@ -125,4 +125,3 @@
 STRING=                string
 NUMBER=                no
 .info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}.
-# XXX: In the diagnostic, the second placeholder is missing the quotes.
diff -r 740d18c09fe7 -r 30fa23921a82 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Mon Apr 19 22:05:29 2021 +0000
+++ b/usr.bin/make/var.c        Mon Apr 19 22:22:27 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.929 2021/04/14 16:59:34 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.930 2021/04/19 22:22:27 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.929 2021/04/14 16:59:34 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.930 2021/04/19 22:22:27 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -3384,7 +3384,7 @@
        (*pp)--;                /* Go back to the ch->endc. */
 
        if (cond_rc == COND_INVALID) {
-               Error("Bad conditional expression `%s' in %s?%s:%s",
+               Error("Bad conditional expression '%s' in '%s?%s:%s'",
                    expr->name, expr->name, then_expr.str, else_expr.str);
                return AMR_CLEANUP;
        }



Home | Main Index | Thread Index | Old Index