[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] warnings: new 'extra-portability' category, for AM_PROG_AR
From: |
Peter Rosin |
Subject: |
[PATCH 2/2] warnings: new 'extra-portability' category, for AM_PROG_AR |
Date: |
Thu, 20 Oct 2011 16:22:31 +0200 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 |
>From edda3ec3caf5c63bb30520002adcfb9b99914893 Mon Sep 17 00:00:00 2001
From: Peter Rosin <address@hidden>
Date: Thu, 20 Oct 2011 16:15:43 +0200
Subject: [PATCH 2/2] 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 <address@hidden>
---
ChangeLog | 30 ++++++++++++++++++
NEWS | 2 +-
automake.in | 4 +-
doc/automake.texi | 9 +++++
lib/Automake/ChannelDefs.pm | 13 ++++++++
tests/Makefile.am | 2 +
tests/Makefile.in | 2 +
tests/ar2.test | 2 +-
tests/extra-portability.test | 67 +++++++++++++++++++++++++++++++++++++++++
tests/extra-portability2.test | 57 ++++++++++++++++++++++++++++++++++
tests/pr300-lib.test | 2 +-
tests/pr300-ltlib.test | 2 +-
tests/pr307.test | 2 +-
tests/pr401.test | 10 +++---
tests/pr401b.test | 10 +++---
tests/pr401c.test | 10 +++---
tests/pr72.test | 2 +-
17 files changed, 203 insertions(+), 23 deletions(-)
create mode 100755 tests/extra-portability.test
create mode 100755 tests/extra-portability2.test
diff --git a/ChangeLog b/ChangeLog
index 02a4f3d..759fe8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,34 @@
2011-10-20 Peter Rosin <address@hidden>
+
+ 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-20 Peter Rosin <address@hidden>
Ralf Wildenhues <address@hidden>
Stefano Lattarini <address@hidden>
diff --git a/NEWS b/NEWS
index baddcad..d38338a 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 1d1bb15..9cfd9fc 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 c789e74..eea11d1 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)
address@hidden extra-portability
+extra portability issues related to obscure tools. One example of such
+a tool is the Microsoft 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.
address@hidden 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
address@hidden 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
diff --git a/lib/Automake/ChannelDefs.pm b/lib/Automake/ChannelDefs.pm
index aaca979..61b4ed4 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-portability>
+
+Extra warnings about non-portable constructs covering obscure tools.
+
=item C<syntax>
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 a756af0..0235e48 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -374,6 +374,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 2782cfb..630c0ea 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -652,6 +652,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 f8ad559..f37f514 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 0000000..49b17e0
--- /dev/null
+++ b/tests/extra-portability.test
@@ -0,0 +1,67 @@
+#! /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 <http://www.gnu.org/licenses/>.
+
+# Make sure enable of extra-portability enables portability and
+# that disable of portability disables extra-portability
+
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in <<END
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat >Makefile.am <<END
+EXTRA_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = sub/foo.c
+libfoo_a_CPPFLAGS = -Dwhatever
+END
+
+$ACLOCAL
+
+# enable extra-portability enables portability
+AUTOMAKE_fails -Wnone -Wextra-portability
+# The expected diagnostic is
+# Makefile.am:2: compiling `foo.c' with per-target flags requires
`AM_PROG_CC_C_O' in `configure.in'
+# .../lib/am/library.am: `libfoo.a': linking libraries using a non-POSIX
+# .../lib/am/library.am: archiver requires `AM_PROG_AR' in `configure.in'
+# Makefile.am:1: while processing library `libfoo.a'
+grep '^Makefile.am:2:.*requires.*AM_PROG_CC_C_O' stderr
+grep '/library.am:.*requires.*AM_PROG_AR' stderr
+
+# disable extra-portability leaves portability intact
+AUTOMAKE_fails -Wno-extra-portability
+# The expected diagnostic is
+# Makefile.am:2: compiling `foo.c' with per-target flags requires
`AM_PROG_CC_C_O' in `configure.in'
+# Makefile.am:1: while processing library `libfoo.a'
+grep '^Makefile.am:2:.*requires.*AM_PROG_CC_C_O' stderr
+grep '/library.am:.*requires.*AM_PROG_AR' stderr && Exit 1
+
+# enable portability does not enable extra-portability
+AUTOMAKE_fails -Wnone -Wportability
+# The expected diagnostic is
+# Makefile.am:2: compiling `foo.c' with per-target flags requires
`AM_PROG_CC_C_O' in `configure.in'
+# Makefile.am:1: while processing library `libfoo.a'
+grep '^Makefile.am:2:.*requires.*AM_PROG_CC_C_O' stderr
+grep '/library.am:.*requires.*AM_PROG_AR' stderr && Exit 1
+
+# disable portability disables extra-portability
+$AUTOMAKE -Wno-portability
+
+:
diff --git a/tests/extra-portability2.test b/tests/extra-portability2.test
new file mode 100755
index 0000000..9f4948b
--- /dev/null
+++ b/tests/extra-portability2.test
@@ -0,0 +1,57 @@
+#! /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 <http://www.gnu.org/licenses/>.
+
+# Make sure that extra-portability is 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 <<END
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat >Makefile.am <<END
+EXTRA_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = foo.c
+END
+
+$ACLOCAL
+
+# Make sure the test is useful.
+AUTOMAKE_fails
+# The expected diagnostic is
+# .../lib/am/library.am: `libfoo.a': linking libraries using a non-POSIX
+# .../lib/am/library.am: archiver requires `AM_PROG_AR' in `configure.in'
+grep '/library.am:.*requires.*AM_PROG_AR' stderr
+
+$AUTOMAKE --foreign
+$AUTOMAKE --gnu
+$AUTOMAKE --gnits
+
+:
diff --git a/tests/pr300-lib.test b/tests/pr300-lib.test
index 0b0d963..e10be24 100755
--- a/tests/pr300-lib.test
+++ b/tests/pr300-lib.test
@@ -45,7 +45,7 @@ END
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability --copy --add-missing
+$AUTOMAKE -Wno-extra-portability --copy --add-missing
./configure --prefix "`pwd`/inst"
diff --git a/tests/pr300-ltlib.test b/tests/pr300-ltlib.test
index 3189fb4..5e8c052 100755
--- a/tests/pr300-ltlib.test
+++ b/tests/pr300-ltlib.test
@@ -47,7 +47,7 @@ END
libtoolize
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability --copy --add-missing
+$AUTOMAKE -Wno-extra-portability --copy --add-missing
./configure --prefix "`pwd`/inst"
diff --git a/tests/pr307.test b/tests/pr307.test
index 4bf2f74..3496817 100755
--- a/tests/pr307.test
+++ b/tests/pr307.test
@@ -68,7 +68,7 @@ done
libtoolize --force
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability -a
+$AUTOMAKE -Wno-extra-portability -a
# Sanity check: make sure the variable we are attempting to force
# is used by configure
diff --git a/tests/pr401.test b/tests/pr401.test
index d06ddb4..6009315 100755
--- a/tests/pr401.test
+++ b/tests/pr401.test
@@ -81,7 +81,7 @@ EOF
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability
+$AUTOMAKE -Wno-extra-portability
./configure
$MAKE distcheck
@@ -97,7 +97,7 @@ mv -f configure.int configure.in
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability
+$AUTOMAKE -Wno-extra-portability
./configure
test ! -d lib/lib
$MAKE distcheck
@@ -108,7 +108,7 @@ $MAKE distcheck
mv -f src/Makefile.am src/t
sed 's/LDADD = .*/LDADD = @LIBOBJS@/' 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
@@ -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 3e6c927..4bd2f36 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 fc6a1ba..1d0511f 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 f2d507c..5af32ec 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
--
1.7.5.1
- [PATCH 2/2] warnings: new 'extra-portability' category, for AM_PROG_AR,
Peter Rosin <=
- Re: [PATCH 2/2] warnings: new 'extra-portability' category, for AM_PROG_AR, Stefano Lattarini, 2011/10/20
- Re: [PATCH 2/2] warnings: new 'extra-portability' category, for AM_PROG_AR, Peter Rosin, 2011/10/20
- Re: [PATCH 2/2] warnings: new 'extra-portability' category, for AM_PROG_AR, Stefano Lattarini, 2011/10/20
- Re: [PATCH 2/2] warnings: new 'extra-portability' category, for AM_PROG_AR, Peter Rosin, 2011/10/20
- Re: [PATCH 2/2] warnings: new 'extra-portability' category, for AM_PROG_AR, Stefano Lattarini, 2011/10/20
- Re: [PATCH 2/2] warnings: new 'extra-portability' category, for AM_PROG_AR, Peter Rosin, 2011/10/24