* automake.in (switch_warning, parse_WARNINGS): New function.
(setup_warnings): Rename to ...
(parse_warnings): ... this. Move most of the code to switch_warning.
Accept a comma separated list of categories.
* tests/vars2.test: Use a comma separated list of warning categories.
+2002-07-09 Alexandre Duret-Lutz <duret_g@epita.fr>
+
+ * automake.texi (Invoking Automake): Document WARNINGS.
+ * automake.in (switch_warning, parse_WARNINGS): New function.
+ (setup_warnings): Rename to ...
+ (parse_warnings): ... this. Move most of the code to switch_warning.
+ Accept a comma separated list of categories.
+ * tests/vars2.test: Use a comma separated list of warning categories.
+
2002-07-08 Alexandre Duret-Lutz <duret_g@epita.fr>
* NEWS (New in 1.6): Mention that libtoolize is no longer run
New in 1.6a:
+* Support for -Wmumble and -Wno-mumble, where mumble is a warning category
+ (see `automake --help' or the manual for a list of them).
+* Honor the WARNINGS environment variable.
+* Omit the call to depcomp when using gcc3: call the compiler directly.
* A new option, std-options, tests that programs support --help and --version
when `make installcheck' is run. This is enabled by --gnits.
* Texinfo rules now support the `ps' and `pdf' targets.
a DESTDIR install.
* `+=' can be used in conditionals, even if the augmented variable
was defined for another condition.
-* It is no longuer a requirement to use AM_CONFIG_HEADER instead of
- AC_CONFIG_HEADERS. AM_CONFIG_HEADER is obsolete.
+* It is no longer a requirement to use AM_CONFIG_HEADER instead of
+ AC_CONFIG_HEADERS. Although still supported, AM_CONFIG_HEADER is
+ obsolete. It is now an error to call any of these macro before
+ AM_INIT_AUTOMAKE.
* Use Autoconf's --trace interface to inspect configure.ac and get
a more accurate view of it.
* automake --output-dir is deprecated.
################################################################
+# Parse the WARNINGS environnent variable.
+&parse_WARNINGS;
+
# Parse command line.
&parse_arguments;
################################################################
-# Handle --warning=CATEGORY or -WCATEGORY
-sub setup_warnings ($$)
+
+# switch_warning ($CATEGORY)
+# --------------------------
+# If $CATEGORY is mumble, turn on the mumble channel.
+# If it's no-mumble, turn mumble off.
+# Alse handle `all' and `none' for completeness.
+sub switch_warning ($)
{
- my ($opt, $cat) = @_;
+ my ($cat) = @_;
my $has_no = 0;
if ($cat =~ /^no-(.*)$/)
}
else
{
- msg 'unsupported', "unknown warning category `$cat'";
+ return 1;
+ }
+ return 0;
+}
+
+# parse_WARNINGS
+# --------------
+# Honor the WARNINGS environment variable.
+sub parse_WARNINGS ($$)
+{
+ if (exists $ENV{'WARNINGS'})
+ {
+ # Ignore unknown categories. This is required because WARNINGS
+ # should be honored by many tools.
+ switch_warning $_ foreach (split (',', $ENV{'WARNINGS'}));
+ }
+}
+
+# parse_warning ($OPTION, $ARGUMENT)
+# ----------------------------------
+# Parse the argument of --warning=CATEGORY or -WCATEGORY.
+sub parse_warnings ($$)
+{
+ my ($opt, $categories) = @_;
+
+ foreach my $cat (split (',', $categories))
+ {
+ msg 'unsupported', "unknown warning category `$cat'"
+ if switch_warning $cat;
}
}
'a|add-missing' => \$add_missing,
'c|copy' => \$copy_missing,
'v|verbose' => sub { setup_channel 'verb', silent => 0; },
- 'W|warnings:s' => \&setup_warnings,
+ 'W|warnings:s' => \&parse_warnings,
# These long options (--Werror and --Wno-error) for backward
# compatibility. Use -Werror and -Wno-error today.
- 'Werror' => sub { setup_warnings 'W', 'error'; },
- 'Wno-error' => sub { setup_warnings 'W', 'no-error'; },
+ 'Werror' => sub { parse_warnings 'W', 'error'; },
+ 'Wno-error' => sub { parse_warnings 'W', 'no-error'; },
)
or exit 1;
The categories output by default are @samp{unsupported} and
@samp{unused}.
+
+@vindex WARNINGS
+The environment variable @samp{WARNINGS} can contain a comma separated
+list of categories to enable. It will be taken into account before the
+command-line switches, this way @samp{-Wnone} will also ignore any
+warning category enabled by @samp{WARNINGS}. This variable is also used
+by other tools like @command{autoconf}; unknown categories are ignored
+for this reason.
+
@end table
-@set UPDATED 7 July 2002
+@set UPDATED 9 July 2002
@set UPDATED-MONTH July 2002
@set EDITION 1.6a
@set VERSION 1.6a
$ACLOCAL
# Make sure this warning is print in the `portability' category.
-$AUTOMAKE -Wno-error -Wnone -Wportability 2>stderr
+$AUTOMAKE --warnings=no-error,none,portability 2>stderr
cat stderr
grep GOOD stderr && exit 1
grep _BAD stderr
-@set UPDATED 7 July 2002
+@set UPDATED 9 July 2002
@set UPDATED-MONTH July 2002
@set EDITION 1.6a
@set VERSION 1.6a