Module Name: src Committed By: rillig Date: Sun Aug 9 08:03:32 UTC 2020
Modified Files: src/usr.bin/make/unit-tests: modmisc.exp modmisc.mk Log Message: make(1): add test that demonstrates possible delimiters for :S To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/usr.bin/make/unit-tests/modmisc.exp cvs rdiff -u -r1.38 -r1.39 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.40 src/usr.bin/make/unit-tests/modmisc.exp:1.41 --- src/usr.bin/make/unit-tests/modmisc.exp:1.40 Sun Aug 9 07:41:14 2020 +++ src/usr.bin/make/unit-tests/modmisc.exp Sun Aug 9 08:03:31 2020 @@ -25,6 +25,33 @@ mod-subst: :a c: :x__ 3 x__ 3: 12345 +mod-subst-delimiter: +1 two 3 horizontal tabulator +1 two 3 space +1 two 3 exclamation mark +1 two 3 double quotes +1 two 3 hash +1 two 3 dollar +1 two 3 percent +1 two 3 apostrophe +1 two 3 opening parenthesis +1 two 3 closing parenthesis +1 two 3 digit +1 two 3 colon +1 two 3 less than sign +1 two 3 equal sign +1 two 3 greater than sign +1 two 3 question mark +1 two 3 at +1 two 3 letter +1 two 3 opening bracket +1 two 3 backslash +1 two 3 closing bracket +1 two 3 caret +1 two 3 opening brace +1 two 3 vertical line +1 two 3 closing brace +1 two 3 tilde mod-subst-chain: A B c. make: Unknown modifier 'i' Index: src/usr.bin/make/unit-tests/modmisc.mk diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.38 src/usr.bin/make/unit-tests/modmisc.mk:1.39 --- src/usr.bin/make/unit-tests/modmisc.mk:1.38 Sun Aug 9 07:41:14 2020 +++ src/usr.bin/make/unit-tests/modmisc.mk Sun Aug 9 08:03:31 2020 @@ -1,4 +1,4 @@ -# $Id: modmisc.mk,v 1.38 2020/08/09 07:41:14 rillig Exp $ +# $Id: modmisc.mk,v 1.39 2020/08/09 08:03:31 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-delimiter all: mod-subst-chain all: mod-regex all: mod-loop-varname mod-loop-resolve mod-loop-varname-dollar @@ -138,6 +139,40 @@ 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 accept an arbitrary character as the delimiter, +# including characters that are otherwise used as escape characters or +# interpreted in a special way. This can be used to confuse humans. +mod-subst-delimiter: + @echo $@: + @echo ${:U1 2 3:S 2 two :Q} horizontal tabulator + @echo ${:U1 2 3:S 2 two :Q} space + @echo ${:U1 2 3:S!2!two!:Q} exclamation mark + @echo ${:U1 2 3:S"2"two":Q} double quotes + # In shell command lines, the hash does not need to be escaped. + # It needs to be escaped in variable assignment lines though. + @echo ${:U1 2 3:S#2#two#:Q} hash + @echo ${:U1 2 3:S$2$two$:Q} dollar + @echo ${:U1 2 3:S%2%two%:Q} percent + @echo ${:U1 2 3:S'2'two':Q} apostrophe + @echo ${:U1 2 3:S(2(two(:Q} opening parenthesis + @echo ${:U1 2 3:S)2)two):Q} closing parenthesis + @echo ${:U1 2 3:S121two1:Q} digit + @echo ${:U1 2 3:S:2:two::Q} colon + @echo ${:U1 2 3:S<2<two<:Q} less than sign + @echo ${:U1 2 3:S=2=two=:Q} equal sign + @echo ${:U1 2 3:S>2>two>:Q} greater than sign + @echo ${:U1 2 3:S?2?two?:Q} question mark + @echo ${:U1 2 3:S@2@two@:Q} at + @echo ${:U1 2 3:Sa2atwoa:Q} letter + @echo ${:U1 2 3:S[2[two[:Q} opening bracket + @echo ${:U1 2 3:S\2\two\:Q} backslash + @echo ${:U1 2 3:S]2]two]:Q} closing bracket + @echo ${:U1 2 3:S^2^two^:Q} caret + @echo ${:U1 2 3:S{2{two{:Q} opening brace + @echo ${:U1 2 3:S|2|two|:Q} vertical line + @echo ${:U1 2 3:S}2}two}:Q} closing brace + @echo ${:U1 2 3:S~2~two~:Q} tilde + # 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