make/tests/scripts
Dmitry Goncharov 07187db947 [SV 64822, SV 36486] Fix appending to a pattern specific variable
Appending to a pattern specific variable produces an incorrect value
in the presence of a command line definition or an env override of
the variable.  Also, fix pattern/target-specific appending to a
variable with origin override.

* At parse time record_target_var sets the value of a pattern
  specific variable to the value defined on command line or to the
  value of the env override.
* Later, at build time, recursively_expand_for_file appends this
  value of the variable (set in record_target_var) to the command
  line value again, regardless of the origin of the variable.

This patch modifies recursively_expand_for_file to avoid appending,
unless the origin of the variable beats or equals the origin of one
of the parent definitions of this variable.

Reported by Rob <robw9739@gmail.com>,
Brian Vandenberg <phantall@gmail.com>,
Markus Oberhumer <markus@oberhumer.com>.

* NEWS: Note the change.
* src/variable.c (do_variable_definition): Avoid merging a
pattern-specific variable with the parent definition when a command
line or env override is present.
* src/expand.c (recursively_expand_for_file): Avoid appending to a
pattern-specific variable, unless the origin of this pattern-specific
variable beats or equals the origin of one of the parent definitions
of this variable.
* doc/make.texi (Override Directive): Add missing cross-reference.
* tests/scripts/variables/append: Add tests.
2024-02-04 18:26:21 -05:00
..
features [SV 65211] Fix load and loadapi tests. 2024-01-27 16:40:36 -05:00
functions [SV 64803] Set origin for unmodified variables after -e 2024-02-04 11:34:49 -05:00
misc tests: Run each file in a separate directory 2023-04-02 17:32:09 -04:00
options [SV 64803] Set origin for unmodified variables after -e 2024-02-04 11:34:49 -05:00
targets * tests/scripts/targets/WAIT: Add whitespace to avoid W32 issues 2023-04-02 17:30:27 -04:00
variables [SV 64822, SV 36486] Fix appending to a pattern specific variable 2024-02-04 18:26:21 -05:00
vms Convert references from "GNU make" to "GNU Make" 2023-01-01 17:05:12 -05:00
test_template Update the test template. A few fixes in run_make_test(). 2004-09-22 04:36:17 +00:00