ChannelDefs.pm *ought* to be kept in sync between automake and autoconf, because it defines the set of valid -W options, and autoreconf assumes that it can pass arbitrary -W options to all of the tools it invokes. However, it isn’t covered by either project’s ‘make fetch’ and it hasn’t actually *been* in sync for more than 17 years.
This patch manually brings over all of the changes made on the autoconf side. Most importantly, there is a new warnings channel ‘cross’, for warnings related to cross-compilation. Also, the ‘usage’ function now *returns* the text to be put into a usage message, instead of printing it itself. (This is necessary on autoconf’s side.) * lib/Automake/ChannelDefs.pm: Sync from autoconf. (cross): New warnings channel. (portability-recursive): Document. (usage): Now returns the text to be printed, instead of printing it. (parse_warnings): Second argument may now be a list. --- bin/aclocal.in | 10 ++--- bin/automake.in | 7 +--- lib/Automake/ChannelDefs.pm | 83 +++++++++++++++++++++++++------------ 3 files changed, 62 insertions(+), 38 deletions(-) diff --git a/bin/aclocal.in b/bin/aclocal.in index c968bd710..1e734ea48 100644 --- a/bin/aclocal.in +++ b/bin/aclocal.in @@ -1048,15 +1048,11 @@ Options: --verbose don't be silent --version print version number, then exit -W, --warnings=CATEGORY report the warnings falling in CATEGORY +EOF -Warning categories include: - syntax dubious syntactic constructs (default) - unsupported unknown macros (default) - all all the warnings (default) - no-CATEGORY turn off warnings in CATEGORY - none turn off all the warnings - error treat warnings as errors + print Automake::ChannelDefs::usage (), "\n"; + print <<'EOF'; Report bugs to <@PACKAGE_BUGREPORT@>. GNU Automake home page: <@PACKAGE_URL@>. General help using GNU software: <https://www.gnu.org/gethelp/>. diff --git a/bin/automake.in b/bin/automake.in index 1e4ccc8df..ad91d875a 100644 --- a/bin/automake.in +++ b/bin/automake.in @@ -8114,7 +8114,7 @@ Library files: -f, --force-missing force update of standard files "; - Automake::ChannelDefs::usage; + print Automake::ChannelDefs::usage (), "\n"; print "\nFiles automatically distributed if found " . "(always):\n"; @@ -8184,10 +8184,7 @@ sub parse_arguments () set_strictness ($strict); my $cli_where = new Automake::Location; set_global_option ('no-dependencies', $cli_where) if $ignore_deps; - for my $warning (@warnings) - { - parse_warnings ('-W', $warning); - } + parse_warnings ('-W', @warnings); return unless @ARGV; diff --git a/lib/Automake/ChannelDefs.pm b/lib/Automake/ChannelDefs.pm index 37c5a2715..59728bdbe 100644 --- a/lib/Automake/ChannelDefs.pm +++ b/lib/Automake/ChannelDefs.pm @@ -23,7 +23,7 @@ Automake::ChannelDefs - channel definitions for Automake and helper functions use Automake::ChannelDefs; - Automake::ChannelDefs::usage (); + print Automake::ChannelDefs::usage (), "\n"; prog_error ($MESSAGE, [%OPTIONS]); error ($WHERE, $MESSAGE, [%OPTIONS]); error ($MESSAGE); @@ -32,12 +32,12 @@ Automake::ChannelDefs - channel definitions for Automake and helper functions verb ($MESSAGE, [%OPTIONS]); switch_warning ($CATEGORY); parse_WARNINGS (); - parse_warnings ($OPTION, $ARGUMENT); + parse_warnings ($OPTION, @ARGUMENT); Automake::ChannelDefs::set_strictness ($STRICTNESS_NAME); =head1 DESCRIPTION -This packages defines channels that can be used in Automake to +This package defines channels that can be used in Automake to output diagnostics and other messages (via C<msg()>). It also defines some helper function to enable or disable these channels, and some shorthand function to output on specific channels. @@ -98,6 +98,10 @@ Errors related to GNITS Standards (silent by default). Internal errors. Use C<&prog_error> to send messages over this channel. +=item C<cross> + +Constructs compromising the cross-compilation of the package. + =item C<gnu> Warnings related to GNU Coding Standards. @@ -115,6 +119,14 @@ variables (silent by default). Warnings about non-portable constructs. +=item C<portability-recursive> + +Warnings about recursive variable expansions (C<$(foo$(x))>). +These are not universally supported, but are more portable than +the other non-portable constructs diagnosed by C<-Wportability>. +These warnings are turned on by C<-Wportability> but can then be +turned off separately by C<-Wno-portability-recursive>. + =item C<extra-portability> Extra warnings about non-portable constructs covering obscure tools. @@ -155,11 +167,12 @@ 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 'cross', type => 'warning', silent => 1; register_channel 'gnu', type => 'warning'; register_channel 'obsolete', type => 'warning'; register_channel 'override', type => 'warning', silent => 1; register_channel 'portability', type => 'warning', silent => 1; +register_channel 'extra-portability', type => 'warning', silent => 1; register_channel 'portability-recursive', type => 'warning', silent => 1; register_channel 'syntax', type => 'warning'; register_channel 'unsupported', type => 'warning'; @@ -178,26 +191,26 @@ setup_channel_type 'fatal', header => 'error: '; =item C<usage ()> -Display warning categories. +Return the warning category descriptions. =cut sub usage () { - print <<EOF; -Warning categories include: - gnu GNU coding standards (default in gnu and gnits modes) - 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 - no-CATEGORY turn off warnings in CATEGORY - none turn off all the warnings - error treat warnings as errors -EOF + return "Warning categories include: + cross cross compilation issues + gnu GNU coding standards (default in gnu and gnits modes) + obsolete obsolete features or constructions (default) + override user redefinitions of Automake rules or variables + portability portability issues (default in gnu and gnits modes) + portability-recursive nested Make variables (default with -Wportability) + extra-portability extra portability issues related to obscure tools + syntax dubious syntactic constructs (default) + unsupported unsupported or incomplete features (default) + all all the warnings + no-CATEGORY turn off warnings in CATEGORY + none turn off all the warnings + error treat warnings as errors"; } =item C<prog_error ($MESSAGE, [%OPTIONS])> @@ -258,7 +271,7 @@ sub verb ($;%) =item C<switch_warning ($CATEGORY)> If C<$CATEGORY> is C<mumble>, turn on channel C<mumble>. -If it's C<no-mumble>, turn C<mumble> off. +If it is C<no-mumble>, turn C<mumble> off. Else handle C<all> and C<none> for completeness. =cut @@ -349,21 +362,22 @@ sub parse_WARNINGS () } } -=item C<parse_warnings ($OPTION, $ARGUMENT)> +=item C<parse_warnings ($OPTION, @ARGUMENT)> Parse the argument of C<--warning=CATEGORY> or C<-WCATEGORY>. -C<$OPTIONS> is C<"--warning"> or C<"-W">, C<$ARGUMENT> is C<CATEGORY>. +C<$OPTIONS> is C<"--warning"> or C<"-W">, C<@ARGUMENT> is a list of +C<CATEGORY>. -This is meant to be used as an argument to C<Getopt>. +This can be used as an argument to C<Getopt>. =cut -sub parse_warnings ($$) +sub parse_warnings ($@) { - my ($opt, $categories) = @_; + my ($opt, @categories) = @_; - foreach my $cat (split (',', $categories)) + foreach my $cat (map { split ',' } @categories) { msg 'unsupported', "unknown warning category '$cat'" if switch_warning $cat; @@ -426,3 +440,20 @@ Written by Alexandre Duret-Lutz E<lt>F<a...@gnu.org>E<gt>. =cut 1; + +### Setup "GNU" style for perl-mode and cperl-mode. +## Local Variables: +## perl-indent-level: 2 +## perl-continued-statement-offset: 2 +## perl-continued-brace-offset: 0 +## perl-brace-offset: 0 +## perl-brace-imaginary-offset: 0 +## perl-label-offset: -2 +## cperl-indent-level: 2 +## cperl-brace-offset: 0 +## cperl-continued-brace-offset: 0 +## cperl-label-offset: -2 +## cperl-extra-newline-before-brace: t +## cperl-merge-trailing-else: nil +## cperl-continued-statement-offset: 2 +## End: -- 2.28.0