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 wrong error in...
details: https://anonhg.NetBSD.org/src/rev/ba507b6de42e
branches: trunk
changeset: 944018:ba507b6de42e
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Sep 14 21:52:49 2020 +0000
description:
make(1): add test for wrong error in lint mode for undefined variable
diffstat:
usr.bin/make/unit-tests/opt-debug-lint.exp | 1 +
usr.bin/make/unit-tests/opt-debug-lint.mk | 14 +++++++++++++-
2 files changed, 14 insertions(+), 1 deletions(-)
diffs (37 lines):
diff -r a7f6172a33c2 -r ba507b6de42e usr.bin/make/unit-tests/opt-debug-lint.exp
--- a/usr.bin/make/unit-tests/opt-debug-lint.exp Mon Sep 14 21:23:58 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-lint.exp Mon Sep 14 21:52:49 2020 +0000
@@ -1,5 +1,6 @@
make: "opt-debug-lint.mk" line 19: Variable "X" is undefined
make: "opt-debug-lint.mk" line 41: Variable "UNDEF" is undefined
+make: "opt-debug-lint.mk" line 58: Variable "UNDEF" is undefined
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff -r a7f6172a33c2 -r ba507b6de42e usr.bin/make/unit-tests/opt-debug-lint.mk
--- a/usr.bin/make/unit-tests/opt-debug-lint.mk Mon Sep 14 21:23:58 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-lint.mk Mon Sep 14 21:52:49 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: opt-debug-lint.mk,v 1.5 2020/09/14 21:23:58 rillig Exp $
+# $NetBSD: opt-debug-lint.mk,v 1.6 2020/09/14 21:52:49 rillig Exp $
#
# Tests for the -dL command line option, which runs additional checks
# to catch common mistakes, such as unclosed variable expressions.
@@ -47,5 +47,17 @@
# observable from the outside of the function Var_Parse.
${UNDEF}: ${UNDEF}
+# In a condition that has a defined(UNDEF) guard, all guarded conditions
+# may assume that the variable is defined since they will only be evaluated
+# if the variable is indeed defined. Otherwise they are only parsed, and
+# for parsing it doesn't make a difference whether the variable is defined
+# or not.
+#
+# FIXME: As of 2020-09-14, the following line prints an error message saying
+# that UNDEF is undefined.
+.if defined(UNDEF) && exists(${UNDEF})
+. error
+.endif
+
all:
@:;
Home |
Main Index |
Thread Index |
Old Index