Module Name: src Committed By: rillig Date: Sat Mar 29 20:19:58 UTC 2025
Modified Files: src/usr.bin/make/unit-tests: varmod.exp varmod.mk Log Message: tests/make: fix the documented modifier table The SysV column was largely incorrect or too unspecific, stating N/A when "no" was actually correct. The modifiers differ in whether they fall back to the ":from=to" modifier. The suggestion in https://bugs.freebsd.org/285726 to make more of the modifiers fall back to the ":from=to" modifier thus becomes nonobvious to decide. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/varmod.exp cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/varmod.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/varmod.exp diff -u src/usr.bin/make/unit-tests/varmod.exp:1.19 src/usr.bin/make/unit-tests/varmod.exp:1.20 --- src/usr.bin/make/unit-tests/varmod.exp:1.19 Sat Mar 29 11:24:34 2025 +++ src/usr.bin/make/unit-tests/varmod.exp Sat Mar 29 20:19:58 2025 @@ -1,45 +1,47 @@ -make: "varmod.mk" line 101: To escape a dollar, use \$, not $$, at "$$:L} != """ -make: "varmod.mk" line 101: Invalid variable name ':', at "$:L} != """ -make: "varmod.mk" line 107: Dollar followed by nothing +make: "varmod.mk" line 111: To escape a dollar, use \$, not $$, at "$$:L} != """ +make: "varmod.mk" line 111: Invalid variable name ':', at "$:L} != """ +make: "varmod.mk" line 117: Dollar followed by nothing while evaluating "${:Uword:@word@${word}$@} != "word"" with value "word" -make: "varmod.mk" line 117: Missing delimiter ':' after modifier "P" +make: "varmod.mk" line 127: Missing delimiter ':' after modifier "P" while evaluating variable "VAR" with value "VAR" -make: "varmod.mk" line 119: Missing argument for ".error" -make: "varmod.mk" line 125: Bad modifier ":[99333000222000111000]" +make: "varmod.mk" line 129: Missing argument for ".error" +make: "varmod.mk" line 135: Bad modifier ":[99333000222000111000]" while evaluating variable "word" with value "word" -make: "varmod.mk" line 128: Bad modifier ":[2147483648]" +make: "varmod.mk" line 138: Bad modifier ":[2147483648]" while evaluating variable "word" with value "word" -make: "varmod.mk" line 134: Invalid number "99333000222000111000}" for ':range' modifier +make: "varmod.mk" line 144: Invalid number "99333000222000111000}" for ':range' modifier while evaluating variable "word" with value "word" -make: "varmod.mk" line 141: Invalid time value "\" +make: "varmod.mk" line 151: Invalid time value "\" while evaluating indirect modifiers "gmtime=\" while evaluating "${:${:Ugmtime=\\}}" with value "" -make: "varmod.mk" line 156: Dollar followed by nothing +make: "varmod.mk" line 166: Dollar followed by nothing while evaluating variable "VAR" with value "value$" -make: "varmod.mk" line 162: Dollar followed by nothing +make: "varmod.mk" line 172: Dollar followed by nothing while evaluating variable "VAR" with value "value$" -make: "varmod.mk" line 162: Dollar followed by nothing - while evaluating variable "VAR" with value "value$ appended$" make: "varmod.mk" line 172: Dollar followed by nothing + while evaluating variable "VAR" with value "value$ appended$" +make: "varmod.mk" line 182: Dollar followed by nothing while evaluating variable "word" with value "word" -make: "varmod.mk" line 176: Bad modifier ":[$]" +make: "varmod.mk" line 186: Bad modifier ":[$]" while evaluating variable "word" with value "" -make: "varmod.mk" line 193: Dollar followed by nothing +make: "varmod.mk" line 203: Dollar followed by nothing while evaluating variable "VAR" with value "value$ appended$" -make: "varmod.mk" line 193: Invalid variable name '}', at "$} != "set"" +make: "varmod.mk" line 203: Invalid variable name '}', at "$} != "set"" while evaluating variable "VAR" with value "value<space>appended" -make: "varmod.mk" line 197: Invalid variable name '}', at "$} != "fallback"" +make: "varmod.mk" line 207: Invalid variable name '}', at "$} != "fallback"" while evaluating "${:Ufallback$} != "fallback"" with value "" -make: "varmod.mk" line 201: Invalid time value "1000$" +make: "varmod.mk" line 211: Invalid time value "1000$" while evaluating variable "%y" with value "%y" -make: "varmod.mk" line 207: Invalid time value "1000$" +make: "varmod.mk" line 217: Invalid time value "1000$" while evaluating variable "%y" with value "%y" -make: "varmod.mk" line 213: Dollar followed by nothing +make: "varmod.mk" line 223: Dollar followed by nothing while evaluating variable "word" with value "word" -make: "varmod.mk" line 217: Dollar followed by nothing +make: "varmod.mk" line 227: Dollar followed by nothing while evaluating variable "word" with value "word" -make: "varmod.mk" line 221: Invalid argument 'fallback$' for modifier ':mtime' +make: "varmod.mk" line 231: Invalid argument 'fallback$' for modifier ':mtime' while evaluating variable "." with value "." +make: "varmod.mk" line 245: Missing delimiter ':' after modifier "L" + while evaluating variable "VAR" with value "VAR" make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/varmod.mk diff -u src/usr.bin/make/unit-tests/varmod.mk:1.22 src/usr.bin/make/unit-tests/varmod.mk:1.23 --- src/usr.bin/make/unit-tests/varmod.mk:1.22 Sat Jan 11 20:54:46 2025 +++ src/usr.bin/make/unit-tests/varmod.mk Sat Mar 29 20:19:58 2025 @@ -1,4 +1,4 @@ -# $NetBSD: varmod.mk,v 1.22 2025/01/11 20:54:46 rillig Exp $ +# $NetBSD: varmod.mk,v 1.23 2025/03/29 20:19:58 rillig Exp $ # # Tests for variable modifiers, such as :Q, :S,from,to or :Ufallback. # @@ -21,40 +21,50 @@ # * `individual`: parsing this modifier does not follow the common # pattern of calling `ParseModifierPart`. # -# The SysV column says whether a parse error in the modifier falls back -# trying the `:from=to` System V modifier. +# The SysV column says whether a modifier falls back trying the `:from=to` +# System V modifier. Remarks: # -# | **Operator** | **Behavior** | **Remarks** | **SysV** | +# In the assignment modifiers `::=` and its variants, the `=` is part of +# the modifier name, so they never fall back to the `:from=to` modifier. +# +# All no-colon modifiers get a "no", as the modifier name would be +# trimmed off before the `:from=to` modifier could see them, for +# example, ${VAR:LAR=ALUE} and ${VAR:L:AR=ALUE} behave the same. +# +# | **Modifier** | **Behavior** | **Remarks** | **SysV** | # |--------------|--------------|--------------------|----------| -# | `!` | no-colon | | no | -# | `:=` | greedy | | yes | -# | `?:` | greedy | | no | -# | `@` | no-colon | | no | -# | `C` | no-colon | | no | -# | `D` | individual | custom parser | N/A | -# | `E` | strict | | yes | -# | `H` | strict | | yes | -# | `L` | no-colon | | N/A | -# | `M` | individual | custom parser | N/A | -# | `N` | individual | custom parser | N/A | -# | `O` | strict | only literal value | no | -# | `P` | no-colon | | N/A | -# | `Q` | strict | | yes | -# | `R` | strict | | yes | -# | `S` | no-colon | | N/A | -# | `T` | strict | | N/A | -# | `U` | individual | custom parser | N/A | -# | `[` | strict | | no | -# | `_` | individual | strcspn | yes | -# | `gmtime` | strict | | yes | -# | `hash` | strict | | N/A | -# | `localtime` | strict | | yes | -# | `q` | strict | | yes | -# | `range` | strict | | N/A | -# | `sh` | strict | | N/A | -# | `t` | strict | | no | -# | `u` | strict | | yes | -# | `from=to` | greedy | SysV, fallback | N/A | +# | ! | no-colon | | no | +# | := | greedy | | no | +# | :?= | greedy | | no | +# | :+= | greedy | | no | +# | :!= | greedy | | no | +# | ?: | greedy | | no | +# | @ | no-colon | | no | +# | C | no-colon | | no | +# | D | individual | custom parser | no | +# | E | strict | | yes | +# | H | strict | | yes | +# | L | no-colon | | no | +# | M | individual | custom parser | no | +# | N | individual | custom parser | no | +# | O | strict | only literal value | no | +# | P | no-colon | | no | +# | Q | strict | | yes | +# | R | strict | | yes | +# | S | no-colon | | no | +# | T | strict | | yes | +# | U | individual | custom parser | no | +# | [ | strict | | no | +# | _ | individual | strcspn | no | +# | gmtime | strict | | no | +# | hash | strict | | yes | +# | localtime | strict | | no | +# | q | strict | | yes | +# | range | strict | | no | +# | sh | strict | | yes | +# | t | strict | | no | +# | u | strict | | yes | +# | from=to | greedy | SysV, fallback | --- | # These tests assume .MAKE.SAVE_DOLLARS = yes @@ -229,3 +239,12 @@ VAR_DOLLAR= VAR$$ .if ${word:L:S,d,m$,} != "worm\$" . error .endif + +.undef VAR +# expect+1: Missing delimiter ':' after modifier "L" +.if ${VAR:LAR=ALUE} != "VALUE" +. error +.endif +.if ${VAR:L:AR=ALUE} != "VALUE" +. error +.endif