+2011-11-04 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ warnings: 'extra-portability' category is not implied by '-Wall'
+ This change is only intended for the 1.11.x series. In automake
+ 1.12, `-Wall' will be meant to enable `-Wextra-portability'.
+ * lib/Automake/ChannelDefs.pm (switch_warning): Do not enable
+ extra-portability warnings when `-Wall' is given. Use ...
+ ($have_extra_portability ): ... this new global variable.
+ Add a trailing "1;" to avoid spurious errors upon the importing
+ of this module.
+ * tests/extra-portability.test: Update and extend.
+ * NEWS: Update.
+
2011-11-03 Stefano Lattarini <stefano.lattarini@gmail.com>
tests: various minor tweakings, mostly related to AM_PROG_AR
search path are looked up is probably going to be changed in the
next Automake release (1.12).
+ - Starting from the next Automake release (1.12), warnings in the
+ `extra-portability' category will be enabled by `-Wall' (right now,
+ one has to use `-Wextra-portability' explicitly).
+
* Changes to aclocal:
- The `--acdir' option is deprecated. Now you should use the new options
- 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 -Wextra-portability (or -Wall) and -Werror.
+ run with -Wextra-portability and -Werror.
- When using DejaGnu-based testsuites, the user can extend the `site.exp'
file generated by automake-provided rules by defining the special make
=cut
+# HACK to have `-Wextra-portability' *not* implied by `-Wall'.
+# This will go away in automake 1.12.
+my $have_extra_portability = 0;
+
sub switch_warning ($)
{
my ($cat) = @_;
if ($cat eq 'all')
{
setup_channel_type 'warning', silent => $has_no;
+ setup_channel 'extra-portability', silent => 1
+ unless $have_extra_portability;
}
elsif ($cat eq 'none')
{
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);
+ if ($cat eq 'portability' && $has_no)
+ {
+ setup_channel 'extra-portability', silent => 1;
+ $have_extra_portability = 0;
+ }
+ if ($cat eq 'extra-portability' && ! $has_no)
+ {
+ setup_channel 'portability', silent => 0;
+ $have_extra_portability = 1;
+ }
}
else
{
}
}
+1;
+
=back
=head1 SEE ALSO
# warning categories:
# 1. `-Wextra-portability' must imply `-Wportability'.
# 2. `-Wno-portability' must imply `-Wno-extra-portability'.
+# 3. `-Wall' does *not* imply `-Wextra-portability'.
. ./defs || Exit 1
cat >Makefile.am <<END
EXTRA_LIBRARIES = libfoo.a
libfoo_a_SOURCES = sub/foo.c
-libfoo_a_CPPFLAGS = -Dwhatever
END
$ACLOCAL
+# `-Wall' does not enable extra-portability warnings.
+$AUTOMAKE -Wall -Werror
+
+# Enabling extra-portability works.
+AUTOMAKE_fails -Wnone -Wextra-portability
+grep 'requires.*AM_PROG_AR' stderr
+# Disabling portability disables extra-portability.
+$AUTOMAKE -Wno-portability -Wall
+$AUTOMAKE -Wextra-portability -Wno-portability -Wall
+
+echo libfoo_a_CPPFLAGS = -Dwhatever >> Makefile.am
+
# Enabling extra-portability enables portability.
AUTOMAKE_fails -Wnone -Wextra-portability
# The expected diagnostic is
grep 'requires.*AM_PROG_CC_C_O' stderr
grep 'requires.*AM_PROG_AR' stderr
+# `-Wall' does not reset extra portability warnings to their
+# default (i.e., disabled).
+AUTOMAKE_fails -Wextra-portability -Wall
+grep 'requires.*AM_PROG_CC_C_O' stderr
+grep 'requires.*AM_PROG_AR' stderr
+
# Disabling extra-portability leaves portability intact.
AUTOMAKE_fails -Wno-extra-portability
# The expected diagnostic is
grep 'requires.*AM_PROG_CC_C_O' stderr
grep 'requires.*AM_PROG_AR' stderr && Exit 1
+# `-Wall' does not set extra portability warnings if they have
+# been previously disabled.
+AUTOMAKE_fails -Wno-extra-portability -Wall
+grep 'requires.*AM_PROG_CC_C_O' stderr
+grep 'requires.*AM_PROG_AR' stderr && Exit 1
+
# Enabling portability does not enable extra-portability.
AUTOMAKE_fails -Wnone -Wportability
# The expected diagnostic is
# Disabling portability disables extra-portability.
$AUTOMAKE -Wno-portability
+$AUTOMAKE -Wextra-portability -Wno-portability
: