2011-01-15 Stefano Lattarini <stefano.lattarini@gmail.com>
+ For PR automake/547:
+ Warnings win over strictness in AM_INIT_AUTOMAKE.
+ This change ensures that, for what concerns the options specified
+ in AM_INIT_AUTOMAKE, explicitly-defined warnings always take
+ precedence over implicit strictness-implied warnings. Related to
+ Automake bug#7669 a.k.a. PR/547.
+ * lib/Automake/Options.pm (_process_option_list): Parse explicit
+ warnings only after the strictness level has been set. Fix POD
+ documentation.
+ * tests/warnings-win-over-strictness.test: Extend.
+
For PR automake/547:
Warnings win over strictness on command line.
Ensure that, on the command line at least, explicitly defined
Process Automake's option lists. C<@options> should be a list of
words, as they occur in C<AUTOMAKE_OPTIONS> or C<AM_INIT_AUTOMAKE>.
+These functions should be called at most once for each set of options
+having the same precedence; i.e., do not call it twice for two options
+from C<AM_INIT_AUTOMAKE>.
+
Return 1 on error, 0 otherwise.
=cut
sub _process_option_list (\%$@)
{
my ($options, $where, @list) = @_;
+ my @warnings = ();
foreach (@list)
{
}
elsif (/^(?:--warnings=|-W)(.*)$/)
{
- foreach my $cat (split (',', $1))
- {
- msg 'unsupported', $where, "unknown warning category `$cat'"
- if switch_warning $cat;
- }
+ push @warnings, split (',', $1);
}
else
{
return 1;
}
}
+ # We process warnings here, so that any explicitly-given warning setting
+ # will take precedence over warning settings defined implicitly by the
+ # strictness.
+ foreach my $cat (@warnings)
+ {
+ msg 'unsupported', $where, "unknown warning category `$cat'"
+ if switch_warning $cat;
+ }
return 0;
}
test `wc -l <stderr` -eq 1
}
+set_am_opts()
+{
+ set +x
+ sed -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|" <$2 >$2-t
+ mv -f $2-t $2
+ set -x
+ cat $2
+}
+
# Files required in gnu strictness.
touch README INSTALL NEWS AUTHORS ChangeLog COPYING
ok --gnu -Wno-portability
ok -Wno-portability --gnu
+rm -rf autom4te*.cache
+set_am_opts 'foreign -Wportability' configure.in
+ko
+rm -rf autom4te*.cache
+set_am_opts '-Wportability foreign' configure.in
+ko
+rm -rf autom4te*.cache
+set_am_opts 'gnu -Wno-portability' configure.in
+ok
+rm -rf autom4te*.cache
+set_am_opts '-Wno-portability gnu' configure.in
+ok
+
: