Module Name:    src
Committed By:   rillig
Date:           Mon Sep 14 21:52:49 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: opt-debug-lint.exp opt-debug-lint.mk

Log Message:
make(1): add test for wrong error in lint mode for undefined variable


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/opt-debug-lint.exp \
    src/usr.bin/make/unit-tests/opt-debug-lint.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/opt-debug-lint.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-lint.exp:1.5 src/usr.bin/make/unit-tests/opt-debug-lint.exp:1.6
--- src/usr.bin/make/unit-tests/opt-debug-lint.exp:1.5	Mon Sep 14 07:13:29 2020
+++ src/usr.bin/make/unit-tests/opt-debug-lint.exp	Mon Sep 14 21:52:49 2020
@@ -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
Index: src/usr.bin/make/unit-tests/opt-debug-lint.mk
diff -u src/usr.bin/make/unit-tests/opt-debug-lint.mk:1.5 src/usr.bin/make/unit-tests/opt-debug-lint.mk:1.6
--- src/usr.bin/make/unit-tests/opt-debug-lint.mk:1.5	Mon Sep 14 21:23:58 2020
+++ src/usr.bin/make/unit-tests/opt-debug-lint.mk	Mon Sep 14 21:52:49 2020
@@ -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:
 	@:;

Reply via email to