2011-01-15 Stefano Lattarini <stefano.lattarini@gmail.com>
+ For PR automake/547:
+ Warnings win over strictness in AUTOMAKE_OPTIONS.
+ Ensure that, for what concerns the options specified in
+ AUTOMAKE_OPTIONS, explicitly-defined warnings always take
+ precedence over implicit strictness-implied warnings.
+ This finally fixes Automake bug#7669 a.k.a. PR/547.
+ * automake.in (handle_options): Call 'process_option_list'
+ only once per set of options.
+ * lib/Automake/Options.pm (process_global_option_list,
+ process_option_list): Add sanity checks.
+ ($_options_processed, $_global_options_processed): New
+ internal variables, used by the sanity checks above.
+ * tests/warnings-win-over-strictness.test: Extend.
+
For PR automake/547:
Change signature of 'Automake::Options::_process_option_list()'.
This only modifies internal details in the automake implementation,
msg_var ('unsupported', $var,
"`AUTOMAKE_OPTIONS' cannot have conditional contents");
}
- foreach my $locvals ($var->value_as_list_recursive (cond_filter => TRUE,
- location => 1))
- {
- my ($where, $value) = @$locvals;
- return 1 if process_option_list ({ option => $value,
- where => $where});
- }
+ my @options = map { { option => $_->[1], where => $_->[0] } }
+ $var->value_as_list_recursive (cond_filter => TRUE,
+ location => 1);
+ return 1 if process_option_list (@options);
}
# Override portability-recursive warning.
use vars '%_options'; # From AUTOMAKE_OPTIONS
use vars '%_global_options'; # from AM_INIT_AUTOMAKE or the command line.
+# Whether process_option_list has already been called for the current
+# Makefile.am.
+use vars '$_options_processed';
+# Whether process_global_option_list has already been called.
+use vars '$_global_options_processed';
+
=head2 Constants
=over 4
sub reset ()
{
+ $_options_processed = 0;
%_options = %_global_options;
# The first time we are run,
# remember the current setting as the default.
sub process_option_list (@)
{
+ prog_error "local options already processed"
+ if $_options_processed;
return _process_option_list (%_options, @_);
+ $_options_processed = 1;
}
sub process_global_option_list (@)
{
+ prog_error "global options already processed"
+ if $_global_options_processed;
return _process_option_list (%_global_options, @_);
+ $_global_options_processed = 1;
}
=item C<set_strictness ($name)>
set_am_opts()
{
set +x
- sed -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|" <$2 >$2-t
+ sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+ -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
mv -f $2-t $2
set -x
cat $2
touch README INSTALL NEWS AUTHORS ChangeLog COPYING
cat > Makefile.am <<END
+AUTOMAKE_OPTIONS =
FOO := bar
END
ok --gnu -Wno-portability
ok -Wno-portability --gnu
+set_am_opts '' Makefile.am
+
rm -rf autom4te*.cache
set_am_opts 'foreign -Wportability' configure.in
ko
set_am_opts '-Wno-portability gnu' configure.in
ok
+rm -rf autom4te*.cache
+set_am_opts '' configure.in
+
+set_am_opts 'foreign -Wportability' Makefile.am
+ko
+set_am_opts '-Wportability foreign' Makefile.am
+ko
+set_am_opts 'gnu -Wno-portability' Makefile.am
+ok
+set_am_opts '-Wno-portability gnu' Makefile.am
+ok
+
: