summaryrefslogtreecommitdiff
path: root/usr.bin/make
diff options
context:
space:
mode:
authorapb <apb@NetBSD.org>2014-08-24 16:08:14 +0000
committerapb <apb@NetBSD.org>2014-08-24 16:08:14 +0000
commit6a80d426d7329d733ee2ad613c753f550e3172f5 (patch)
treea328cd36ac58729d76f345b270251730fec0bdbc /usr.bin/make
parent26bd1176c88985ac311e03bee72a0d2ebcda21a6 (diff)
Our practice is that an even number of backslashes before a newline
in a variable assignment simply stores the backslashes as part of the value, and treats the newline as though it was not escaped. This is compatible with GNU make.
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/unit-tests/escape.exp14
-rw-r--r--usr.bin/make/unit-tests/escape.mk13
2 files changed, 15 insertions, 12 deletions
diff --git a/usr.bin/make/unit-tests/escape.exp b/usr.bin/make/unit-tests/escape.exp
index 811e7abaed8..02de918fb36 100644
--- a/usr.bin/make/unit-tests/escape.exp
+++ b/usr.bin/make/unit-tests/escape.exp
@@ -23,13 +23,13 @@ VAR1BSNLdA=:111 ${A}:
VAR1BSNLc=:111:
VAR1BSNLsc=:111:
var-2bsnl
-VAR2BSNL=:222\ 222=:
-VAR2BSNLa=:222\ aaa=:
-VAR2BSNLA=:222\ aaa=:
-VAR2BSNLda=:222\ ${a}=:
-VAR2BSNLdA=:222\ ${A}=:
-VAR2BSNLc=:222\:
-VAR2BSNLsc=:222\:
+VAR2BSNL=:222\\:
+VAR2BSNLa=:222\\:
+VAR2BSNLA=:222\\:
+VAR2BSNLda=:222\\:
+VAR2BSNLdA=:222\\:
+VAR2BSNLc=:222\\:
+VAR2BSNLsc=:222\\:
var-3bsnl
VAR3BSNL=:333\\ 333=:
VAR3BSNLa=:333\\ aaa=:
diff --git a/usr.bin/make/unit-tests/escape.mk b/usr.bin/make/unit-tests/escape.mk
index 462c27d0dc6..aaa7ff8ff09 100644
--- a/usr.bin/make/unit-tests/escape.mk
+++ b/usr.bin/make/unit-tests/escape.mk
@@ -1,4 +1,4 @@
-# $Id: escape.mk,v 1.6 2014/08/24 15:10:13 apb Exp $
+# $Id: escape.mk,v 1.7 2014/08/24 16:08:14 apb Exp $
#
# Test backslash escaping.
@@ -31,6 +31,11 @@
# Our practice, despite what POSIX might say, is that "\#"
# in a variable assignment stores "#" as part of the value.
# The "\" is not taken literally, and the "#" does not begin a comment.
+#
+# Also, our practice is that an even number of backslashes before a newline
+# in a variable assignment simply stores the backslashes as part of the
+# value, and treats the newline as though it was not escaped. This
+# is compatible with GNU make.
all: .PHONY
# We will add dependencies like "all: yet-another-test" later.
@@ -100,8 +105,7 @@ var-1bsnl: .PHONY __printvars \
VAR1BSNLc VAR1BSNLsc
# Double-backslash-newline in a variable setting.
-# First one should be taken literally, and last should escape the newline.
-# XXX: Is the expected behaviour well defined?
+# Both backslashes should be taken literally, and the newline is NOT escaped.
#
# The second lines below each end with '=' so that they will not
# generate syntax errors regardless of whether or not they are
@@ -125,11 +129,10 @@ VAR2BSNLsc = 222\\
all: var-2bsnl
var-2bsnl: .PHONY __printvars \
VAR2BSNL VAR2BSNLa VAR2BSNLA VAR2BSNLda VAR2BSNLdA \
- VAR2BSNLc VARR2BSNLsc
+ VAR2BSNLc VAR2BSNLsc
# Triple-backslash-newline in a variable setting.
# First two should be taken literally, and last should escape the newline.
-# XXX: Is the expected behaviour well defined?
#
# The second lines below each end with '=' so that they will not
# generate syntax errors regardless of whether or not they are