Tue Feb 16 18:12:46 2021 UTC ()
make: clarify what .export ${:U} means


(rillig)
diff -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive-export.mk

cvs diff -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive-export.mk (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/directive-export.mk 2020/12/13 01:07:54 1.6
+++ src/usr.bin/make/unit-tests/directive-export.mk 2021/02/16 18:12:46 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: directive-export.mk,v 1.6 2020/12/13 01:07:54 rillig Exp $ 1# $NetBSD: directive-export.mk,v 1.7 2021/02/16 18:12:46 rillig Exp $
2# 2#
3# Tests for the .export directive. 3# Tests for the .export directive.
4# 4#
5# See also: 5# See also:
6# directive-misspellings.mk 6# directive-misspellings.mk
7 7
8# TODO: Implementation 8# TODO: Implementation
9 9
10INDIRECT= indirect 10INDIRECT= indirect
11VAR= value $$ ${INDIRECT} 11VAR= value $$ ${INDIRECT}
12 12
13# Before 2020-12-13, this unusual expression invoked undefined behavior since 13# Before 2020-12-13, this unusual expression invoked undefined behavior since
14# it accessed out-of-bounds memory via Var_Export -> ExportVar -> MayExport. 14# it accessed out-of-bounds memory via Var_Export -> ExportVar -> MayExport.
@@ -18,18 +18,21 @@ VAR= value $$ ${INDIRECT} @@ -18,18 +18,21 @@ VAR= value $$ ${INDIRECT}
18# During that, its value is expanded, just like almost everywhere else. 18# During that, its value is expanded, just like almost everywhere else.
19.export VAR 19.export VAR
20.if ${:!env | grep '^VAR'!} != "VAR=value \$ indirect" 20.if ${:!env | grep '^VAR'!} != "VAR=value \$ indirect"
21. error 21. error
22.endif 22.endif
23 23
24# Undefining a variable that has been exported implicitly removes it from 24# Undefining a variable that has been exported implicitly removes it from
25# the environment of all child processes. 25# the environment of all child processes.
26.undef VAR 26.undef VAR
27.if ${:!env | grep '^VAR' || true!} != "" 27.if ${:!env | grep '^VAR' || true!} != ""
28. error 28. error
29.endif 29.endif
30 30
31# No argument means to export all variables. 31# No syntactical argument means to export all variables.
32.export 32.export
33 33
 34# An empty argument means no additional variables to export.
 35.export ${:U}
 36
34all: 37all:
35 @:; 38 @:;