@@ -424,8 +424,8 @@ if ($gcov_version >= (9 << 16) &&
424
424
if ($intermediate ) {
425
425
info(" Using intermediate gcov format\n " );
426
426
if ($opt_derive_func_data ) {
427
- warn ( " --derive-func-data is not compatible with " .
428
- " intermediate format - ignoring \n " );
427
+ lcovutil::ignorable_error( $lcovutil::ERROR_USAGE ,
428
+ " --derive-func-data is not compatible with intermediate format " );
429
429
$opt_derive_func_data = 0;
430
430
}
431
431
if ($lcovutil::exclude_exception_branch && !$gcov_caps -> {' json-format' }) {
@@ -578,7 +578,8 @@ foreach my $dir (@lcovutil::internal_dirs) {
578
578
}
579
579
580
580
if ($initial && $lcovutil::br_coverage && !$intermediate ) {
581
- warn (" --initial does not generate branch coverage data\n " );
581
+ lcovutil::ignorable_error($lcovutil::ERROR_USAGE ,
582
+ " --initial does not generate branch coverage data" );
582
583
}
583
584
584
585
# where to write parallel child data
@@ -1018,6 +1019,11 @@ sub gen_info(@)
1018
1019
my %files ;
1019
1020
my $total = 0;
1020
1021
foreach my $directory (@_ ) {
1022
+ unless (-e $directory ) {
1023
+ lcovutil::ignorable_error($lcovutil::ERROR_USAGE ,
1024
+ " no such file or directory '$directory '" );
1025
+ next ;
1026
+ }
1021
1027
if (-d $directory ) {
1022
1028
info(" Scanning $directory for $ext files ...\n " );
1023
1029
@@ -1040,22 +1046,37 @@ sub gen_info(@)
1040
1046
# keep track of directory where we found the file
1041
1047
foreach my $entry (@found ) {
1042
1048
if (exists ($files {$entry })) {
1043
- warn (" duplicate file $directory in both $directory and " .
1044
- $files {$entry } . " \n " );
1049
+ lcovutil::ignorable_error(
1050
+ $lcovutil::ERROR_USAGE ,
1051
+ " duplicate file $entry in both $files {$entry } and $directory "
1052
+ .
1053
+ (lcovutil::is_ignored($lcovutil::ERROR_USAGE ) ?
1054
+ ' (skip latter)' :
1055
+ ' ' ));
1056
+ next ;
1045
1057
} else {
1046
1058
++$total ;
1047
1059
}
1048
1060
$files {$entry } = $directory ;
1049
1061
}
1050
1062
} else {
1051
- die (" no such file or directory '$directory '" )
1052
- unless (-e $directory );
1063
+ my ($name , $d , $e ) = fileparse($directory , qr /\. [^.]*/ );
1064
+ if ($e ne $ext ) {
1065
+ lcovutil::ignorable_error($lcovutil::ERROR_USAGE ,
1066
+ " $directory has unsupported extension: expected '$ext '" .
1067
+ ($initial ? " for initial capture" : " " ));
1068
+ next ;
1069
+ }
1053
1070
# use the directory where we find the file as the base dir
1054
- my $d = dirname($directory );
1055
-
1056
1071
if (exists ($files {$directory })) {
1057
- warn (" duplicate file $directory in both $d and " .
1058
- $files {$directory } . " \n " );
1072
+ lcovutil::ignorable_error(
1073
+ $lcovutil::ERROR_USAGE ,
1074
+ " duplicate file $directory in both $files {$directory } and $d "
1075
+ .
1076
+ (lcovutil::is_ignored($lcovutil::ERROR_USAGE ) ?
1077
+ ' (skip latter)' :
1078
+ ' ' ));
1079
+ next ;
1059
1080
} else {
1060
1081
++$total ;
1061
1082
}
@@ -1098,9 +1119,6 @@ sub gen_info(@)
1098
1119
lcovutil::info(2, " schedule %s in %d \n " , $filename , scalar (@worklist ));
1099
1120
# find the corresponding gcno file...
1100
1121
my ($name , $d , $e ) = fileparse($filename , qr /\. [^.]*/ );
1101
- die (" unexpected extension '$e ': should be $ext " .
1102
- ($initial ? " for initial capture" : " " ))
1103
- unless ($e eq $ext );
1104
1122
my ($gcda_file , $gcno_file );
1105
1123
if ($initial ) {
1106
1124
$gcno_file = $filename ;
0 commit comments