Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make/unit-tests make(1): add test for evaluation of ...
details: https://anonhg.NetBSD.org/src/rev/27ca19468adf
branches: trunk
changeset: 1014052:27ca19468adf
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Sep 11 05:12:08 2020 +0000
description:
make(1): add test for evaluation of condition after parse error
diffstat:
usr.bin/make/unit-tests/cond-op.exp | 4 +++-
usr.bin/make/unit-tests/cond-op.mk | 14 ++++++++++++--
2 files changed, 15 insertions(+), 3 deletions(-)
diffs (47 lines):
diff -r 2da5d36836b1 -r 27ca19468adf usr.bin/make/unit-tests/cond-op.exp
--- a/usr.bin/make/unit-tests/cond-op.exp Fri Sep 11 05:03:20 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-op.exp Fri Sep 11 05:12:08 2020 +0000
@@ -1,5 +1,7 @@
make: "cond-op.mk" line 45: Malformed conditional ("!word" == !word)
-make: "cond-op.mk" line 57: Parsing continues until here.
+make: "cond-op.mk" line 56: Malformed conditional (0 ${ERR::=evaluated})
+make: "cond-op.mk" line 60: warning: After detecting a parse error, the rest is evaluated.
+make: "cond-op.mk" line 64: Parsing continues until here.
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff -r 2da5d36836b1 -r 27ca19468adf usr.bin/make/unit-tests/cond-op.mk
--- a/usr.bin/make/unit-tests/cond-op.mk Fri Sep 11 05:03:20 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-op.mk Fri Sep 11 05:12:08 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-op.mk,v 1.5 2020/09/11 04:40:26 rillig Exp $
+# $NetBSD: cond-op.mk,v 1.6 2020/09/11 05:12:08 rillig Exp $
#
# Tests for operators like &&, ||, ! in .if conditions.
#
@@ -41,7 +41,7 @@
# This condition is malformed because the '!' on the right-hand side must not
# appear unquoted. If any, it must be enclosed in quotes.
# In any case, it is not interpreted as a negation of an unquoted string.
-# See CondGetString.
+# See CondParser_String.
.if "!word" == !word
.error
.endif
@@ -53,6 +53,16 @@
.error
.endif
+# As soon as the parser sees the '$', it knows that the condition will
+# be malformed. Therefore there is no point in evaluating it.
+# As of 2020-09-11, that part of the condition is evaluated nevertheless.
+.if 0 ${ERR::=evaluated}
+. error
+.endif
+.if ${ERR:Uundefined} == evaluated
+. warning After detecting a parse error, the rest is evaluated.
+.endif
+
# Just in case that parsing should ever stop on the first error.
.info Parsing continues until here.
Home |
Main Index |
Thread Index |
Old Index