summaryrefslogtreecommitdiff
path: root/src/vpath.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2022-12-24 10:30:13 -0500
committerPaul Smith <psmith@gnu.org>2022-12-24 10:52:49 -0500
commit15dfad96d77c9445d11be939a5042675e4ca8c65 (patch)
tree34e2b52a28a894db8ecf01e15103aa511ba104e1 /src/vpath.c
parent76d2e5d98dbbf655f74f6ef2f6dd3cdd45052ea0 (diff)
downloadmake-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/vpath.c')
-rw-r--r--src/vpath.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/src/vpath.c b/src/vpath.c
index 9c95441f..9af4213c 100644
--- a/src/vpath.c
+++ b/src/vpath.c
@@ -68,19 +68,10 @@ build_vpath_lists (void)
vpaths = new;
- /* If there is a VPATH variable with a nonnull value, construct the
- general VPATH list from it. We use variable_expand rather than just
- calling lookup_variable so that it will be recursively expanded. */
+ /* If there is a VPATH variable with a nonnull expanded value, construct the
+ general VPATH list from it. */
- {
- /* Turn off --warn-undefined-variables while we expand SHELL and IFS. */
- int save = warn_undefined_variables_flag;
- warn_undefined_variables_flag = 0;
-
- p = variable_expand ("$(strip $(VPATH))");
-
- warn_undefined_variables_flag = save;
- }
+ p = variable_expand ("$(strip $(VPATH))");
if (*p != '\0')
{
@@ -101,19 +92,10 @@ build_vpath_lists (void)
vpaths = save_vpaths;
}
- /* If there is a GPATH variable with a nonnull value, construct the
- GPATH list from it. We use variable_expand rather than just
- calling lookup_variable so that it will be recursively expanded. */
+ /* If there is a GPATH variable with a nonnull expanded value, construct the
+ GPATH list from it. */
- {
- /* Turn off --warn-undefined-variables while we expand SHELL and IFS. */
- int save = warn_undefined_variables_flag;
- warn_undefined_variables_flag = 0;
-
- p = variable_expand ("$(strip $(GPATH))");
-
- warn_undefined_variables_flag = save;
- }
+ p = variable_expand ("$(strip $(GPATH))");
if (*p != '\0')
{