2010-04-11 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+ Prepend type to warning, error, and fatal messages.
+ For the first part of messages of types `error' or `fatal',
+ prepend `error: ' to the message. Prepend `warning: ' to
+ warning messages, whatever the setting of -Werror.
+ * lib/Automake/Channels.pm (partial): Move up definition.
+ (_format_message): Emit `header' and `footer' strings only with
+ the first resp. last part of a set of partial messages.
+ * lib/Automake/ChannelDefs.pm: Add missing '1;' statement at the
+ end of the module.
+ (Automake::ChannelDefs): Setup warning channels with header
+ `warning: ', error and fatal messages with header `error: '.
+ * tests/condinc2.test, tests/ltinstloc.test: Adjust expected
+ error messages.
+ * tests/comment5.test: Likewise. Also, include stack notes
+ should not start with `error:'.
+ * tests/location.test: Likewise. Also, try both -Werror and
+ -Wno-error.
+ * NEWS: Update.
+ Report by Bruno Haible.
+
Fix capitalization of error messages, reword one message.
* lib/Automake/Variable.pm (define): Do not capitalize the first
word in the error message.
- "make dist" can now create lzip-compressed tarballs.
+ - Messages of types warning or error from `automake' and `aclocal' are now
+ prefixed with the respective type.
+
Bugs fixed in 1.11a:
- Lots of minor bugfixes.
ordered => 0;
register_channel 'note', type => 'debug', silent => 0;
+setup_channel_type 'warning', header => 'warning: ';
+setup_channel_type 'error', header => 'error: ';
+setup_channel_type 'fatal', header => 'error: ';
+
=head2 FUNCTIONS
=over 4
=cut
+1;
+
### Setup "GNU" style for perl-mode and cperl-mode.
## Local Variables:
## perl-indent-level: 2
=item C<header =E<gt> ''>
A string to prepend to each message emitted through this channel.
+With partial messages, only the first part will have C<header>
+prepended.
=item C<footer =E<gt> ''>
A string to append to each message emitted through this channel.
+With partial messages, only the final part will have C<footer>
+appended.
=item C<backtrace =E<gt> 0>
return $leader . join ("\n" . $leader, split ("\n", $message)) . "\n";
}
+# Store partial messages here. (See the 'partial' option.)
+use vars qw ($partial);
+$partial = '';
+
# _format_message ($LOCATION, $MESSAGE, %OPTIONS)
# -----------------------------------------------
# Format the message. Return a string ready to print.
sub _format_message ($$%)
{
my ($location, $message, %opts) = @_;
- my $msg = '';
+ my $msg = ($partial eq '' ? $opts{'header'} : '') . $message
+ . ($opts{'partial'} ? '' : $opts{'footer'});
if (ref $location)
{
# If $LOCATION is a reference, assume it's an instance of the
# Automake::Location class and display contexts.
my $loc = $location->get || $me;
- $msg = _format_sub_message ("$loc: ", $opts{'header'}
- . $message . $opts{'footer'});
+ $msg = _format_sub_message ("$loc: ", $msg);
for my $pair ($location->get_contexts)
{
$msg .= _format_sub_message ($pair->[0] . ": ", $pair->[1]);
else
{
$location ||= $me;
- $msg = _format_sub_message ("$location: ", $opts{'header'}
- . $message . $opts{'footer'});
+ $msg = _format_sub_message ("$location: ", $msg);
}
return $msg;
}
}
-# Store partial messages here. (See the 'partial' option.)
-use vars qw ($partial);
-$partial = '';
-
# _print_message ($LOCATION, $MESSAGE, %OPTIONS)
# ----------------------------------------------
# Format the message, check duplicates, and print it.
#! /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
$ACLOCAL
AUTOMAKE_fails
-grep '^Makefile.am:5: blank line following trailing backslash' stderr
+grep '^Makefile.am:5: error: blank line following trailing backslash' stderr
## Here is a second test because head comments are
EOF
AUTOMAKE_fails
-grep '^Makefile.am:2: blank line following trailing backslash' stderr
+grep '^Makefile.am:2: error: blank line following trailing backslash' stderr
## Make sure we print an 'included' stack on errors.
EOF
AUTOMAKE_fails
-grep '^Makefile.inc:2: blank line following trailing backslash' stderr
+grep '^Makefile.inc:2: error: blank line following trailing backslash' stderr
grep '^Makefile.am:1: .*included from here' stderr
+grep -v '^Makefile.am:1: .*error:' stderr
## Make sure backslashes are still allowed within a comment.
#! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003, 2009 Free Software Foundation,
-# Inc.
+# Copyright (C) 1999, 2001, 2002, 2003, 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
$ACLOCAL
AUTOMAKE_fails
-grep 'adjunct:3: too many conditionals closed' stderr
+grep 'adjunct:3: error: too many conditionals closed' stderr
cat > adjunct << 'END'
if TOBE
#! /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
END
$ACLOCAL
-AUTOMAKE_fails
+AUTOMAKE_fails -Wno-error
# Smash the useless difference of lib file locations.
sed 's,^.*lib/am/\([a-z]*\.am\),\1,' stderr >observed
cat >expected <<\EOF
-Makefile.am:12: VAR multiply defined in condition TRUE ...
+Makefile.am:12: warning: VAR multiply defined in condition TRUE ...
Makefile.am:8: ... `VAR' previously defined here
-automake: libfoo_a_OBJECTS should not be defined
+automake: error: libfoo_a_OBJECTS should not be defined
Makefile.am:3: while processing library `libfoo.a'
-automake: use `libfoo_a_LDADD', not `libfoo_a_LIBADD'
+automake: error: use `libfoo_a_LDADD', not `libfoo_a_LIBADD'
Makefile.am:3: while processing library `libfoo.a'
-library.am: deprecated feature: target `libfoo.a' overrides `libfoo.a$(EXEEXT)'
+library.am: warning: deprecated feature: target `libfoo.a' overrides `libfoo.a$(EXEEXT)'
library.am: change your target to read `libfoo.a$(EXEEXT)'
Makefile.am:3: while processing library `libfoo.a'
program.am: target `libfoo.a$(EXEEXT)' was defined here
Makefile.am:1: while processing program `libfoo.a'
-program.am: redefinition of `libfoo.a$(EXEEXT)'...
+program.am: warning: redefinition of `libfoo.a$(EXEEXT)'...
Makefile.am:1: while processing program `libfoo.a'
library.am: ... `libfoo.a' previously defined here
Makefile.am:3: while processing library `libfoo.a'
-tags.am: redefinition of `ctags'...
+tags.am: warning: redefinition of `ctags'...
program.am: ... `ctags$(EXEEXT)' previously defined here
Makefile.am:6: while processing program `ctags'
EOF
diff expected observed || Exit 1
+
+AUTOMAKE_fails -Werror
+sed 's,^.*lib/am/\([a-z]*\.am\),\1,' stderr >observed
+diff expected observed || Exit 1
+:
#!/bin/sh
-# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
# whether automake installs config.guess and config.sub.
cat >expected <<'END'
-Makefile.am:5: sub/liba2.la multiply defined in condition COND
+Makefile.am:5: error: sub/liba2.la multiply defined in condition COND
Makefile.am:5: `sub/liba2.la' should be installed below `lib' in condition COND ...
Makefile.am:2: ... and should also be installed in `lib' in condition COND.
-Makefile.am:4: liba1.la multiply defined 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.