]> git.ipfire.org Git - thirdparty/make.git/commit
Add new warnings invalid-var and invalid-ref
authorPaul Smith <psmith@gnu.org>
Sun, 26 Feb 2023 23:24:30 +0000 (18:24 -0500)
committerPaul Smith <psmith@gnu.org>
Sat, 1 Apr 2023 15:13:12 +0000 (11:13 -0400)
commit03ecd94488b85adc38746ec3e7c2a297a522598e
tree26f47e9d5e1dd9ba730c24f86c099005a923bb68
parent2611e1991fabe2a3ae929c6ebd4afbd4f550f306
Add new warnings invalid-var and invalid-ref

The "invalid-var" warning triggers if the makefile attempts to assign
a value to an invalid variable name (a name containing whitespace).
The "invalid-ref" warning triggers if the makefile attempts to
reference an invalid variable name.  Both new warnings have a default
action of "warn".

* NEWS: Add these new warnings.
* doc/make.1: Document them in the man page.
* doc/make.texi (Warnings): Document them in the user's manual.
* src/warning.h: Add enum values for the new warning types.
* src/main.c (initialize_warnings): Initialize the new warnings.
* src/variable.h (undefine_variable_in_set, undefine_variable_global):
Ask callers to provide a struct floc specifying where the variable
is undefined.
* src/read.c (do_undefine): Pass floc when undefining.
* src/variable.c (check_valid_name): If invalid-var is enabled, check
the variable name.
(define_variable_in_set): Call it.
(undefine_variable_in_set): Ditto.
(check_variable_reference): If invalid-ref is enabled, check the
variable reference.
(lookup_variable): Call it.
(lookup_variable_in_set): Ditto.
* tests/scripts/options/warn: Add tests for the new warning types.
NEWS
doc/make.1
doc/make.texi
src/default.c
src/main.c
src/read.c
src/variable.c
src/variable.h
src/warning.h
tests/scripts/options/warn