automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: honor WARNINGS


From: Alexandre Duret-Lutz
Subject: FYI: honor WARNINGS
Date: 09 Jul 2002 21:11:29 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

>>> "Akim" == Akim Demaille <address@hidden> writes:

[...]
 Akim> what I would most enjoy is:
 Akim> 1. support for $WARNINGS
[...]

Here it is.  Committed on HEAD.

I haven't found a way to test WARNINGS in the testsuite,
because $AUTOMAKE contains `-Wall -Werror'...

2002-07-09  Alexandre Duret-Lutz  <address@hidden>

        * 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.

Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.183
diff -u -r1.183 NEWS
--- NEWS        8 Jul 2002 20:13:38 -0000       1.183
+++ NEWS        9 Jul 2002 19:05:26 -0000
@@ -1,4 +1,8 @@
 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.
@@ -6,8 +10,10 @@
   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.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1320
diff -u -r1.1320 automake.in
--- automake.in 8 Jul 2002 19:41:22 -0000       1.1320
+++ automake.in 9 Jul 2002 19:05:48 -0000
@@ -1080,6 +1080,9 @@
 
 ################################################################
 
+# Parse the WARNINGS environnent variable.
+&parse_WARNINGS;
+
 # Parse command line.
 &parse_arguments;
 
@@ -1337,10 +1340,15 @@
 
 ################################################################
 
-# 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-(.*)$/)
@@ -1367,7 +1375,35 @@
     }
   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;
     }
 }
 
@@ -1396,11 +1432,11 @@
        '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;
 
Index: automake.texi
===================================================================
RCS file: /cvs/automake/automake/automake.texi,v
retrieving revision 1.285
diff -u -r1.285 automake.texi
--- automake.texi       7 Jul 2002 21:40:43 -0000       1.285
+++ automake.texi       9 Jul 2002 19:06:05 -0000
@@ -1059,6 +1059,15 @@
 
 The categories output by default are @samp{unsupported} and
 @samp{unused}.
+
address@hidden 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
 
 
Index: stamp-vti
===================================================================
RCS file: /cvs/automake/automake/stamp-vti,v
retrieving revision 1.184
diff -u -r1.184 stamp-vti
--- stamp-vti   7 Jul 2002 22:38:45 -0000       1.184
+++ stamp-vti   9 Jul 2002 19:06:05 -0000
@@ -1,4 +1,4 @@
address@hidden UPDATED 7 July 2002
address@hidden UPDATED 9 July 2002
 @set UPDATED-MONTH July 2002
 @set EDITION 1.6a
 @set VERSION 1.6a
Index: version.texi
===================================================================
RCS file: /cvs/automake/automake/version.texi,v
retrieving revision 1.257
diff -u -r1.257 version.texi
--- version.texi        7 Jul 2002 22:38:45 -0000       1.257
+++ version.texi        9 Jul 2002 19:06:05 -0000
@@ -1,4 +1,4 @@
address@hidden UPDATED 7 July 2002
address@hidden UPDATED 9 July 2002
 @set UPDATED-MONTH July 2002
 @set EDITION 1.6a
 @set VERSION 1.6a
Index: tests/vars2.test
===================================================================
RCS file: /cvs/automake/automake/tests/vars2.test,v
retrieving revision 1.1
diff -u -r1.1 vars2.test
--- tests/vars2.test    8 Jul 2002 19:41:24 -0000       1.1
+++ tests/vars2.test    9 Jul 2002 19:06:05 -0000
@@ -15,7 +15,7 @@
 
 $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

-- 
Alexandre Duret-Lutz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]