Module Name: src Committed By: rillig Date: Fri Jul 31 14:36:58 UTC 2020
Modified Files: src/usr.bin/make/unit-tests: modmisc.exp modmisc.mk Log Message: make(1): add test for chaining the :S modifier without colon To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/usr.bin/make/unit-tests/modmisc.exp cvs rdiff -u -r1.29 -r1.30 src/usr.bin/make/unit-tests/modmisc.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/modmisc.exp diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.32 src/usr.bin/make/unit-tests/modmisc.exp:1.33 --- src/usr.bin/make/unit-tests/modmisc.exp:1.32 Wed Jul 29 21:35:35 2020 +++ src/usr.bin/make/unit-tests/modmisc.exp Fri Jul 31 14:36:58 2020 @@ -24,6 +24,8 @@ mod-subst: :a c: :x__ 3 x__ 3: 12345 +mod-subst-chain: +A B c. mod-regex: :a b b c: :a b b c: Index: src/usr.bin/make/unit-tests/modmisc.mk diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.29 src/usr.bin/make/unit-tests/modmisc.mk:1.30 --- src/usr.bin/make/unit-tests/modmisc.mk:1.29 Wed Jul 29 21:35:35 2020 +++ src/usr.bin/make/unit-tests/modmisc.mk Fri Jul 31 14:36:58 2020 @@ -1,4 +1,4 @@ -# $Id: modmisc.mk,v 1.29 2020/07/29 21:35:35 rillig Exp $ +# $Id: modmisc.mk,v 1.30 2020/07/31 14:36:58 rillig Exp $ # # miscellaneous modifier tests @@ -17,6 +17,7 @@ MOD_SEP=S,:, ,g all: modvar modvarloop modsysv mod-HTE emptyvar undefvar all: mod-subst +all: mod-subst-chain all: mod-regex all: mod-loop-varname mod-loop-resolve mod-loop-varname-dollar all: mod-subst-dollar mod-loop-dollar @@ -136,6 +137,18 @@ mod-subst: @echo :${:U1 2 3 1 2 3:S,1 2,___,Wg:S,_,x,:Q}: @echo ${:U12345:S,,sep,g:Q} +# The :S and :C modifiers can be chained without a separating ':'. +# This is not documented in the manual page. +# It works because ApplyModifier_Subst scans for the known modifiers g1W +# and then just returns to ApplyModifiers. There, the colon is optionally +# skipped (see the *st.next == ':' at the end of the loop). +# +# Most other modifiers cannot be chained since their parsers skip until +# the next ':' or '}' or ')'. +mod-subst-chain: + @echo $@: + @echo ${:Ua b c:S,a,A,S,b,B,}. + mod-regex: @echo $@: @echo :${:Ua b b c:C,a b,,:Q}: