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 indirect unclo...



details:   https://anonhg.NetBSD.org/src/rev/d28870fa345f
branches:  trunk
changeset: 936558:d28870fa345f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jul 30 13:50:27 2020 +0000

description:
make(1): add test for indirect unclosed variable

The error message mentions only the original variable name right now.
It's left to the Makefile author to see where the actual unclosed
variable value comes from.  From a usability standpoint that's not
optimal, but everything else would need additional cycles even in the
good cases, or it might have side-effects when evaluating a variable
twice (once to detect the error, and a second time to find out the
details of the error).

diffstat:

 usr.bin/make/unit-tests/varmisc.exp |  2 ++
 usr.bin/make/unit-tests/varmisc.mk  |  7 ++++++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diffs (39 lines):

diff -r fde898e5ca42 -r d28870fa345f usr.bin/make/unit-tests/varmisc.exp
--- a/usr.bin/make/unit-tests/varmisc.exp       Thu Jul 30 07:31:30 2020 +0000
+++ b/usr.bin/make/unit-tests/varmisc.exp       Thu Jul 30 13:50:27 2020 +0000
@@ -66,5 +66,7 @@
 
 make: Unclosed variable "UNCLOSED.3"
 
+make: Unclosed variable "UNCLOSED_ORIG"
+
 varerror-unclosed:end
 exit status 0
diff -r fde898e5ca42 -r d28870fa345f usr.bin/make/unit-tests/varmisc.mk
--- a/usr.bin/make/unit-tests/varmisc.mk        Thu Jul 30 07:31:30 2020 +0000
+++ b/usr.bin/make/unit-tests/varmisc.mk        Thu Jul 30 13:50:27 2020 +0000
@@ -1,4 +1,4 @@
-# $Id: varmisc.mk,v 1.19 2020/07/28 19:39:43 rillig Exp $
+# $Id: varmisc.mk,v 1.20 2020/07/30 13:50:27 rillig Exp $
 #
 # Miscellaneous variable tests.
 
@@ -194,6 +194,10 @@
 # Since 2020-07-28, make complains about unclosed variables.
 # Before that, it had not complained about unclosed variables only when
 # parsing the modifiers, but not when parsing the variable name.
+
+UNCLOSED_INDIR_1=      ${UNCLOSED_ORIG
+UNCLOSED_INDIR_2=      ${UNCLOSED_INDIR_1}
+
 varerror-unclosed:
        @echo $@:begin
        @echo $(
@@ -205,6 +209,7 @@
 .for i in 1 2 3
        @echo ${UNCLOSED.${i}
 .endfor
+       @echo ${UNCLOSED_INDIR_2}
        @echo $@:end
 
 # As of 2020-07-28, .undef only undefines the first variable.



Home | Main Index | Thread Index | Old Index