The NetBSD Project

CVS log for src/usr.bin/make/unit-tests/var-eval-short.exp

[BACK] Up to [cvs.NetBSD.org] / src / usr.bin / make / unit-tests

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.32: download - view: text, markup, annotated - select for diffs
Thu Oct 31 09:12:13 2024 UTC (6 weeks ago) by rillig
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +4 -4 lines
make: in the debug log, always qualify line number with filename

Previously, to find out the filename corresponding to a line number from
a 'Parsing' line, it was necessary to find the preceding
'SetFilenameVars' line, which was unnecessarily time-consuming and
distracting.

The 'filename:line' format matches the one used in PrintStackTrace, and
it differs from the one used in PrintLocation, as the former format is
more common in other tools.

Most of the affected unit tests only use the 'Parsing' lines to give
additional context to their debug log, so no structural changes there.

Revision 1.31: download - view: text, markup, annotated - select for diffs
Thu Aug 29 20:20:36 2024 UTC (3 months, 2 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +2 -1 lines
make: reduce line length in error messages

The error messages for deeply nested parse errors were hard to decipher,
due to the large amount of text.  Split these messages into individual
lines, just as in the backtrace for .include files and .for loops.  This
unified backtrace makes the output more uniform.

Revision 1.30: download - view: text, markup, annotated - select for diffs
Tue Aug 6 18:00:17 2024 UTC (4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +1 -1 lines
make: in error message about conditionals, use single quotes

Single quotes are used less often in the conditionals themselves, which
leads to fewer confusions.

Revision 1.29: download - view: text, markup, annotated - select for diffs
Fri Jul 5 20:01:52 2024 UTC (5 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +1 -1 lines
make: in error messages, distinguish parsing from evaluating

Revision 1.28: download - view: text, markup, annotated - select for diffs
Fri Jul 5 19:47:22 2024 UTC (5 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +1 -1 lines
make: in error messages for anonymous variables, log the value

Revision 1.27: download - view: text, markup, annotated - select for diffs
Thu Jul 4 20:18:40 2024 UTC (5 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +1 -1 lines
make: on error, print the targets to be made

This helps to understand situations with several nested sub-makes in
varying directories.

Revision 1.26: download - view: text, markup, annotated - select for diffs
Sun Jun 2 15:31:26 2024 UTC (6 months, 1 week ago) by rillig
Branches: MAIN
CVS tags: perseant-exfatfs-base-20240630, perseant-exfatfs-base, perseant-exfatfs
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +9 -9 lines
make: sync VarEvalMode constant names with their debug log names

Revision 1.25: download - view: text, markup, annotated - select for diffs
Sat Apr 20 10:18:55 2024 UTC (7 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +1 -1 lines
make: provide more context information for parse/evaluate errors

Revision 1.24: download - view: text, markup, annotated - select for diffs
Sun Apr 14 12:30:47 2024 UTC (7 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +2 -0 lines
make: add debug logging for .if and .for lines in -dp mode

This helps track down in which line a condition is evaluated.

Revision 1.23: download - view: text, markup, annotated - select for diffs
Thu Jun 1 20:56:35 2023 UTC (18 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +4 -4 lines
tests/make: force line-based diagnostics to be listed in the tests

This way, contradictions between the intended output and the actual
output are closer together and have a better chance of being spotted.

Revision 1.22: download - view: text, markup, annotated - select for diffs
Tue May 9 16:27:00 2023 UTC (19 months ago) by rillig
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +2 -6 lines
make: allow ':gmtime' and ':localtime' with dynamic argument

This allows ${%Y:L:gmtime=${mtime}} instead of the indirect
${%Y:L:${:Ugmtime=${mtime}}}.

The direct form also prevents any ':' from the nested expression to be
interpreted as a separator, which doesn't matter for the ':gmtime' and
':localtime' modifiers but will prove useful for other modifiers that
follow the same pattern.

Revision 1.21: download - view: text, markup, annotated - select for diffs
Sat Feb 18 11:16:09 2023 UTC (21 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +4 -0 lines
make: fix parsing of unevaluated subexpressions with unbalanced '{}'

Since var.c 1.323 from 2020-07-26, modifiers containing unbalanced
braces or parentheses were parsed differently, depending on whether they
were relevant or not.

For example, the expression '${VAR:...}' is enclosed with braces. When
this expression has a modifier ':S,},}},g' that would double each '}' in
that expression, the parser got confused:

If the expression was relevant, the modifier was parsed as usual, taking
into account that the 3 '}' in the modifier are ordinary characters.

If the expression was irrelevant, the parser only counted the '{' and
the '}', without taking into account that a '}' might be escaped by a
'\' or be an ordinary character.  Parsing therefore stopped at the first
'}', assuming it would finish the expression '${VAR:S,}'.

This parsing mode of only counting balanced '{' and '}' makes sense for
the modifier ':@var@...@', which expands each word of the expression
using the template from the '...'.  These templates tend to be simple
enough that counting the '{' and '}' suffices.

Revision 1.20: download - view: text, markup, annotated - select for diffs
Tue Aug 23 19:22:01 2022 UTC (2 years, 3 months ago) by rillig
Branches: MAIN
CVS tags: netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +0 -4 lines
make: revert parsing of modifier parts (since 2022-08-08)

The modifier ':@var@body@' parses the body in parse-only mode and later
uses Var_Subst on it, in which each literal '$' must be written as '$$'.

Trying to parse the loop body using Var_Parse treated the text
'$${var:-0}' as a single '$' followed by the expression '${var:-0}',
wrongly complaining about the 'Unknown modifier "-0"'.

Found by sjg.

Revision 1.19: download - view: text, markup, annotated - select for diffs
Mon Aug 8 18:23:30 2022 UTC (2 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +4 -0 lines
make: fix parsing of modifiers containing unbalanced subexpressions

Revision 1.18: download - view: text, markup, annotated - select for diffs
Tue Dec 28 15:49:00 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +2 -2 lines
make: make debug logging a bit more human-friendly

The previous log format "ParseReadLine (%d): '%s'" focused on the
implementation, it was not immediately obvious to a casual reader that
the number in parentheses was the line number.  Additionally, having
both a colon and quotes in a log message is uncommon.  The quotes have
been added in parse.c 1.127 from 2007-01-01.

The new log format "Parsing line %d: %s" is meant to be easier readable
by humans.  The quotes are not needed since ParseReadLine always strips
trailing whitespace, leaving no room for ambiguities.  The other log
messages follow common punctuation rules, which makes the beginning of
the line equally unambiguous.  Before var.c 1.911 from 2021-04-05,
variable assignments were logged with the format "%s:%s = %s", without a
space after the colon.

Revision 1.17: download - view: text, markup, annotated - select for diffs
Mon Dec 27 18:54:19 2021 UTC (2 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +8 -8 lines
make: clean up comments

Revision 1.16: download - view: text, markup, annotated - select for diffs
Thu Dec 9 20:27:01 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +2 -2 lines
make: in parse errors, mark whitespace more clearly

This prevents any trailing whitespace from going unnoticed.  It also
marks leading whitespace more clearly, as in the examples with the time
value " 1".

Revision 1.15: download - view: text, markup, annotated - select for diffs
Thu Dec 9 20:13:10 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +1 -1 lines
make: remove period from end of error messages and warnings

The majority of the existing error messages and warnings does not
include a period at the end.  Follow this style consistently.

Revision 1.14: download - view: text, markup, annotated - select for diffs
Tue Sep 7 20:41:58 2021 UTC (3 years, 3 months ago) by rillig
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +6 -6 lines
tests/make: expand on the history of unnecessary evaluation

Revision 1.13: download - view: text, markup, annotated - select for diffs
Mon Apr 5 13:35:41 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
CVS tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +3 -3 lines
make: in debug log, add space between scope and variable name

Without this space, the debug log looked more like line noise, even
though the only punctuation was a single innocent ':'.  From a make
user's perspective, the variable name is a word of its own and should
not be visually glued to its namespace.

Revision 1.12: download - view: text, markup, annotated - select for diffs
Mon Apr 5 13:14:55 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +3 -3 lines
make: be more verbose in -dv debug logging

The previous log output was too brief to be understandable.  Give more
hints by describing each part of the expression when evaluating a
modifier.  Distinguish between parse-only mode and eval mode since in
parse-only mode most of the details are irrelevant.

Revision 1.11: download - view: text, markup, annotated - select for diffs
Sun Apr 4 13:35:26 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +8 -6 lines
make: disallow '$' in the variable name of the modifier ':@'

If this restriction should break any existing makefile, the author of
that makefile was probably heading for the IOMCC.

Revision 1.10: download - view: text, markup, annotated - select for diffs
Sun Apr 4 10:13:09 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +1 -1 lines
make: remove filler word 'Do' from function names for parsing

No functional change, except for debug logging.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Sat Apr 3 22:02:59 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +6 -6 lines
make: remove VarFlags from debug logging

Before the introduction of ExprDefined, VarFlags contained whether the
expression was defined or not, which was useful to know since the final
value of the expression depends on this information.  The other VarFlags
do not influence the evaluation, so there is no point logging them.

Revision 1.8: download - view: text, markup, annotated - select for diffs
Mon Mar 15 15:39:13 2021 UTC (3 years, 8 months ago) by rillig
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +8 -8 lines
make: change debug log for variable evaluation flags to lowercase

This makes them easier distinguishable from variable names since the
latter are usually uppercase.

No functional change outside debug mode.

Revision 1.7: download - view: text, markup, annotated - select for diffs
Sun Mar 14 20:41:39 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +5 -5 lines
tests/make: document today's bug fixes in the test

Revision 1.6: download - view: text, markup, annotated - select for diffs
Sun Mar 14 19:29:37 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +0 -2 lines
make: do not evaluate modifier ':[...]' in parse-only mode

In parse-only mode, variable expressions in the argument to that
modifier are not resolved.  This led to the error message about the 'Bad
modifier' in var-eval-short.mk.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Sun Mar 14 19:21:28 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +4 -4 lines
make: do not return unevaluated 'else' part from the ':?' modifier

No functional change outside debug mode.

Revision 1.4: download - view: text, markup, annotated - select for diffs
Sun Mar 14 19:16:41 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +20 -0 lines
tests/make: add test for the ':?' modifier in parse-only mode

The debug output for this scenario will change a bit in an upcoming
commit, but that will not affect anything outside the debug log.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Sun Mar 14 18:02:44 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +0 -1 lines
make: only evaluate the ':@' modifier if the result is actually used

The test 'var-eval-short' had produced the output 'unexpected' before,
on stderr.  It had been generated by '${:Uword:@${FAIL}@expr@}' by
combining the following obscure "features" of make:

1.  the ':@' modifier loops over the words of the variable.  This
    modifier is not really obscure, it still takes some time to get used
    to it.

2.  the ':@' modifier allows a '$' sign in the variable name, which is
    useless in practice.

3.  the ':@' modifier creates a temporary loop variable in the global
    namespace.  Luckily there are only few collisions with other
    variable names since their naming conventions differ.

4.  after looping over the words of the expression, the temporary global
    loop variable is deleted, and at that point the '$' is expanded,
    being interpreted as the start of a variable expression.

5.  The ':@' modifier deleted the global variable even when it was
    called in parse-only mode (without VARE_WANTRES).

When the modifier ':@' was initially added to make in var.c 1.40 from
2000-04-29, Var_Delete didn't expand the variable name.  That feature
was added in var.c 1.174 from 2013-05-18, probably without thinking of
this very edge-casey combination of features.

This commit fixes item 5 from the above list.  The other obscurities
remain for now.

Revision 1.2: download - view: text, markup, annotated - select for diffs
Sun Mar 14 16:43:30 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +0 -1 lines
make: only evaluate the ':_' modifier if the expression is needed

See var-eval-short.mk:46 for the test demonstrating this change.
Previously, the expression ${:Uword:_=VAR} was evaluated including all
its side effects even though it was in an irrelevant branch of the
condition.

Revision 1.1: download - view: text, markup, annotated - select for diffs
Sun Mar 14 11:49:37 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
tests/make: add test for short-circuit evaluation of modifiers

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options

CVSweb <webmaster@jp.NetBSD.org>