Module Name: src Committed By: rillig Date: Sat Oct 31 13:45:00 UTC 2020
Modified Files: src/usr.bin/make/unit-tests: var-recursive.exp var-recursive.mk Log Message: make(1): add test for recursion detection with short variable names To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/var-recursive.exp \ src/usr.bin/make/unit-tests/var-recursive.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/var-recursive.exp diff -u src/usr.bin/make/unit-tests/var-recursive.exp:1.1 src/usr.bin/make/unit-tests/var-recursive.exp:1.2 --- src/usr.bin/make/unit-tests/var-recursive.exp:1.1 Sat Oct 31 11:30:57 2020 +++ src/usr.bin/make/unit-tests/var-recursive.exp Sat Oct 31 13:45:00 2020 @@ -6,4 +6,7 @@ Variable INDIRECT1 is recursive. make: stopped in unit-tests make: "var-recursive.mk" line 35: ok +Variable V is recursive. + +make: stopped in unit-tests exit status 0 Index: src/usr.bin/make/unit-tests/var-recursive.mk diff -u src/usr.bin/make/unit-tests/var-recursive.mk:1.1 src/usr.bin/make/unit-tests/var-recursive.mk:1.2 --- src/usr.bin/make/unit-tests/var-recursive.mk:1.1 Sat Oct 31 11:30:57 2020 +++ src/usr.bin/make/unit-tests/var-recursive.mk Sat Oct 31 13:45:00 2020 @@ -1,9 +1,9 @@ -# $NetBSD: var-recursive.mk,v 1.1 2020/10/31 11:30:57 rillig Exp $ +# $NetBSD: var-recursive.mk,v 1.2 2020/10/31 13:45:00 rillig Exp $ # # Tests for variable expressions that refer to themselves and thus # cannot be evaluated. -TESTS= direct indirect conditional +TESTS= direct indirect conditional short # Since make exits immediately when it detects a recursive expression, # the actual tests are run in sub-makes. @@ -34,6 +34,14 @@ INDIRECT2= ${INDIRECT1} CONDITIONAL= ${1:?ok:${CONDITIONAL}} . info ${CONDITIONAL} +.elif ${TEST} == short + +# Short variable names can be expanded using the short-hand $V notation, +# which takes a different code path in Var_Parse for parsing the variable +# name. Ensure that these are checked as well. +V= $V +. info $V + .else . error Unknown test "${TEST}" .endif