-f, --force consider all files obsolete
-o, --output=FILE save output in FILE (stdout is the default)
-W, --warnings=CATEGORY report the warnings falling in CATEGORY
+ (comma-separated list accepted)
" . Autom4te::ChannelDefs::usage . "
-d, --debug don\'t remove temporary files
-f, --force consider all files obsolete
-W, --warnings=CATEGORY report the warnings falling in CATEGORY
+ (comma-separated list accepted)
" . Autom4te::ChannelDefs::usage . "
-o, --output=FILE save output in FILE (defaults to '-', stdout)
-f, --force don't rely on cached values
-W, --warnings=CATEGORY report the warnings falling in CATEGORY
+ (comma-separated list accepted)
-l, --language=LANG specify the set of M4 macros to use
-C, --cache=DIRECTORY preserve results for future runs in DIRECTORY
--no-cache disable the cache
--no-recursive don't rebuild sub-packages
-s, --symlink with -i, install symbolic links instead of copies
-m, --make when applicable, re-run ./configure && make
- -W, --warnings=CATEGORY report the warnings falling in CATEGORY [syntax]
+ -W, --warnings=CATEGORY report the warnings falling in CATEGORY
+ (comma-separated list accepted)
" . Autom4te::ChannelDefs::usage . "
-The environment variable 'WARNINGS' is honored. Some subtools might
-support other warning types, using 'all' is encouraged.
-
Library directories:
-B, --prepend-include=DIR prepend directory DIR to search path
-I, --include=DIR append directory DIR to search path
The environment variables AUTOCONF, ACLOCAL, AUTOHEADER, AUTOM4TE,
-AUTOMAKE, AUTOPOINT, GTKDOCIZE, INTLTOOLIZE, LIBTOOLIZE, M4, and MAKE
-are honored.
+AUTOMAKE, AUTOPOINT, GTKDOCIZE, INTLTOOLIZE, LIBTOOLIZE, M4, MAKE,
+and WARNINGS are honored.
Report bugs to <bug-autoconf\@gnu.org>.
GNU Autoconf home page: <https://www.gnu.org/software/autoconf/>.
sub usage ()
{
- return "Warning categories include:
+ return "Warning categories are:
cross cross compilation issues
gnu GNU coding standards (default in gnu and gnits modes)
obsolete obsolete features or constructions (default)
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
+
+-W also understands:
+ all turn on all the warnings
none turn off all the warnings
- error treat warnings as errors";
+ no-CATEGORY turn off warnings in CATEGORY
+ error treat all enabled warnings as errors";
}
=item C<prog_error ($MESSAGE, [%OPTIONS])>
$location = '';
}
- confess "unknown channel $channel" unless exists $channels{$channel};
+ if (!exists $channels{$channel})
+ {
+ # This can happen as a result of e.g. m4_warn([nonsense], [message])
+ # so it should not crash.
+ report_bad_channel($channel, $location);
+ $channel = 'syntax';
+ }
my %opts = %{$channels{$channel}};
_merge_options (%opts, %options);
}
}
+sub report_bad_channel ($$)
+{
+ my ($channel, $location) = @_;
+ my $message;
+ my $report_as = 'error';
+
+ # quotemeta is both too aggressive (e.g. it escapes '-') and
+ # too generous (it turns control characters into \ + themselves,
+ # not into symbolic escapes).
+ my $q_channel = $channel;
+ $q_channel =~ s/(?=[\"\$\'\@\`\\])/\\/g;
+ $q_channel =~ s/([^\x20-\x7e])/sprintf('\\x%02X', ord $1)/eg;
+ $q_channel = '"' . $q_channel . '"';
+
+ if ($channel eq '' || $channel eq 'all')
+ {
+ # Prior to version 2.70, the Autoconf manual said it was valid to use
+ # "all" and the empty string as the category argument to m4_warn, so
+ # don't treat those cases as errors.
+ $report_as = 'obsolete';
+ $message = "use of $q_channel as a diagnostic category is obsolete\n";
+ $message .= "(see autom4te --help for a list of valid categories)";
+ }
+ elsif ($channel eq 'none'
+ || ($channel =~ /^no-/ && exists $channels{substr($channel, 3)}))
+ {
+ # Also recognize "none" and "no-[category]", as someone might have
+ # thought anything acceptable to -W is also acceptable to m4_warn.
+ # Note: m4_warn([error], [...]) does actually issue an error.
+ $message = "-W accepts $q_channel, but it is not a diagnostic category";
+ }
+ else
+ {
+ $message = "unknown diagnostic category " . $q_channel;
+ }
+
+ msg $report_as, $location, $message;
+}
+
=item C<setup_channel ($channel, %options)>
## --------- ##
AT_SETUP([m4@&t@_warn])
+AT_KEYWORDS([m4@&t@_warn])
AT_DATA_M4SUGAR([script.4s],
[[m4_init
AT_CLEANUP
+## ----------------------------------------------- ##
+## Bad m4_warn categories (Autoconf bug #110872). ##
+## ----------------------------------------------- ##
+
+AT_SETUP([m4@&t@_warn (bad categories)])
+AT_KEYWORDS([m4@&t@_warn])
+
+AT_DATA_M4SUGAR([script.4s],
+[[m4_init
+m4_warn([], [empty category])dnl
+m4_warn([bogus], [invalid category])dnl
+m4_warn([!"\ %^&*], [line noise category])dnl " unconfuse editor
+m4_warn([all], ['all' used as a category])dnl
+m4_warn([none], ['none' used as a category])dnl
+m4_warn([no-syntax], ['no-syntax' used as a category])dnl
+m4_warn([no-bogus], ['no-bogus' used as a category])dnl
+m4_warn([error], [oddly enough, this works])dnl
+]])
+
+AT_CHECK_M4SUGAR([-o- -Wnone], 1, [],
+[script.4s:3: error: unknown diagnostic category "bogus"
+script.4s:4: error: unknown diagnostic category "!\"\\\x09%^&*"
+script.4s:6: error: -W accepts "none", but it is not a diagnostic category
+script.4s:7: error: -W accepts "no-syntax", but it is not a diagnostic category
+script.4s:8: error: unknown diagnostic category "no-bogus"
+script.4s:9: error: oddly enough, this works
+])
+
+AT_CHECK_M4SUGAR([-o- -Wnone,obsolete], 1, [],
+[script.4s:2: warning: use of "" as a diagnostic category is obsolete
+script.4s:2: (see autom4te --help for a list of valid categories)
+script.4s:3: error: unknown diagnostic category "bogus"
+script.4s:4: error: unknown diagnostic category "!\"\\\x09%^&*"
+script.4s:5: warning: use of "all" as a diagnostic category is obsolete
+script.4s:5: (see autom4te --help for a list of valid categories)
+script.4s:6: error: -W accepts "none", but it is not a diagnostic category
+script.4s:7: error: -W accepts "no-syntax", but it is not a diagnostic category
+script.4s:8: error: unknown diagnostic category "no-bogus"
+script.4s:9: error: oddly enough, this works
+])
+
+AT_CHECK_M4SUGAR([-o- -Wnone,obsolete,syntax], 1, [],
+[script.4s:2: warning: use of "" as a diagnostic category is obsolete
+script.4s:2: (see autom4te --help for a list of valid categories)
+script.4s:2: warning: empty category
+script.4s:3: error: unknown diagnostic category "bogus"
+script.4s:3: warning: invalid category
+script.4s:4: error: unknown diagnostic category "!\"\\\x09%^&*"
+script.4s:4: warning: line noise category
+script.4s:5: warning: use of "all" as a diagnostic category is obsolete
+script.4s:5: (see autom4te --help for a list of valid categories)
+script.4s:5: warning: 'all' used as a category
+script.4s:6: error: -W accepts "none", but it is not a diagnostic category
+script.4s:6: warning: 'none' used as a category
+script.4s:7: error: -W accepts "no-syntax", but it is not a diagnostic category
+script.4s:7: warning: 'no-syntax' used as a category
+script.4s:8: error: unknown diagnostic category "no-bogus"
+script.4s:8: warning: 'no-bogus' used as a category
+script.4s:9: error: oddly enough, this works
+])
+
+AT_CLEANUP
## ----------------- ##
## m4_divert_stack. ##