[SV 64115] Suppress warnings about undefined GNUMAKEFLAGS

* src/variable.c (defined_vars): Add GNUMAKEFLAGS to defined variables.
* tests/scripts/options/warn: Add a test.
This commit is contained in:
Dmitry Goncharov 2023-04-30 09:30:19 -04:00 committed by Paul Smith
parent 0880e5c86a
commit ebe0a1c9f1
2 changed files with 12 additions and 0 deletions

View File

@ -1916,6 +1916,7 @@ static const struct defined_vars defined_vars[] = {
{ STRING_SIZE_TUPLE ("VPATH") },
{ STRING_SIZE_TUPLE ("GPATH") },
{ STRING_SIZE_TUPLE (WARNINGS_NAME) },
{ STRING_SIZE_TUPLE (GNUMAKEFLAGS_NAME) },
{ NULL, 0 }
};

View File

@ -16,6 +16,17 @@ all:; @#HELPER# env MAKEFLAGS
!,
'--warn-undefined-variables', "MF= --warn=undefined-var\nMAKEFLAGS= --warn=undefined-var");
# sv 64115.
# Verify that -R along with --warn-undefined-variables do not warn about
# internal variables, such as GNUMAKEFLAGS.
run_make_test(q!
$(info MF=$(MAKEFLAGS))
all:; @#HELPER# env MAKEFLAGS
!,
'-R --warn-undefined-variables', "MF=rR --warn=undefined-var\nMAKEFLAGS=rR --warn=undefined-var");
# Verify parsing of --warn in various forms.
while (my ($f, $r) = each %warn_test) {