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 .include with expre...
details: https://anonhg.NetBSD.org/src/rev/9da91590281e
branches: trunk
changeset: 1026641:9da91590281e
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Dec 03 22:43:50 2021 +0000
description:
tests/make: test .include with expressions
diffstat:
usr.bin/make/unit-tests/directive-include.exp | 1 +
usr.bin/make/unit-tests/directive-include.mk | 19 +++++++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diffs (42 lines):
diff -r 4dd27dd3a8c5 -r 9da91590281e usr.bin/make/unit-tests/directive-include.exp
--- a/usr.bin/make/unit-tests/directive-include.exp Fri Dec 03 22:41:18 2021 +0000
+++ b/usr.bin/make/unit-tests/directive-include.exp Fri Dec 03 22:43:50 2021 +0000
@@ -3,6 +3,7 @@
CondParser_Eval: ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null"
lhs = "directive-include.mk null", rhs = "directive-include.mk null", op = !=
make: "directive-include.mk" line 25: Could not find nonexistent.mk
+make: "directive-include.mk" line 47: Could not find "
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff -r 4dd27dd3a8c5 -r 9da91590281e usr.bin/make/unit-tests/directive-include.mk
--- a/usr.bin/make/unit-tests/directive-include.mk Fri Dec 03 22:41:18 2021 +0000
+++ b/usr.bin/make/unit-tests/directive-include.mk Fri Dec 03 22:43:50 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-include.mk,v 1.5 2020/11/21 14:59:11 rillig Exp $
+# $NetBSD: directive-include.mk,v 1.6 2021/12/03 22:43:50 rillig Exp $
#
# Tests for the .include directive, which includes another file.
@@ -30,5 +30,20 @@
# As of 2020-11-21, anything after the delimiter '"' is ignored.
.include "/dev/null" and ignore anything in the rest of the line.
+# The filename to be included can contain expressions.
+DEV= null
+.include "/dev/${DEV}"
+
+# Expressions in double quotes or angle quotes are first parsed naively, to
+# find the closing '"'. In a second step, the expressions are expanded. This
+# means that the expressions cannot include the characters '"' or '>'. This
+# restriction is not practically relevant since the expressions inside
+# '.include' directives are typically kept as simple as possible.
+#
+# If the whole line were expanded before parsing, the filename to be included
+# would be empty, and the closing '"' would be in the trailing part of the
+# line, which is ignored as of 2021-12-03.
+DQUOT= "
+.include "${DQUOT}"
+
all:
- @:;
Home |
Main Index |
Thread Index |
Old Index