Tue Feb 16 18:02:19 2021 UTC ()
make: demonstrate inconsistency in .undef of an exported variable


(rillig)
diff -r1.5 -r1.6 src/usr.bin/make/unit-tests/directive-undef.exp
diff -r1.9 -r1.10 src/usr.bin/make/unit-tests/directive-undef.mk

cvs diff -r1.5 -r1.6 src/usr.bin/make/unit-tests/directive-undef.exp (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/directive-undef.exp 2020/12/22 20:10:21 1.5
+++ src/usr.bin/make/unit-tests/directive-undef.exp 2021/02/16 18:02:19 1.6
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
1make: "directive-undef.mk" line 29: The .undef directive requires an argument 1make: "directive-undef.mk" line 29: The .undef directive requires an argument
2make: "directive-undef.mk" line 86: Unknown modifier 'Z' 2make: "directive-undef.mk" line 86: Unknown modifier 'Z'
 3make: "directive-undef.mk" line 103: warning: UT_EXPORTED is still listed in .MAKE.EXPORTED even though spaceit is not exported anymore.
3make: Fatal errors encountered -- cannot continue 4make: Fatal errors encountered -- cannot continue
4make: stopped in unit-tests 5make: stopped in unit-tests
5exit status 1 6exit status 1

cvs diff -r1.9 -r1.10 src/usr.bin/make/unit-tests/directive-undef.mk (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/directive-undef.mk 2020/12/22 20:10:21 1.9
+++ src/usr.bin/make/unit-tests/directive-undef.mk 2021/02/16 18:02:19 1.10
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: directive-undef.mk,v 1.9 2020/12/22 20:10:21 rillig Exp $ 1# $NetBSD: directive-undef.mk,v 1.10 2021/02/16 18:02:19 rillig Exp $
2# 2#
3# Tests for the .undef directive. 3# Tests for the .undef directive.
4# 4#
5# See also: 5# See also:
6# directive-misspellings.mk 6# directive-misspellings.mk
7 7
8# Before var.c 1.737 from 2020-12-19, .undef only undefined the first 8# Before var.c 1.737 from 2020-12-19, .undef only undefined the first
9# variable, silently skipping all further variable names. 9# variable, silently skipping all further variable names.
10# 10#
11# Before var.c 1.761 from 2020-12-22, .undef complained about too many 11# Before var.c 1.761 from 2020-12-22, .undef complained about too many
12# arguments. 12# arguments.
13# 13#
14# Since var.c 1.761 from 2020-12-22, .undef handles multiple variable names 14# Since var.c 1.761 from 2020-12-22, .undef handles multiple variable names
@@ -76,15 +76,32 @@ ${DOLLAR}= dollar @@ -76,15 +76,32 @@ ${DOLLAR}= dollar
76.if defined(${DOLLAR}) 76.if defined(${DOLLAR})
77. error 77. error
78.endif 78.endif
79 79
80 80
81# Since var.c 1.762 from 2020-12-22, parse errors in the argument should be 81# Since var.c 1.762 from 2020-12-22, parse errors in the argument should be
82# properly detected and should stop the .undef directive from doing any work. 82# properly detected and should stop the .undef directive from doing any work.
83# 83#
84# As of var.c 1.762, this doesn't happen though because the error handling 84# As of var.c 1.762, this doesn't happen though because the error handling
85# in Var_Parse and Var_Subst is not done properly. 85# in Var_Parse and Var_Subst is not done properly.
86.undef ${VARNAMES:L:Z} 86.undef ${VARNAMES:L:Z}
87 87
88 88
 89UT_EXPORTED= exported-value
 90.export UT_EXPORTED
 91.if ${:!echo "\${UT_EXPORTED:-not-exported}"!} != "exported-value"
 92. error
 93.endif
 94.if !${.MAKE.EXPORTED:MUT_EXPORTED}
 95. error
 96.endif
 97.undef UT_EXPORTED # XXX: does not update .MAKE.EXPORTED
 98.if ${:!echo "\${UT_EXPORTED:-not-exported}"!} != "not-exported"
 99. error
 100.endif
 101.if ${.MAKE.EXPORTED:MUT_EXPORTED}
 102. warning UT_EXPORTED is still listed in .MAKE.EXPORTED even though $\
 103 it is not exported anymore.
 104.endif
 105
 106
89all: 107all:
90 @:;