From: Peter Rosin Date: Thu, 20 Oct 2011 22:24:38 +0000 (+0200) Subject: warnings: new 'extra-portability' category, for AM_PROG_AR X-Git-Tag: ng-0.5a~101^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc2202a6b0d5a7dc2f8af17e4ac2fdd3fe46d267;p=thirdparty%2Fautomake.git warnings: new 'extra-portability' category, for AM_PROG_AR * lib/Automake/ChannelDefs.pm: Register new extra-portability warning channel. (switch_warning): Turn off extra-portability if portability is turned off, and turn on portability if extra-portability is turned on. (set_strictness): Silence extra-portability for --gnits, --gnu and --foreign. * tests/extra-portability2.test: New test, checking that the extra-portability channel is silenced by --gnits, --gnu and --foreign. * doc/automake.texi (Invoking Automake): Document the new warning category and its interaction with the portability category. * tests/extra-portability.test: New test, checking the interaction between the portability and extra-portability warning categories. * automake.in (handle_libraries, handle_ltlibraries): Move the AM_PROG_AR warnings to the new extra-portability channel. * tests/ar2.test: Adjust to the new warning channel. * tests/pr300-lib.test: Likewise. * tests/pr300-ltlib.test: Likewise. * tests/pr307.test: Likewise. * tests/pr401.test: Likewise. * tests/pr401b.test: Likewise. * tests/pr401c.test: Likewise. * tests/pr72.test: Likewise. * NEWS: Likewise. * tests/Makefile.am (TESTS): Update. Signed-off-by: Peter Rosin --- diff --git a/ChangeLog b/ChangeLog index 1d7b68de5..2acaec8ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +2011-10-21 Peter Rosin + + warnings: new 'extra-portability' category, for AM_PROG_AR + * lib/Automake/ChannelDefs.pm: Register new extra-portability + warning channel. + (switch_warning): Turn off extra-portability if portability is + turned off, and turn on portability if extra-portability is + turned on. + (set_strictness): Silence extra-portability for --gnits, --gnu + and --foreign. + * tests/extra-portability2.test: New test, checking that the + extra-portability channel is silenced by --gnits, --gnu and + --foreign. + * doc/automake.texi (Invoking Automake): Document the new warning + category and its interaction with the portability category. + * tests/extra-portability.test: New test, checking the interaction + between the portability and extra-portability warning categories. + * automake.in (handle_libraries, handle_ltlibraries): Move the + AM_PROG_AR warnings to the new extra-portability channel. + * tests/ar2.test: Adjust to the new warning channel. + * tests/pr300-lib.test: Likewise. + * tests/pr300-ltlib.test: Likewise. + * tests/pr307.test: Likewise. + * tests/pr401.test: Likewise. + * tests/pr401b.test: Likewise. + * tests/pr401c.test: Likewise. + * tests/pr72.test: Likewise. + * NEWS: Likewise. + * tests/Makefile.am (TESTS): Update. + 2011-10-21 Peter Rosin Ralf Wildenhues Stefano Lattarini diff --git a/NEWS b/NEWS index baddcad4c..d38338acd 100644 --- a/NEWS +++ b/NEWS @@ -24,7 +24,7 @@ New in 1.11.0a: - New macro AM_PROG_AR that looks for an archiver and wraps it in the new 'ar-lib' auxiliary script if the found archiver is Microsoft lib. This new macro is required for LIBRARIES and LTLIBRARIES when automake is - run with -Wportability (or -Wall) and -Werror. + run with -Wextra-portability (or -Wall) and -Werror. Bugs fixed in 1.11.0a: diff --git a/automake.in b/automake.in index 1d1bb15dc..9cfd9fc3e 100755 --- a/automake.in +++ b/automake.in @@ -2826,7 +2826,7 @@ sub handle_libraries if (! $seen_ar) { - msg ('portability', $where, + msg ('extra-portability', $where, "`$onelib': linking libraries using a non-POSIX\n" . "archiver requires `AM_PROG_AR' in `$configure_ac'") } @@ -3070,7 +3070,7 @@ sub handle_ltlibraries if (! $seen_ar) { - msg ('portability', $where, + msg ('extra-portability', $where, "`$onelib': linking libtool libraries using a non-POSIX\n" . "archiver requires `AM_PROG_AR' in `$configure_ac'") } diff --git a/doc/automake.texi b/doc/automake.texi index c789e7433..25b1d4d10 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -2680,6 +2680,9 @@ user redefinitions of Automake rules or variables @item portability portability issues (e.g., use of @command{make} features that are known to be not portable) +@item extra-portability +extra portability issues related to obscure tools. One example of such +a tool is the Microsoft @command{lib} archiver. @item syntax weird syntax, unused variables, typos @item unsupported @@ -2702,6 +2705,12 @@ are enabled in @option{--gnu} and @option{--gnits} strictness. On the other hand, the @option{silent-rules} options (@pxref{Options}) turns off portability warnings about recursive variable expansions. +@c Checked by extra-portability.test +Turning off @samp{portability} will also turn off @samp{extra-portability}, +and similarly turning on @samp{extra-portability} will also turn on +@samp{portability}. However, turning on @samp{portability} or turning +off @samp{extra-portability} will not affect the other category. + @vindex WARNINGS The environment variable @env{WARNINGS} can contain a comma separated list of categories to enable. It will be taken into account before the @@ -3949,8 +3958,8 @@ you have an @command{emacs} that supports Emacs Lisp). @acindex AM_PROG_AR @vindex AR You must use this macro when you use the archiver in your project, if -you want support for unusual archivers such as Microsoft lib. The -content of the optional argument is executed if the archiver +you want support for unusual archivers such as Microsoft @command{lib}. +The content of the optional argument is executed if the archiver interface is not recognized; the default action is to abort configure with an error message. diff --git a/lib/Automake/ChannelDefs.pm b/lib/Automake/ChannelDefs.pm index aaca97920..61b4ed4d9 100644 --- a/lib/Automake/ChannelDefs.pm +++ b/lib/Automake/ChannelDefs.pm @@ -115,6 +115,10 @@ variables (silent by default). Warnings about non-portable constructs. +=item C + +Extra warnings about non-portable constructs covering obscure tools. + =item C Warnings about weird syntax, unused variables, typos... @@ -151,6 +155,7 @@ register_channel 'automake', type => 'fatal', backtrace => 1, footer => "\nPlease contact <$PACKAGE_BUGREPORT>.", uniq_part => UP_NONE, ordered => 0; +register_channel 'extra-portability', type => 'warning', silent => 1; register_channel 'gnu', type => 'warning'; register_channel 'obsolete', type => 'warning', silent => 1; register_channel 'override', type => 'warning', silent => 1; @@ -180,6 +185,7 @@ sub usage () `obsolete' obsolete features or constructions `override' user redefinitions of Automake rules or variables `portability' portability issues (default in gnu and gnits modes) + `extra-portability' extra portability issues related to obscure tools `syntax' dubious syntactic constructs (default) `unsupported' unsupported or incomplete features (default) `all' all the warnings @@ -284,6 +290,10 @@ sub switch_warning ($) setup_channel $cat, silent => $has_no; setup_channel 'portability-recursive', silent => $has_no if $cat eq 'portability'; + setup_channel 'extra-portability', silent => $has_no + if ($cat eq 'portability' && $has_no); + setup_channel 'portability', silent => $has_no + if ($cat eq 'extra-portability' && ! $has_no); } else { @@ -345,6 +355,7 @@ sub set_strictness ($) setup_channel 'error-gnu/warn', silent => 0, type => 'error'; setup_channel 'error-gnits', silent => 1; setup_channel 'portability', silent => 0; + setup_channel 'extra-portability', silent => 1; setup_channel 'gnu', silent => 0; } elsif ($name eq 'gnits') @@ -353,6 +364,7 @@ sub set_strictness ($) setup_channel 'error-gnu/warn', silent => 0, type => 'error'; setup_channel 'error-gnits', silent => 0; setup_channel 'portability', silent => 0; + setup_channel 'extra-portability', silent => 1; setup_channel 'gnu', silent => 0; } elsif ($name eq 'foreign') @@ -361,6 +373,7 @@ sub set_strictness ($) setup_channel 'error-gnu/warn', silent => 0, type => 'warning'; setup_channel 'error-gnits', silent => 1; setup_channel 'portability', silent => 1; + setup_channel 'extra-portability', silent => 1; setup_channel 'gnu', silent => 1; } else diff --git a/tests/Makefile.am b/tests/Makefile.am index b0be5564b..82d2aa4cb 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -375,6 +375,8 @@ extra8.test \ extra10.test \ extra11.test \ extra12.test \ +extra-portability.test \ +extra-portability2.test \ f90only.test \ flavor.test \ flibs.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 3c19988d0..d78ad3d1c 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -653,6 +653,8 @@ extra8.test \ extra10.test \ extra11.test \ extra12.test \ +extra-portability.test \ +extra-portability2.test \ f90only.test \ flavor.test \ flibs.test \ diff --git a/tests/ar2.test b/tests/ar2.test index f8ad55987..f37f51450 100755 --- a/tests/ar2.test +++ b/tests/ar2.test @@ -33,7 +33,7 @@ libfoo_a_SOURCES = foo.c END $ACLOCAL -$AUTOMAKE -Wno-portability +$AUTOMAKE -Wno-extra-portability grep '^ARFLAGS =' Makefile.in grep '^AR =' Makefile.in diff --git a/tests/extra-portability.test b/tests/extra-portability.test new file mode 100755 index 000000000..191dcb493 --- /dev/null +++ b/tests/extra-portability.test @@ -0,0 +1,69 @@ +#! /bin/sh +# Copyright (C) 2011 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Check interactions between the `portability' and `extra-portability' +# warning categories: +# 1. `-Wextra-portability' must imply `-Wportability'. +# 2. `-Wno-portability' must imply `-Wno-extra-portability'. + +. ./defs || Exit 1 + +set -e + +cat >>configure.in <Makefile.am <. + +# Make sure that extra-portability warnings are not enabled by --gnits, +# --gnu and --foreign. + +. ./defs || Exit 1 + +set -e + +# Satisfy --gnits and --gnu. +: > INSTALL +: > NEWS +: > README +: > AUTHORS +: > ChangeLog +: > COPYING +: > THANKS + +cat >>configure.in <Makefile.am < src/Makefile.am -AUTOMAKE_fails -Wno-portability +AUTOMAKE_fails -Wno-extra-portability grep 'cannot be used outside.*lib' stderr mv -f src/t src/Makefile.am @@ -139,7 +139,7 @@ EOF $ACLOCAL $AUTOCONF -$AUTOMAKE -Wno-portability --add-missing +$AUTOMAKE -Wno-extra-portability --add-missing ./configure test ! -d src/lib test ! -d 'src/$(top_builddir)' @@ -176,7 +176,7 @@ EOF $ACLOCAL $AUTOCONF -$AUTOMAKE -Wno-portability +$AUTOMAKE -Wno-extra-portability ./configure $MAKE distcheck diff --git a/tests/pr401b.test b/tests/pr401b.test index 3e6c927e7..4bd2f36b6 100755 --- a/tests/pr401b.test +++ b/tests/pr401b.test @@ -82,7 +82,7 @@ EOF libtoolize $ACLOCAL $AUTOCONF -$AUTOMAKE -Wno-portability -a +$AUTOMAKE -Wno-extra-portability -a ./configure $MAKE distcheck @@ -99,7 +99,7 @@ mv -f configure.int configure.in $ACLOCAL $AUTOCONF -$AUTOMAKE -Wno-portability -a +$AUTOMAKE -Wno-extra-portability -a ./configure test ! -d lib/lib $MAKE distcheck @@ -110,7 +110,7 @@ $MAKE distcheck mv -f src/Makefile.am src/t sed 's/LDADD = .*/LDADD = @LTLIBOBJS@/' src/t > src/Makefile.am -AUTOMAKE_fails -Wno-portability +AUTOMAKE_fails -Wno-extra-portability grep 'cannot be used outside.*lib' stderr mv -f src/t src/Makefile.am @@ -140,7 +140,7 @@ EOF $ACLOCAL $AUTOCONF -$AUTOMAKE -Wno-portability --add-missing +$AUTOMAKE -Wno-extra-portability --add-missing ./configure test ! -d src/lib test ! -d 'src/$(top_builddir)' @@ -177,7 +177,7 @@ EOF $ACLOCAL $AUTOCONF -$AUTOMAKE -Wno-portability +$AUTOMAKE -Wno-extra-portability ./configure $MAKE distcheck diff --git a/tests/pr401c.test b/tests/pr401c.test index fc6a1ba6a..1d0511f6b 100755 --- a/tests/pr401c.test +++ b/tests/pr401c.test @@ -83,7 +83,7 @@ EOF $ACLOCAL $AUTOCONF -$AUTOMAKE -Wno-portability +$AUTOMAKE -Wno-extra-portability ./configure $MAKE distcheck @@ -100,7 +100,7 @@ mv -f configure.int configure.in $ACLOCAL $AUTOCONF -$AUTOMAKE -Wno-portability +$AUTOMAKE -Wno-extra-portability ./configure test ! -d lib/lib $MAKE distcheck @@ -111,7 +111,7 @@ $MAKE distcheck mv -f src/Makefile.am src/t sed 's/LDADD = .*/LDADD = @ALLOCA@/' src/t > src/Makefile.am -AUTOMAKE_fails -Wno-portability +AUTOMAKE_fails -Wno-extra-portability grep 'cannot be used outside.*lib' stderr mv -f src/t src/Makefile.am @@ -142,7 +142,7 @@ EOF $ACLOCAL $AUTOCONF -$AUTOMAKE -Wno-portability --add-missing +$AUTOMAKE -Wno-extra-portability --add-missing ./configure $MAKE test ! -d src/lib @@ -179,7 +179,7 @@ EOF $ACLOCAL $AUTOCONF -$AUTOMAKE -Wno-portability +$AUTOMAKE -Wno-extra-portability ./configure $MAKE distcheck diff --git a/tests/pr72.test b/tests/pr72.test index f2d507cff..5af32ec98 100755 --- a/tests/pr72.test +++ b/tests/pr72.test @@ -39,7 +39,7 @@ END : > config.sub $ACLOCAL -$AUTOMAKE -Wno-portability +$AUTOMAKE -Wno-extra-portability grep '^LINK =' Makefile.in