diff options
author | Paul Smith <psmith@gnu.org> | 2022-12-24 10:30:13 -0500 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2022-12-24 10:52:49 -0500 |
commit | 15dfad96d77c9445d11be939a5042675e4ca8c65 (patch) | |
tree | 34e2b52a28a894db8ecf01e15103aa511ba104e1 /tests | |
parent | 76d2e5d98dbbf655f74f6ef2f6dd3cdd45052ea0 (diff) | |
download | make-git-15dfad96d77c9445d11be939a5042675e4ca8c65.tar.gz |
[SV 63439, SV 63452] Don't warn on undefined internal variables
Don't generate undefined variable warnings for variables that are
internal / special to make and where the empty string is valid.
Rather than defining them to empty, which could introduce unwanted
behavior, keep a list of variable names which we should never warn
about.
* src/variable.h (warn_undefined): Convert the macro to a function.
* src/variable.c (defined_vars): Always "defined" variable names.
(warn_undefined): Implement as a function and check against the
defined_vars before generating a warning.
* src/read.c (read_all_makefiles): No need to reset warning flag.
* src/vpath.c (build_vpath_lists): Ditto.
* tests/scripts/options/warn-undefined-variables: Expand all the
pre-defined variables to ensure warnings are not generated.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scripts/options/warn-undefined-variables | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/scripts/options/warn-undefined-variables b/tests/scripts/options/warn-undefined-variables index ce15507d..9bd40865 100644 --- a/tests/scripts/options/warn-undefined-variables +++ b/tests/scripts/options/warn-undefined-variables @@ -4,6 +4,19 @@ $description = "Test the --warn-undefined-variables option."; $details = "Verify that warnings are printed for referencing undefined variables."; +# Verify that make's special variables don't warn even if they're not set +run_make_test(q! +vars := $(.VARIABLES) $(MAKECMDGOALS) $(MAKE_RESTARTS) $(CURDIR) +vars += $(GNUMAKEFLAGS) $(MAKEFLAGS) $(MFLAGS) $(MAKE_COMMAND) $(MAKE) +vars += $(MAKEFILE_LIST) $(MAKEOVERRIDES) $(-*-command-variables-*-) +vars += $(.RECIPEPREFIX) $(.LOADED) $(.FEATURES) +vars += $(SHELL) $(.SHELLFLAGS) $(MAKE_TERMOUT) $(MAKE_TERMERR) +vars += $(.DEFAULT) $(.DEFAULT_GOAL) $(-*-eval-flags-*-) $(SUFFIXES) +vars += $(VPATH) $(GPATH) +all:; +!, + '--warn-undefined-variables', "#MAKE#: 'all' is up to date."); + # Without --warn-undefined-variables, nothing should happen run_make_test(' EMPTY = |