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 /src/variable.h | |
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 'src/variable.h')
-rw-r--r-- | src/variable.h | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/variable.h b/src/variable.h index d377a47f..d0cb775d 100644 --- a/src/variable.h +++ b/src/variable.h @@ -191,6 +191,7 @@ struct variable *define_variable_in_set (const char *name, size_t length, int recursive, struct variable_set *set, const floc *flocp); +void warn_undefined (const char* name, size_t length); /* Define a variable in the current variable set. */ @@ -229,15 +230,6 @@ void undefine_variable_in_set (const char *name, size_t length, #define undefine_variable_global(n,l,o) \ undefine_variable_in_set((n),(l),(o),NULL) -/* Warn that NAME is an undefined variable. */ - -#define warn_undefined(n,l) do{\ - if (warn_undefined_variables_flag) \ - error (reading_file, (l), \ - _("warning: undefined variable '%.*s'"), \ - (int)(l), (n)); \ - }while(0) - char **target_environment (struct file *file, int recursive); struct pattern_var *create_pattern_var (const char *target, |