Module Name: src Committed By: rillig Date: Tue Jan 17 19:42:47 UTC 2023
Modified Files: src/usr.bin/make/unit-tests: varname-dot-newline.exp varname-dot-newline.mk Log Message: tests/make: test backslash-newline after macro expansion in command To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varname-dot-newline.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varname-dot-newline.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/varname-dot-newline.exp diff -u src/usr.bin/make/unit-tests/varname-dot-newline.exp:1.2 src/usr.bin/make/unit-tests/varname-dot-newline.exp:1.3 --- src/usr.bin/make/unit-tests/varname-dot-newline.exp:1.2 Wed Aug 19 05:51:18 2020 +++ src/usr.bin/make/unit-tests/varname-dot-newline.exp Tue Jan 17 19:42:47 2023 @@ -1,4 +1,6 @@ -make: "varname-dot-newline.mk" line 16: The .newline variable can be overwritten. Just don't do that. +make: "varname-dot-newline.mk" line 30: The .newline variable can be overwritten. Just don't do that. first second +backslash newline: <\ +> exit status 0 Index: src/usr.bin/make/unit-tests/varname-dot-newline.mk diff -u src/usr.bin/make/unit-tests/varname-dot-newline.mk:1.4 src/usr.bin/make/unit-tests/varname-dot-newline.mk:1.5 --- src/usr.bin/make/unit-tests/varname-dot-newline.mk:1.4 Sat Oct 24 08:46:08 2020 +++ src/usr.bin/make/unit-tests/varname-dot-newline.mk Tue Jan 17 19:42:47 2023 @@ -1,7 +1,21 @@ -# $NetBSD: varname-dot-newline.mk,v 1.4 2020/10/24 08:46:08 rillig Exp $ +# $NetBSD: varname-dot-newline.mk,v 1.5 2023/01/17 19:42:47 rillig Exp $ # -# Tests for the special .newline variable. +# Tests for the special .newline variable, which contains a single newline +# character (U+000A). + + +# https://austingroupbugs.net/view.php?id=1549 proposes: +# > After all macro expansion is complete, when an escaped <newline> is +# > found in a command line in a makefile, the command line that is executed +# > shall contain the <backslash>, the <newline>, and the next line, except +# > that the first character of the next line shall not be included if it is +# > a <tab>. # +# The above quote assumes that each resulting <newline> character has a "next +# line", but that's not how the .newline variable works. +BACKSLASH_NEWLINE:= \${.newline} + + # Contrary to the special variable named "" that is used in expressions like # ${:Usome-value}, the variable ".newline" is not protected against # modification. Nobody exploits that though. @@ -21,3 +35,4 @@ NEWLINE:= ${.newline} all: @echo 'first${.newline}second' + @echo 'backslash newline: <${BACKSLASH_NEWLINE}>'