From: Zack Weinberg Date: Fri, 11 Sep 2020 18:23:10 +0000 (-0400) Subject: Sync ChannelDefs.pm from autoconf. X-Git-Tag: v1.16.3~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ab9ef6cf1825eded75153c556d933639314bde65;p=thirdparty%2Fautomake.git Sync ChannelDefs.pm from autoconf. 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. --- 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: . 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). 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 + +Constructs compromising the cross-compilation of the package. + =item C Warnings related to GNU Coding Standards. @@ -115,6 +119,14 @@ variables (silent by default). Warnings about non-portable constructs. +=item C + +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 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 -Display warning categories. +Return the warning category descriptions. =cut sub usage () { - print < @@ -258,7 +271,7 @@ sub verb ($;%) =item C If C<$CATEGORY> is C, turn on channel C. -If it's C, turn C off. +If it is C, turn C off. Else handle C and C for completeness. =cut @@ -349,21 +362,22 @@ sub parse_WARNINGS () } } -=item C +=item C Parse the argument of C<--warning=CATEGORY> or C<-WCATEGORY>. -C<$OPTIONS> is C<"--warning"> or C<"-W">, C<$ARGUMENT> is C. +C<$OPTIONS> is C<"--warning"> or C<"-W">, C<@ARGUMENT> is a list of +C. -This is meant to be used as an argument to C. +This can be used as an argument to C. =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 EFE. =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: