From 83d7976fb25025797ed1271c68e5c8c148c40f91 Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Sun, 25 Apr 2010 18:26:14 +0200 Subject: [PATCH] Warning and error message formatting cleanups. * aclocal.in (parse_arguments, main): Remove trailing period or newline in error or warning messages, avoid capitalization of the first word of a message. * automake.in (check_user_variables, handle_languages) (handle_ltlibraries, scan_aclocal_m4, scan_autoconf_config_files) (scan_autoconf_files, cond_stack_if, require_file_internal) (usage, generate_makefile, parse_arguments): Likewise. * lib/Automake/ChannelDefs.pm (set_strictness): Likewise. * lib/Automake/Configure_ac.pm (find_configure_ac): Likewise. * lib/Automake/Options.pm (set_strictness): Likewise. * lib/Automake/Rule.pm (define): Likewise. * lib/Automake/Variable.pm (define, variables_dump): Likewise. * tests/ltinstloc.test, tests/suffix11.test: Adjust expected error message. * lib/Automake/Channels.pm (setup_channel): Reword error message to be the same as in msg. Signed-off-by: Ralf Wildenhues --- ChangeLog | 18 +++++++++++++++++ aclocal.in | 10 +++++----- automake.in | 38 ++++++++++++++++++------------------ lib/Automake/ChannelDefs.pm | 2 +- lib/Automake/Channels.pm | 2 +- lib/Automake/Configure_ac.pm | 5 +++-- lib/Automake/Options.pm | 2 +- lib/Automake/Rule.pm | 7 +++---- lib/Automake/Variable.pm | 4 ++-- tests/ltinstloc.test | 2 +- tests/suffix11.test | 4 ++-- 11 files changed, 56 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7866ba980..71b0d9bb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,23 @@ 2010-04-25 Ralf Wildenhues + Warning and error message formatting cleanups. + * aclocal.in (parse_arguments, main): Remove trailing period or + newline in error or warning messages, avoid capitalization of + the first word of a message. + * automake.in (check_user_variables, handle_languages) + (handle_ltlibraries, scan_aclocal_m4, scan_autoconf_config_files) + (scan_autoconf_files, cond_stack_if, require_file_internal) + (usage, generate_makefile, parse_arguments): Likewise. + * lib/Automake/ChannelDefs.pm (set_strictness): Likewise. + * lib/Automake/Configure_ac.pm (find_configure_ac): Likewise. + * lib/Automake/Options.pm (set_strictness): Likewise. + * lib/Automake/Rule.pm (define): Likewise. + * lib/Automake/Variable.pm (define, variables_dump): Likewise. + * tests/ltinstloc.test, tests/suffix11.test: Adjust expected + error message. + * lib/Automake/Channels.pm (setup_channel): Reword error message + to be the same as in msg. + Fix placing of ellipses in English text and synopses. * Makefile.am: Be sure to add a space before `...' in natural language text. diff --git a/aclocal.in b/aclocal.in index 964a1b50b..06d69ed87 100644 --- a/aclocal.in +++ b/aclocal.in @@ -981,13 +981,13 @@ sub parse_arguments () } if (exists $argopts{$ARGV[0]}) { - fatal ("option `$ARGV[0]' requires an argument\n" - . "Try `$0 --help' for more information."); + fatal ("option `$ARGV[0]' requires an argument.\n" + . "Try `$0 --help' for more information"); } else { fatal ("unrecognized option `$ARGV[0]'\n" - . "Try `$0 --help' for more information."); + . "Try `$0 --help' for more information"); } } @@ -1008,7 +1008,7 @@ sub parse_arguments () if ($install && !@user_includes) { fatal ("--install should copy macros in the directory indicated by the" - . "\nfirst -I option, but no -I was supplied."); + . "\nfirst -I option, but no -I was supplied"); } if (! -d $system_includes[0]) @@ -1059,7 +1059,7 @@ my $loop = 0; while (1) { ++$loop; - prog_error "Too many loops." if $loop > 2; + prog_error "too many loops" if $loop > 2; reset_maps; scan_m4_files; diff --git a/automake.in b/automake.in index 33e584655..05b871169 100644 --- a/automake.in +++ b/automake.in @@ -1327,7 +1327,7 @@ sub check_user_variables (@) msg_cond_var ('gnu', $cond, $flag, "`$flag' is a user variable, " . "you should not override it;\n" - . "use `AM_$flag' instead."); + . "use `AM_$flag' instead"); } } } @@ -1587,7 +1587,7 @@ sub handle_languages my $srcdir = dirname ($source); if ($lang->ansi && $obj =~ /\$U/) { - prog_error "`$obj' contains \$U, but `$source' doesn't." + prog_error "`$obj' contains \$U, but `$source' doesn't" if $source !~ /\$U/; (my $source_ = $source) =~ s/\$U/_/g; @@ -2894,7 +2894,7 @@ sub handle_ltlibraries my $onlyone = ($dir ne $adir) ? ("\nLibtool libraries can be built for only one " - . "destination.") : ""; + . "destination") : ""; error ($liblocations{$val}{$acond}, "... and should also be $adirtxt$adircond.$onlyone"); @@ -4133,7 +4133,7 @@ sub scan_aclocal_m4 () push (@ac_deps, '$(ACLOCAL_M4_SOURCES)'); msg_var ('obsolete', 'ACLOCAL_M4_SOURCES', "`ACLOCAL_M4_SOURCES' is obsolete.\n" - . "It should be safe to simply remove it."); + . "It should be safe to simply remove it"); } # Note that it might be possible that aclocal.m4 doesn't exist but @@ -5225,8 +5225,8 @@ sub scan_autoconf_config_files ($$) my ($local, @rest) = split (/:/); @rest = ("$local.in",) unless @rest; msg ('portability', $where, - "Omit leading `./' from config file names such as `$local'," - . "\nas not all make implementations treat `file' and `./file' equally.") + "omit leading `./' from config file names such as `$local'," + . "\nas not all make implementations treat `file' and `./file' equally") if ($local =~ /^\.\//); my $input = locate_am @rest; if ($input) @@ -5586,7 +5586,7 @@ sub scan_autoconf_files () . "should verify that $configure_ac invokes AM_INIT_AUTOMAKE," . "\nthat aclocal.m4 is present in the top-level directory,\n" . "and that aclocal.m4 was recently regenerated " - . "(using aclocal)."); + . "(using aclocal)"); } else { @@ -5597,7 +5597,7 @@ sub scan_autoconf_files () error ($seen_init_automake, "your implementation of AM_INIT_AUTOMAKE comes from " . "an\nold Automake version. You should recreate " . - "aclocal.m4\nwith aclocal and run automake again.\n", + "aclocal.m4\nwith aclocal and run automake again", # $? = 63 is used to indicate version mismatch to missing. exit_code => 63); } @@ -5605,9 +5605,9 @@ sub scan_autoconf_files () { error ($seen_init_automake, "no proper implementation of AM_INIT_AUTOMAKE was " . - "found,\nprobably because aclocal.m4 is missing...\n" . + "found,\nprobably because aclocal.m4 is missing.\n" . "You should run aclocal to create this file, then\n" . - "run automake again.\n"); + "run automake again"); } } } @@ -6402,7 +6402,7 @@ sub cond_stack_if ($$$) my $mac = $_am_macro_for_cond{$cond}; $text .= "\n The usual way to define `$cond' is to add "; $text .= ($mac =~ / /) ? $mac : "`$mac'"; - $text .= "\n to `$configure_ac' and run `aclocal' and `autoconf' again."; + $text .= "\n to `$configure_ac' and run `aclocal' and `autoconf' again"; # These warnings appear in Automake files (depend2.am), # so there is no need to display them more than once: $scope = US_GLOBAL; @@ -7880,7 +7880,7 @@ sub require_file_internal ($$$@) $trailer2 = "\n Consider adding the COPYING file" . " to the version control system" . "\n for your code, to avoid questions" - . " about which license your project uses."; + . " about which license your project uses"; } # Windows Perl will hang if we try to delete a @@ -7916,7 +7916,7 @@ sub require_file_internal ($$$@) # that distributes the aux dir files. error ($where, 'please rerun automake without ' . "Makefile arguments\n" - . "so $fullfile gets distributed."); + . "so $fullfile gets distributed"); } } } @@ -8323,7 +8323,7 @@ sub generate_makefile ($$) if (-e $out_file) { unlink ($out_file) - or fatal "cannot remove $out_file: $!\n"; + or fatal "cannot remove $out_file: $!"; } my $gm_file = new Automake::XFile "> $out_file"; @@ -8503,7 +8503,7 @@ sub parse_arguments () if (defined $output_directory) { - msg 'obsolete', "`--output-dir' is deprecated\n"; + msg 'obsolete', "`--output-dir' is deprecated"; } else { @@ -8530,20 +8530,20 @@ sub parse_arguments () } elsif (exists $argopts{$ARGV[0]}) { - fatal ("option `$ARGV[0]' requires an argument\n" - . "Try `$0 --help' for more information."); + fatal ("option `$ARGV[0]' requires an argument.\n" + . "Try `$0 --help' for more information"); } else { fatal ("unrecognized option `$ARGV[0]'.\n" - . "Try `$0 --help' for more information."); + . "Try `$0 --help' for more information"); } } my $errspec = 0; foreach my $arg (@ARGV) { - fatal ("empty argument\nTry `$0 --help' for more information.") + fatal ("empty argument\nTry `$0 --help' for more information") if ($arg eq ''); # Handle $local:$input syntax. diff --git a/lib/Automake/ChannelDefs.pm b/lib/Automake/ChannelDefs.pm index 26ef575f8..acb3ae8a0 100644 --- a/lib/Automake/ChannelDefs.pm +++ b/lib/Automake/ChannelDefs.pm @@ -369,7 +369,7 @@ sub set_strictness ($) } else { - prog_error "level `$name' not recognized\n"; + prog_error "level `$name' not recognized"; } } diff --git a/lib/Automake/Channels.pm b/lib/Automake/Channels.pm index 1fb2f53ac..aeed4db66 100644 --- a/lib/Automake/Channels.pm +++ b/lib/Automake/Channels.pm @@ -680,7 +680,7 @@ Override the options of C<$channel> with those specified by C<%options>. sub setup_channel ($%) { my ($name, %opts) = @_; - confess "channel $name doesn't exist" unless exists $channels{$name}; + confess "unknown channel $name" unless exists $channels{$name}; _merge_options %{$channels{$name}}, %opts; } diff --git a/lib/Automake/Configure_ac.pm b/lib/Automake/Configure_ac.pm index d5ad9776e..4f0e445a1 100644 --- a/lib/Automake/Configure_ac.pm +++ b/lib/Automake/Configure_ac.pm @@ -1,4 +1,5 @@ -# Copyright (C) 2003, 2005, 2006, 2009 Free Software Foundation, Inc. +# Copyright (C) 2003, 2005, 2006, 2009, 2010 Free Software Foundation, +# Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -80,7 +81,7 @@ sub find_configure_ac (;@) { msg ('unsupported', "`$configure_ac' and `$configure_in' both present.\n" - . "proceeding with `$configure_ac'."); + . "proceeding with `$configure_ac'"); } return $configure_ac } diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm index 0c388386d..a6d65a8eb 100644 --- a/lib/Automake/Options.pm +++ b/lib/Automake/Options.pm @@ -369,7 +369,7 @@ sub set_strictness ($) } else { - prog_error "level `$strictness_name' not recognized\n"; + prog_error "level `$strictness_name' not recognized"; } } diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm index ad63cc57e..d9d9ae026 100644 --- a/lib/Automake/Rule.pm +++ b/lib/Automake/Rule.pm @@ -1,5 +1,4 @@ -# Copyright (C) 2003, 2004, 2006, 2007, 2010 Free Software Foundation, -# Inc. +# Copyright (C) 2003, 2004, 2006, 2007, 2010 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -727,7 +726,7 @@ sub define ($$$$$) } } # Never reached. - prog_error ("Unreachable place reached."); + prog_error ("unreachable place reached"); } # Conditions for which the rule should be defined. @@ -819,7 +818,7 @@ sub define ($$$$$) # definitions of multiple inference rules. It's also # disallowed to mix plain targets with inference rules. msg ('portability', $where, - "Inference rules can have only one target before the colon (POSIX).") + "inference rules can have only one target before the colon (POSIX)") if $inference_rule_count > 0 && $target_count > 1; return @conds; diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm index af0515ef4..f75ec10b7 100644 --- a/lib/Automake/Variable.pm +++ b/lib/Automake/Variable.pm @@ -884,7 +884,7 @@ sub define ($$$$$$$$) . $def->type . "=' here ...", partial => 1); error ($where, "... and is now set with `$type=' here."); prog_error ("Automake variable assignments should be consistently\n" - . "defined with the same sign."); + . "defined with the same sign"); } # If Automake tries to override a value specified by the user, @@ -1078,7 +1078,7 @@ For debugging. sub variables_dump () { - my $text = "All variables:\n{\n"; + my $text = "all variables:\n{\n"; foreach my $var (sort { $a->name cmp $b->name } variables) { $text .= $var->dump; diff --git a/tests/ltinstloc.test b/tests/ltinstloc.test index 1b7fd83b3..18d306d9a 100755 --- a/tests/ltinstloc.test +++ b/tests/ltinstloc.test @@ -55,7 +55,7 @@ Makefile.am:2: ... and should also be installed in `lib' in condition COND. Makefile.am:4: error: liba1.la multiply defined in condition COND Makefile.am:4: `liba1.la' should be installed in `pkglib' in condition COND ... Makefile.am:2: ... and should also be installed in `lib' in condition COND. -Makefile.am:2: Libtool libraries can be built for only one destination. +Makefile.am:2: Libtool libraries can be built for only one destination END grep '^Makefile.am' stderr | diff - expected diff --git a/tests/suffix11.test b/tests/suffix11.test index e38926a62..35cb41a06 100755 --- a/tests/suffix11.test +++ b/tests/suffix11.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -48,7 +48,7 @@ $ACLOCAL $AUTOCONF # What we do is not portable. Automake should warn. AUTOMAKE_fails -a -grep 'Inference rules can have only one target before the colon' stderr +grep 'inference rules can have only one target before the colon' stderr # But this should work anyway. $AUTOMAKE -a -Wno-portability ./configure -- 2.47.2