]> git.ipfire.org Git - thirdparty/automake.git/commit
Consistently process -W(no-)error after all other warning options.
authorZack Weinberg <zackw@panix.com>
Fri, 11 Sep 2020 20:17:41 +0000 (16:17 -0400)
committerZack Weinberg <zackw@panix.com>
Sat, 12 Sep 2020 13:33:14 +0000 (09:33 -0400)
commit9ae8a896cb83e6693413d80b5c85e527f3bb11f6
tree1b3039b985360b6a20a85493881ff96ff3e80494
parentab9ef6cf1825eded75153c556d933639314bde65
Consistently process -W(no-)error after all other warning options.

automake and aclocal were processing ‘-W(no-)error’ whenever it
appeared on the command line, which means that
‘-Werror,something-strange’ would issue a hard error, but
‘-Wsomething-strange,error’ would only issue a warning.

It is not desirable for warnings about unknown warning categories ever to be
treated as a hard error; that leads to problems for driver scripts like
autoreconf, which would like to pass whatever -W options it got on its own
command line down to all the tools and not worry about which tools understand
which warning categories.  Also, this sort of order dependence is confusing
for humans.

Change parse_warnings to take just one option, the _complete_ list of warning
categories seen on the command line, and to process -Werror / -Wno-error after
processing all other warnings options.  Thus, unknown warnings categories will
always just be a plain warning.  This does mean aclocal has to stop using
parse_warnings as a Getopt::Long callback, but that’s not a big deal.

Similarly, change parse_WARNINGS to record whether ‘error’ appeared in the
environment variable, but not activate warnings-are-errors mode itself.
parse_warnings picks up the record and honors it, unless it’s overridden by
the command line.

* lib/Automake/ChannelDefs.pm ($werror): New package global (not exported).
  (parse_WARNINGS): Do not call switch_warning for ‘error’ / ‘no-error’;
  just toggle the value of $werror.
  (parse_warnings): Do not call switch_warning immediately for
  ‘error’ / ‘no-error’; toggle $werror instead.  Call switch_warning ‘error’
  at the very end if $werror is true.  Remove unused $OPTION argument.
* bin/automake.in: parse_warnings now takes only one argument.
* bin/aclocal.in: Call parse_warnings after parse_options instead of
  using it as a parse_options callback.
bin/aclocal.in
bin/automake.in
lib/Automake/ChannelDefs.pm