Module Name: src Committed By: rillig Date: Fri Dec 3 22:43:51 UTC 2021
Modified Files: src/usr.bin/make/unit-tests: directive-include.exp directive-include.mk Log Message: tests/make: test .include with expressions To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/directive-include.exp cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/directive-include.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/directive-include.exp diff -u src/usr.bin/make/unit-tests/directive-include.exp:1.4 src/usr.bin/make/unit-tests/directive-include.exp:1.5 --- src/usr.bin/make/unit-tests/directive-include.exp:1.4 Tue Nov 3 17:17:31 2020 +++ src/usr.bin/make/unit-tests/directive-include.exp Fri Dec 3 22:43:50 2021 @@ -3,6 +3,7 @@ lhs = "directive-include.mk null", rhs = 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 Index: src/usr.bin/make/unit-tests/directive-include.mk diff -u src/usr.bin/make/unit-tests/directive-include.mk:1.5 src/usr.bin/make/unit-tests/directive-include.mk:1.6 --- src/usr.bin/make/unit-tests/directive-include.mk:1.5 Sat Nov 21 14:59:11 2020 +++ src/usr.bin/make/unit-tests/directive-include.mk Fri Dec 3 22:43:50 2021 @@ -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: - @:;