Skip to content

Commit 06f907a

Browse files
authored
Improved location and context for certain messages: more actionable. (#360)
Signed-off-by: Henry Cox <[email protected]>
1 parent d881ef9 commit 06f907a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/lcovutil.pm

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4666,10 +4666,12 @@ sub define_function
46664666
#TraceFile::is_language('c', $self->filename()) &&
46674667
$data->line() != $start_line
46684668
) {
4669+
$location = '"' . $self->filename() . '":' . $start_line
4670+
unless defined($location);
46694671
lcovutil::ignorable_error($lcovutil::ERROR_INCONSISTENT_DATA,
4670-
(defined($location) ? "$location: " : '') .
4671-
"duplicate function '$fnName' starts on line $start_line but previous definition started on "
4672-
. $data->line() . '.')
4672+
"$location: duplicate function '$fnName' starts on line $start_line but previous definition started on "
4673+
. $data->line()
4674+
. MessageContext::context() . '.')
46734675
unless
46744676
grep({ $fnName =~ $_ } @lcovutil::suppress_function_patterns);
46754677
# if ignored, just return the function we already have -
@@ -4698,7 +4700,8 @@ sub define_function
46984700
" -> "
46994701
.
47004702
(defined($end_line) ? $end_line :
4701-
'undef'))
4703+
'undef') .
4704+
MessageContext::context())
47024705
unless
47034706
grep({ $fnName =~ $_ } @lcovutil::suppress_function_patterns);
47044707
# pick the highest end line if we didn't error out

0 commit comments

Comments
 (0)