diff options
| author | rillig <rillig@NetBSD.org> | 2021-04-19 23:51:42 +0000 |
|---|---|---|
| committer | rillig <rillig@NetBSD.org> | 2021-04-19 23:51:42 +0000 |
| commit | 00bc35960805f6e90bb98ff718e6ec3a4df86c8a (patch) | |
| tree | 3f4ff79a1310ba6dd01e9da8ad9b261bcf09bd65 /usr.bin/make/unit-tests | |
| parent | 27df4325212d8f76b404a8ade9047c6db74d2561 (diff) | |
make: do not complain when skipping the condition 'no >= 10'
Seen in external/bsd/tmux when building with Clang. See
varmod-ifelse.mk for the detailed story.
Diffstat (limited to 'usr.bin/make/unit-tests')
| -rw-r--r-- | usr.bin/make/unit-tests/varmod-ifelse.exp | 4 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/varmod-ifelse.mk | 18 |
2 files changed, 11 insertions, 11 deletions
diff --git a/usr.bin/make/unit-tests/varmod-ifelse.exp b/usr.bin/make/unit-tests/varmod-ifelse.exp index 93caf1b32ff..7f824110dfe 100644 --- a/usr.bin/make/unit-tests/varmod-ifelse.exp +++ b/usr.bin/make/unit-tests/varmod-ifelse.exp @@ -15,8 +15,8 @@ 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: "varmod-ifelse.mk" line 153: . +make: "varmod-ifelse.mk" line 153: no. +make: "varmod-ifelse.mk" line 154: String comparison operator must be either == or != make: Bad conditional expression 'string == "literal" || no >= 10' in 'string == "literal" || no >= 10?yes:no' make: "varmod-ifelse.mk" line 154: . make: Bad conditional expression 'string == "literal" && >= 10' in 'string == "literal" && >= 10?yes:no' diff --git a/usr.bin/make/unit-tests/varmod-ifelse.mk b/usr.bin/make/unit-tests/varmod-ifelse.mk index 92ea9994ac2..08550b4a930 100644 --- a/usr.bin/make/unit-tests/varmod-ifelse.mk +++ b/usr.bin/make/unit-tests/varmod-ifelse.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-ifelse.mk,v 1.15 2021/04/19 23:43:14 rillig Exp $ +# $NetBSD: varmod-ifelse.mk,v 1.16 2021/04/19 23:51:42 rillig Exp $ # # Tests for the ${cond:?then:else} variable modifier, which evaluates either # the then-expression or the else-expression, depending on the condition. @@ -140,14 +140,14 @@ VAR= value # therefore parsing stopped at the '>', producing the 'Bad conditional # expression'. # -# 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. +# Ideally, the conditional expression would not be expanded before parsing +# it. This would allow to write the conditions exactly as seen below. That +# change has a high chance of breaking _some_ existing code and would need +# to be thoroughly tested. +# +# Since cond.c 1.262 from 2021-04-20, make reports a more specific error +# message in situations like these, pointing directly to the specific problem +# instead of just saying that the whole condition is bad. STRING= string NUMBER= no # not really a number .info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}. |
