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 tests/make: demonstrate unexpected b...
details: https://anonhg.NetBSD.org/src/rev/8e93dc9bb74c
branches: trunk
changeset: 1020672:8e93dc9bb74c
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Apr 19 22:05:29 2021 +0000
description:
tests/make: demonstrate unexpected behavior of the modifier ':?'
diffstat:
usr.bin/make/unit-tests/varmod-ifelse.exp | 2 ++
usr.bin/make/unit-tests/varmod-ifelse.mk | 19 ++++++++++++++++---
2 files changed, 18 insertions(+), 3 deletions(-)
diffs (42 lines):
diff -r 39b07ae2e536 -r 8e93dc9bb74c usr.bin/make/unit-tests/varmod-ifelse.exp
--- a/usr.bin/make/unit-tests/varmod-ifelse.exp Mon Apr 19 21:52:17 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-ifelse.exp Mon Apr 19 22:05:29 2021 +0000
@@ -15,6 +15,8 @@
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: "varmod-ifelse.mk" line 127: .
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff -r 39b07ae2e536 -r 8e93dc9bb74c usr.bin/make/unit-tests/varmod-ifelse.mk
--- a/usr.bin/make/unit-tests/varmod-ifelse.mk Mon Apr 19 21:52:17 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-ifelse.mk Mon Apr 19 22:05:29 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-ifelse.mk,v 1.11 2021/04/11 13:35:56 rillig Exp $
+# $NetBSD: varmod-ifelse.mk,v 1.12 2021/04/19 22:05:29 rillig Exp $
#
# Tests for the ${cond:?then:else} variable modifier, which evaluates either
# the then-expression or the else-expression, depending on the condition.
@@ -111,5 +111,18 @@
.endif
.MAKEFLAGS: -d0
-all:
- @:;
+# Seen on 2021-04-19 when building external/bsd/tmux with HAVE_LLVM=yes
+# and HAVE_GCC=no.
+#
+# TODO: make should at least describe the part of the condition that is
+# wrong. In this case it is probably the "no >= 10". Ideally that should
+# not matter though since the left-hand side of the '&&' evaluates to false,
+# thus the right-hand side only needs to be parsed, not evaluated. Since
+# this is the modifier ':?', which expands subexpressions before parsing
+# the condition, the "no >= 10" is probably a parse error since it "can be
+# seen at compile-time" that the operand types of '>=' don't match. Only
+# that the concept of "compile-time" does not really apply here.
+STRING= string
+NUMBER= no
+.info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}.
+# XXX: In the diagnostic, the second placeholder is missing the quotes.
Home |
Main Index |
Thread Index |
Old Index