summaryrefslogtreecommitdiff
path: root/lib/Automake/Channels.pm
diff options
context:
space:
mode:
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>2010-04-11 21:04:13 +0200
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>2010-04-11 21:04:13 +0200
commitbda8d57b6af0bf3dfe2524514304856a16766b7d (patch)
tree2e829100bd955a45b43cd51190c4488a0d0a58d3 /lib/Automake/Channels.pm
parent483b962ed7e87600ee0f1581a15f747ea8195452 (diff)
downloadautomake-bda8d57b6af0bf3dfe2524514304856a16766b7d.tar.gz
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. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Diffstat (limited to 'lib/Automake/Channels.pm')
-rw-r--r--lib/Automake/Channels.pm21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/Automake/Channels.pm b/lib/Automake/Channels.pm
index 050ba05fd..b08b90db0 100644
--- a/lib/Automake/Channels.pm
+++ b/lib/Automake/Channels.pm
@@ -204,10 +204,14 @@ C<US_LOCAL>, and C<US_GLOBAL> constants above.
=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>
@@ -399,20 +403,24 @@ sub _format_sub_message ($$)
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]);
@@ -421,8 +429,7 @@ sub _format_message ($$%)
else
{
$location ||= $me;
- $msg = _format_sub_message ("$location: ", $opts{'header'}
- . $message . $opts{'footer'});
+ $msg = _format_sub_message ("$location: ", $msg);
}
return $msg;
}
@@ -484,10 +491,6 @@ sub _dequeue ($)
}
-# 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.