summaryrefslogtreecommitdiff
path: root/doc/make.1
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2023-02-26 18:04:14 -0500
committerPaul Smith <psmith@gnu.org>2023-04-01 11:13:12 -0400
commit2611e1991fabe2a3ae929c6ebd4afbd4f550f306 (patch)
tree0733d2ff7f545c8ba0b4c032a309cde459dfdfce /doc/make.1
parent9db74434cd34b2b875b3f9bfbab4f1e0b682e27c (diff)
downloadmake-git-2611e1991fabe2a3ae929c6ebd4afbd4f550f306.tar.gz
Introduce a --warn command line option
Replace the singleton --warn-undefined-variables with infrastructure to manage multiple warnings: the --warn option can take an action "ignore", "warn", or "error" (which will apply to all warnings), or a specific warning type and an action for that type. Multiple options can be provided and are consolidated. * NEWS: Announce the new option. * doc/make.1: Document in the man page. * doc/make.texi (Warnings): Document in the user's manual. * Makefile.am: Add new header warning.h. * src/warning.h: Define enum for actions and warning types, and macros to test whether they are set. Keep the default settings separate so that we can correctly reconstruct MAKEFLAGS. * src/makeint.h: Remove deprecated warn_undefined_variables_flag. * src/main.c: Create global variables to hold warning settings. (switches): Add a new switch for --warn. (initialize_warnings): Set the default warning actions. (main): Call initialize_warnings(). (encode_warning_state, decode_warning_state): Convert warning states between strings and enums. (encode_warning_name, decode_warning_name): Convert warning names between strings and enums. (decode_warn_flags): Convert a --warn option into enum values. If deprecated warn_undefined_variables_flag is set convert it to --warn. (decode_switches): Don't remove duplicates of --warn since order matters. Call decode_warn_flags() to handle --warn. (define_makeflags): Special-case handling of --warn options written to MAKEFLAGS: write out the current settings. * src/read.c (tilde_expand): Use new warning control macros. * src/variable.c (warn_undefined): Ditto. * src/job.c (construct_command_argv): Ditto. * tests/scripts/options/warn: Rename from warn-undefined-variables and add tests for --warn. * tests/scripts/variables/MAKEFLAGS: Expect the new behavior.
Diffstat (limited to 'doc/make.1')
-rw-r--r--doc/make.130
1 files changed, 29 insertions, 1 deletions
diff --git a/doc/make.1 b/doc/make.1
index f02afbee..933a8273 100644
--- a/doc/make.1
+++ b/doc/make.1
@@ -364,8 +364,36 @@ command on the given file before running
except that the modification time is changed only in the imagination of
.BR make .
.TP 0.5i
+\fB\-\-warn\fR[=\fIARG[\fR,\fIARG\fR]]
+Control warning reporting for makefiles. This option can appear multiple times.
+In case of conflicts, later settings override earlier settings.
+.I ARG
+can be an action; one of
+.IR ignore ,
+.IR warn ,
+or
+.I error
+to set the default action for all warnings, or it can be a specific warning:
+.I undefined-var
+(referencing an undefined variable). The behavior of each warning can be set
+by adding
+.BI : action
+after the warning name. If an action is not specified the default is
+.IR warn .
+If no
+.I ARG
+is provided the action for all warnings is
+.IR warn .
+If no
+.B \-\-warn
+option is provided the default action for
+.I undefined-var
+is
+.IR ignore .
+.TP 0.5i
.B \-\-warn\-undefined\-variables
-Warn when an undefined variable is referenced.
+A deprecated alternative for
+.BR \-\-warn=undefined-var .
.SH "EXIT STATUS"
GNU Make exits with a status of zero if all makefiles were successfully parsed
and no targets that were built failed. A status of one will be returned