From a017c69c8113e908ac5a403ffca434001236cc7b Mon Sep 17 00:00:00 2001 From: rillig Date: Tue, 16 Feb 2021 18:02:19 +0000 Subject: [PATCH] make: demonstrate inconsistency in .undef of an exported variable --- usr.bin/make/unit-tests/directive-undef.exp | 1 + usr.bin/make/unit-tests/directive-undef.mk | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/usr.bin/make/unit-tests/directive-undef.exp b/usr.bin/make/unit-tests/directive-undef.exp index d64cb8b5afe0..bb3c7e5b47c3 100644 --- a/usr.bin/make/unit-tests/directive-undef.exp +++ b/usr.bin/make/unit-tests/directive-undef.exp @@ -1,5 +1,6 @@ make: "directive-undef.mk" line 29: The .undef directive requires an argument make: "directive-undef.mk" line 86: Unknown modifier 'Z' +make: "directive-undef.mk" line 103: warning: UT_EXPORTED is still listed in .MAKE.EXPORTED even though spaceit is not exported anymore. make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/directive-undef.mk b/usr.bin/make/unit-tests/directive-undef.mk index b9a69f733517..41ea6b5bf8fa 100644 --- a/usr.bin/make/unit-tests/directive-undef.mk +++ b/usr.bin/make/unit-tests/directive-undef.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-undef.mk,v 1.9 2020/12/22 20:10:21 rillig Exp $ +# $NetBSD: directive-undef.mk,v 1.10 2021/02/16 18:02:19 rillig Exp $ # # Tests for the .undef directive. # @@ -86,5 +86,22 @@ ${DOLLAR}= dollar .undef ${VARNAMES:L:Z} +UT_EXPORTED= exported-value +.export UT_EXPORTED +.if ${:!echo "\${UT_EXPORTED:-not-exported}"!} != "exported-value" +. error +.endif +.if !${.MAKE.EXPORTED:MUT_EXPORTED} +. error +.endif +.undef UT_EXPORTED # XXX: does not update .MAKE.EXPORTED +.if ${:!echo "\${UT_EXPORTED:-not-exported}"!} != "not-exported" +. error +.endif +.if ${.MAKE.EXPORTED:MUT_EXPORTED} +. warning UT_EXPORTED is still listed in .MAKE.EXPORTED even though $\ + it is not exported anymore. +.endif + + all: - @:;