Hi!

Here's an attempt to implement warning disabling by passing a `no<category>'
argument to -W (or in the WARNINGS env var. The `syntax' category is also
turned back on by default.


2000-05-11  Didier Verna  <[EMAIL PROTECTED]>

        * autoconf.sh (warnings): enable the `syntax' category by default,
        support the `no<category>' argument to disable warnings.

        * doc/autoconf.texi (Invoking autoconf): document.


Index: autoconf.sh
===================================================================
RCS file: /cvs/autoconf/autoconf.sh,v
retrieving revision 1.67
diff -u -r1.67 autoconf.sh
--- autoconf.sh 2000/05/03 11:22:50     1.67
+++ autoconf.sh 2000/05/11 20:36:37
@@ -43,10 +43,12 @@
 Warning categories include:
   \`cross'      cross compilation issues
   \`obsolete'   obsolete constructs
-  \`syntax'     dubious syntactic constructs
+  \`syntax'     dubious syntactic constructs (enabled by default)
   \`all'        all the warnings
   \`error'      warnings are error
 
+To disable a warning category, use its name prefixed with \`no'.
+
 Tracing:
   -t, --trace=MACRO     report the list of calls to MACRO
   -i, --initialization  also trace Autoconf's initialization process
@@ -209,6 +211,9 @@
 # Support $WARNINGS.
 : ${warnings=`echo $WARNINGS | sed -e 's/,/ /g'`}
 
+# Prepend default warnings.
+warnings="syntax ${warnings}"
+
 # Trap on 0 to stop playing with `rm'.
 $debug ||
 {
@@ -271,8 +276,16 @@
   ## --------------------------------- ##
   script)
   # Enable the requested warnings.
-  warnings_opt=`echo "$warnings" |
-                sed -e 's/\([^ ][^ ]*\)/-DAC_WARNING_ENABLE(\1) /g'`
+  warnings_opt=`echo "$warnings" | $AWK '
+  BEGIN { RS=" \t" }
+  {
+    for (i = 1 ; i <= NF ; i++)
+      if (substr ($i, 1, 2) == "no")
+        $i = sprintf ("-UAC_WARNING_ENABLE(%s)", substr ($i, 3))
+      else
+        $i = sprintf ("-DAC_WARNING_ENABLE(%s)", $i)
+  }
+  END { print }'`
   $run_m4f $warnings_opt $infile >$tmp/configure || exit 2
 
   # You could add your own prefixes to pattern if you wanted to check for
Index: doc/autoconf.texi
===================================================================
RCS file: /cvs/autoconf/doc/autoconf.texi,v
retrieving revision 1.272
diff -u -r1.272 autoconf.texi
--- doc/autoconf.texi   2000/05/11 16:56:14     1.272
+++ doc/autoconf.texi   2000/05/11 20:47:27
@@ -914,6 +914,9 @@
 category @samp{all} will report all the warnings, and @samp{error}
 treats warnings as errors.
 
+By default, only the `syntax' category is reported. You can disable a
+category by prefixing its name with `no'.
+
 The soon-do-be-standard environment variable @code{WARNINGS} is
 supported: it consists in a comma separated list of categories.  It is
 honored iff @samp{--warnings} was not used.

-- 
    /     /   _   _       Didier Verna        http://www.inf.enst.fr/~verna/
 - / / - / / /_/ /        EPITA / LRDE         mailto:[EMAIL PROTECTED]
/_/ / /_/ / /__ /      14-16 rue Voltaire        Tel. +33 (1) 44 08 01 77
                   94276 Kremlin-Bicêtre cedex   Fax. +33 (1) 44 08 01 99

Reply via email to