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 tests/make: test backslash-newline a...
details: https://anonhg.NetBSD.org/src/rev/736657b4de3f
branches: trunk
changeset: 373090:736657b4de3f
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Jan 17 19:42:47 2023 +0000
description:
tests/make: test backslash-newline after macro expansion in command
diffstat:
usr.bin/make/unit-tests/varname-dot-newline.exp | 4 +++-
usr.bin/make/unit-tests/varname-dot-newline.mk | 19 +++++++++++++++++--
2 files changed, 20 insertions(+), 3 deletions(-)
diffs (43 lines):
diff -r d4217f517bb4 -r 736657b4de3f usr.bin/make/unit-tests/varname-dot-newline.exp
--- a/usr.bin/make/unit-tests/varname-dot-newline.exp Tue Jan 17 14:27:11 2023 +0000
+++ b/usr.bin/make/unit-tests/varname-dot-newline.exp Tue Jan 17 19:42:47 2023 +0000
@@ -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
diff -r d4217f517bb4 -r 736657b4de3f usr.bin/make/unit-tests/varname-dot-newline.mk
--- a/usr.bin/make/unit-tests/varname-dot-newline.mk Tue Jan 17 14:27:11 2023 +0000
+++ b/usr.bin/make/unit-tests/varname-dot-newline.mk Tue Jan 17 19:42:47 2023 +0000
@@ -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 @@
all:
@echo 'first${.newline}second'
+ @echo 'backslash newline: <${BACKSLASH_NEWLINE}>'
Home |
Main Index |
Thread Index |
Old Index