summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/warnhist334
1 files changed, 65 insertions, 269 deletions
diff --git a/bin/warnhist b/bin/warnhist
index 499886b..90f8601 100755
--- a/bin/warnhist
+++ b/bin/warnhist
@@ -50,10 +50,11 @@ my $warn_index;
my $last_c_name;
my $last_fort_name;
my $last_fort_line;
+my $genericize = 1;
# Display usage
sub do_help {
- print "Usage: 'warnhist [-h, --help] [-t <prefix>] [-w <n>] [-W] [-f <n>] [-F] [-s <warning string list>] [-S <file string list] [-l] [-i <name list>] [file]'\n";
+ print "Usage: 'warnhist [-h, --help] [-t <prefix>] [-w <n>] [-W] [-f <n>] [-F] [-s <warning string list>] [-S <file string list] [-l] [-u] [-i <name list>] [file]'\n";
print "\t-h, --help\tDisplay this usage\n";
print "\t-t <prefix>\tTrim pathname prefix from filenames, <prefix>\n";
print "\t-w <n>\tDisplay files for a given warning index list, <n>\n";
@@ -71,6 +72,7 @@ sub do_help {
print "\t\t<file string list> is a comma separated list, with no spaces\n";
print "\t\tFor example: 'H5Fint' or 'H5Fint,H5Gnode'\n";
print "\t-l\tDisplay line nunbers for file/warning\n";
+ print "\t-u\tLeave 'unique' types in warnings, instead of genericizing them\n";
print "\t-i <name list>\tIgnore named files, <name list>\n";
print "\t\t<name list> is a comma separated list, with no spaces\n";
print "\t\tFor example: 'H5LTparse' or 'H5LTparse,H5LTanalyze'\n";
@@ -85,7 +87,7 @@ sub main::HELP_MESSAGE {
# declare the Perl command line flags/options we want to allow
my %options=();
-getopts("FWht:w:f:s:S:i:l", \%options);
+getopts("FWhut:w:f:s:S:i:l", \%options);
# Display usage, if requested
if($options{h}) {
@@ -176,6 +178,11 @@ if(exists $options{S}) {
# print @file_match_strings;
}
+# Check if warnings should stay unique and not be "genericized"
+if($options{u}) {
+ $genericize = 0;
+}
+
PARSE_LINES:
while (<>) {
my $name;
@@ -314,6 +321,9 @@ while (<>) {
$warning =~ s/‘/'/g;
$warning =~ s/’/'/g;
+#
+# These skipped messages & "genericizations" may be specific to GCC
+
# Skip supplemental warning message
next if $warning =~ /near initialization for/;
@@ -323,271 +333,54 @@ while (<>) {
# Skip GCC warning that should be a note
next if $_ =~ /\(this will be reported only once per input file\)/;
- # Eliminate "{aka <some type>}" and "{aka '<some type>'}" info
- if($warning =~ /\s(\{|\()aka '?[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\[\]\ ]*'?(\}|\))/) {
- $warning =~ s/\s(\{|\()aka '?[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\[\]\ ]*'?(\}|\))//g;
- }
+ if($genericize) {
+ # Eliminate C/C++ "{aka <some type>}" and "{aka '<some type>'}" info
+ if($warning =~ /\s(\{|\()aka '?[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\ ]*'?(\}|\))/) {
+ $warning =~ s/\s(\{|\()aka '?[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\ ]*'?(\}|\))//g;
+ }
-# print "warning = $warning\n";
- # Genericize warnings
- if($warning =~ /variable '[A-Za-z_0-9]*' set but not used.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /unused variable '[A-Za-z_0-9]*'.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /unused function '[A-Za-z_0-9]*'.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /implicit conversion from '[A-Za-z_0-9]*' to '[A-Za-z_0-9]*' when passing argument to function.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /implicit conversion from '[A-Za-z_0-9]*' to '[A-Za-z_0-9]*' to match other operand of binary expression.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /conversion to '[A-Za-z_0-9\s]*' from '[A-Za-z_0-9\s]*' may alter its value.*/) {
- $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
- } elsif($warning =~ /conversion to '[A-Za-z_0-9\s]*' from '[A-Za-z_0-9\s]*' may change the sign of the result.*/) {
- $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
- } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9\s]*' discards '[A-Za-z_0-9\s]*'.*/) {
- $warning =~ s/passing argument [0-9]*/passing argument -/g;
- $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
- } elsif($warning =~ /'[A-Za-z_0-9\s]*' defined but not used.*/) {
- $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
- } elsif($warning =~ /cast discards '[A-Za-z_0-9\(\)\s]*'.*/) {
- $warning =~ s/'[A-Za-z_0-9\(\)\s]*'/'-'/g;
- } elsif($warning =~ /size of '[A-Za-z_0-9\(\)\s\*\.]*' is [0-9]* bytes.*/) {
- $warning =~ s/is [0-9]* bytes/is - bytes/g;
- $warning =~ s/'[A-Za-z_0-9\(\)\s\*\.]*'/'-'/g;
- } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9\(\)\s]*' from incompatible.*/) {
- $warning =~ s/passing argument [0-9]*/passing argument -/g;
- $warning =~ s/'[A-Za-z_0-9\(\)\s]*'/'-'/g;
- } elsif($warning =~ /stack usage is [0-9]* bytes.*/) {
- $warning =~ s/stack usage is [0-9]*/stack usage is -/g;
- } elsif($warning =~ /stack usage might be [0-9]* bytes.*/) {
- $warning =~ s/stack usage might be [0-9]*/stack usage might be -/g;
- } elsif($warning =~ /the frame size of [0-9]* bytes is larger than [0-9]* bytes.*/) {
- $warning =~ s/the frame size of [0-9]* bytes is larger than [0-9]*/the frame size of - bytes is larger than -/g;
- } elsif($warning =~ /enumeration value '[A-Za-z_0-9\s]*' not handled in switch.*/) {
- $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
- } elsif($warning =~ /"[A-Za-z_0-9\s]*" is not defined.*/) {
- $warning =~ s/"[A-Za-z_0-9\s]*"/"-"/g;
- } elsif($warning =~ /macro "[A-Za-z_0-9\s]*" is not used.*/) {
- $warning =~ s/"[A-Za-z_0-9\s]*"/"-"/g;
- } elsif($warning =~ /unused parameter '[A-Za-z_0-9\s]*'.*/) {
- $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
- } elsif($warning =~ /request for implicit conversion from '[A-Za-z_0-9\s\*]*' to '[A-Za-z_0-9\s\<\>\[\]\(\)\*]*' not permitted in C\+\+.*/) {
- $warning =~ s/'[A-Za-z_0-9\s\*\<\>\[\]\(\)]*'/'-'/g;
- } elsif($warning =~ /no previous prototype for '[A-Za-z_0-9\s]*'.*/) {
- $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
- } elsif($warning =~ /declaration of '[A-Za-z_0-9\s]*' shadows a previous local.*/) {
- $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
- } elsif($warning =~ /cast from function call of type '[A-Za-z_0-9\s\*]*' to non-matching type '[A-Za-z_0-9\s\*]*'.*/) {
- $warning =~ s/'[A-Za-z_0-9\s\*]*'/'-'/g;
- } elsif($warning =~ /'[A-Za-z_0-9\s]*' declared '[A-Za-z_0-9\s]*' but never defined.*/) {
- $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
- } elsif($warning =~ /declaration of '[A-Za-z_0-9\s]*' shadows a global declaration.*/) {
- $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
- } elsif($warning =~ /typedef '[A-Za-z_0-9\s]*' locally defined but not used.*/) {
- $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
- } elsif($warning =~ /format '%[a-z]*' expects argument of type '[A-Za-z_0-9\s\*]*', but argument [0-9]* has type '[A-Za-z_0-9\s\*\(\),]*'.*/) {
- $warning =~ s/but argument [0-9]*/but argument -/g;
- $warning =~ s/'[%A-Za-z_0-9\s\*\(\),]*'/'-'/g;
- } elsif($warning =~ /conversion to '[A-Za-z_0-9\s]*' alters '[A-Za-z_0-9\s]*' constant value.*/) {
- $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g;
- } elsif($warning =~ /to be safe all intermediate pointers in cast from '[A-Za-z_0-9\s\*]*' to '[A-Za-z_0-9\s\*]*' must be 'const' qualified.*/) {
- $warning =~ s/'[A-Za-z_0-9\s\*]*'/'-'/g;
- } elsif($warning =~ /identifier '[A-Za-z_0-9]*' conflicts with C\+\+ keyword.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /nested extern declaration of '[A-Za-z_0-9]*'.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /Procedure '[A-Za-z_0-9]*' called with an implicit interface.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /Unused dummy argument '[A-Za-z_0-9]*'.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- $warning =~ s/\([0-9]+\)/\(-\)/g;
- } elsif($warning =~ /Unused parameter '[A-Za-z_0-9]*' declared at.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- $warning =~ s/\([0-9]+\)/\(-\)/g;
- } elsif($warning =~ /Unused variable '[A-Za-z_0-9]*' declared at.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /Inequality comparison for REAL\([0-9]*\) at.*/) {
- $warning =~ s/REAL\([0-9]*\)/REAL\(-\)/g;
- $warning =~ s/\([0-9]+\)/\(-\)/g;
- } elsif($warning =~ /Possible change of value in conversion from INTEGER\([0-9]*\) to (INTEGER|REAL)\([0-9]*\) at.*/) {
- $warning =~ s/INTEGER\([0-9]*\)/INTEGER\(-\)/g;
- $warning =~ s/REAL\([0-9]*\)/REAL\(-\)/g;
- } elsif($warning =~ /Equality comparison for REAL\([0-9]*\) at.*/) {
- $warning =~ s/REAL\([0-9]*\)/REAL\(-\)/g;
- $warning =~ s/\([0-9]+\)/\(-\)/g;
- } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' with different width due to prototype.*/) {
- $warning =~ s/passing argument [0-9]*/passing argument -/g;
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' as unsigned due to prototype.*/) {
- $warning =~ s/passing argument [0-9]*/passing argument -/g;
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' discards qualifiers from pointer target type.*/) {
- $warning =~ s/passing argument [0-9]*/passing argument -/g;
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' as floating rather than integer due to prototype.*/) {
- $warning =~ s/passing argument [0-9]*/passing argument -/g;
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' as 'float' rather than 'double' due to prototype.*/) {
- $warning =~ s/passing argument [0-9]*/passing argument -/g;
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/;
- } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9]*' as signed due to prototype.*/) {
- $warning =~ s/passing argument [0-9]*/passing argument -/g;
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /format '\%[A-Za-z0-9]*' expects type '[a-z][a-z\s\*]*', but argument [0-9]* has type '[a-z][a-z\(\)_,\s\*]*'.*/) {
- $warning =~ s/but argument [0-9]*/but argument -/g;
- $warning =~ s/'\%[A-Za-z0-9]*'/'\%-'/g;
- $warning =~ s/'[a-z][a-z_,\s\*\(\)]*'/'-'/g;
- } elsif($warning =~ /implicit declaration of function '[A-Za-z_0-9]*'.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /'[A-Za-z_\.\[\]\(\)\*\&\+0-9]+[A-Za-z_\.\[\]\(\)\*\&\+0-9\ ]*' may be used uninitialized in this function.*/) {
- $warning =~ s/'[A-Za-z_\.\[\]\(\)\*\&\+0-9]+[A-Za-z_\.\[\]\(\)\*\&\+0-9\ ]*'/'-'/g;
- } elsif($warning =~ /redundant redeclaration of '[A-Za-z_0-9]*'.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /declaration of '[A-Za-z_0-9]*' shadows a parameter.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /ISO C90 does not support the '[a-z]*' gnu_scanf length modifier.*/) {
- $warning =~ s/'[a-z]*'/'-'/g;
- } elsif($warning =~ /ISO C90 does not support the '[a-z]*' gnu_printf length modifier.*/) {
- $warning =~ s/'[a-z]*'/'-'/g;
- } elsif($warning =~ /ISO C90 does not support the '%[a-z]*' gnu_printf format.*/) {
- $warning =~ s/'%[a-z]*'/'%-'/g;
- } elsif($warning =~ /string length '[0-9]*' is greater than the length.*/) {
- $warning =~ s/string length '[0-9]*' is/string length '-' is/g;
- } elsif($warning =~ /enum conversion when passing argument [0-9]* of '[A-Za-z_0-9]*' is invalid.*/) {
- $warning =~ s/passing argument [0-9]*/passing argument -/g;
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /enum conversion from '[A-Za-z_0-9]*' to '[A-Za-z_0-9]*' in assignment is invalid in C\+\+.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /duplicate declaration of '[A-Za-z_0-9]*' is invalid in.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /Variable '[A-Za-z_0-9]*' at \([0-9]*\) is a dummy argument of the BIND\(C\) procedure '[A-Za-z_0-9]*' but may not be C interoperable.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- $warning =~ s/at \([0-9]*\)/at \(-\)/g;
- } elsif($warning =~ /Variable '[A-Za-z_0-9]*' at \([0-9]*\) may not be a C interoperable kind but it is BIND\(C\).*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- $warning =~ s/at \([0-9]*\)/at \(-\)/g;
- } elsif($warning =~ /Component '[A-Za-z_0-9]*' in derived type '[A-Za-z_0-9]*' at \([0-9]*\) may not be C interoperable, even though derived type '[A-Za-z_0-9]*' is BIND\(C\).*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- $warning =~ s/at \([0-9]*\)/at \(-\)/g;
- } elsif($warning =~ /function might be candidate for attribute '[A-Za-z_0-9]*' if it is known to return normally.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- $warning =~ s/=[A-Za-z_0-9]*\]/=-\]/g;
- } elsif($warning =~ /function might be candidate for attribute '[A-Za-z_0-9]*'.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- $warning =~ s/=[A-Za-z_0-9]*\]/=-\]/g;
- } elsif($warning =~ /passing argument [0-9]+ of '[A-Za-z_0-9]*' makes integer from pointer without a cast.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- $warning =~ s/[0-9]+/-/g;
- } elsif($warning =~ /function '[A-Za-z_0-9]*' might be a candidate for '[A-Za-z_0-9]*' format attribute.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /inlining failed in call to '[A-Za-z_0-9]*': call is unlikely and code size would grow.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*L*[dfsu]' directive writing ((between [0-9]+ and [0-9]+)|(up to [0-9]+)) bytes into a region of size ((between [0-9]+ and [0-9]+)|([0-9]+)).*/) {
- $warning =~ s/'%[0-9]*[\.\*]*[0-9]*L*[dfsu]'/'-'/g;
- $warning =~ s/[0-9]+/-/g;
- } elsif($warning =~ /'((%[0-9]*[\.\*]*[0-9]*[dfsu])|([A-Za-z_0-9\/]+))' directive output may be truncated writing ((between [0-9]+ and [0-9]+)|(up to [0-9]+)|([0-9+)|(likely 1 or more)) byte(s)? into a region of size ((between [0-9]+ and [0-9]+)|([0-9]+)).*/) {
- $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g;
- $warning =~ s/'[A-Za-z_0-9\/]+'/'-'/g;
- $warning =~ s/[0-9]+/-/g;
- } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive argument is null.*/) {
- $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g;
- } elsif($warning =~ /conversion to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' may change the sign of the result.*/) {
- $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g;
- } elsif($warning =~ /unsigned conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' changes value from '-?[0-9]+' to '[0-9]+'.*/) {
- $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g;
- $warning =~ s/'-?[0-9]+'/'-'/g;
- } elsif($warning =~ /conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' may change value.*/) {
- $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g;
- } elsif($warning =~ /overflow in conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' changes value from '-?[0-9]+' to '-?[0-9]+'.*/) {
- $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g;
- $warning =~ s/'-?[0-9]+'/'-'/g;
- } elsif($warning =~ /cast between incompatible function types from '[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*'.*/) {
- $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*'/'-'/g;
- } elsif($warning =~ /(return|initialization|assignment) discards '[A-Za-z_0-9]*' qualifier from pointer target type.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /'[A-Za-z_0-9]*' attribute on function returning '[A-Za-z_0-9]*'.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /ignoring return value of '[A-Za-z_0-9]*', declared with attribute warn_unused_result.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /passing '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' chooses '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' over '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'.*/) {
- $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g;
- } elsif($warning =~ /'[A-Za-z_\:0-9]+[A-Za-z_\:0-9\ ]*' should be initialized in the member initialization list.*/) {
- $warning =~ s/'[A-Za-z_\:0-9]+[A-Za-z_\:0-9\ ]*'/'-'/g;
- } elsif($warning =~ /\[deprecation\] [A-Za-z_0-9]*\([A-Za-z_,0-9]*\) in [A-Za-z_0-9]* has been deprecated.*/) {
- $warning =~ s/[A-Za-z_0-9]*\([A-Za-z_,0-9]*\) in [A-Za-z_0-9]*/-\(-\) in -/g;
- } elsif($warning =~ /size of '[A-Za-z_\*0-9]*' [0-9]+ bytes exceeds maximum object size [0-9]+ .*/) {
- $warning =~ s/'[A-Za-z_\*0-9]*'/'-'/g;
- $warning =~ s/[0-9]+/-/g;
- } elsif($warning =~ /'[A-Za-z_0-9]*' output truncated before terminating nul copying [0-9]+ bytes from a string of the same length.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- $warning =~ s/[0-9]+/-/g;
- } elsif($warning =~ /assignment to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' makes pointer from integer without a cast.*/) {
- $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g;
- } elsif($warning =~ /assignment to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' makes integer from pointer without a cast.*/) {
- $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g;
- } elsif($warning =~ /assignment to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from incompatible pointer type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'.*/) {
- $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g;
- } elsif($warning =~ /ignoring attribute '[a-z]*' because it conflicts with attribute '[a-z]*'.*/) {
- $warning =~ s/'[a-z]*'/'-'/g;
- } elsif($warning =~ /passing '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' to parameter of type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' discards qualifiers.*/) {
- $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g;
- } elsif($warning =~ /assigning to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' discards qualifiers.*/) {
- $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g;
- } elsif($warning =~ /unknown warning group '[A-Za-z-=]*', ignored.*/) {
- $warning =~ s/'[A-Za-z-=]*'/'-'/g;
- } elsif($warning =~ /'[A-Za-z_0-9]*' macro redefined.*/) {
- $warning =~ s/'[A-Za-z_0-9]*'/'-'/g;
- } elsif($warning =~ /"[A-Za-z_0-9]*" redefined.*/) {
- $warning =~ s/"[A-Za-z_0-9]*"/"-"/g;
- } elsif($warning =~ /incompatible (pointer|integer) to (pointer|integer) conversion assigning to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'.*/) {
- $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g;
- } elsif($warning =~ /returning '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' from a function with result type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' discards qualifiers.*/) {
- $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g;
- } elsif($warning =~ /array index [0-9]+ is past the end of the array \(which contains [0-9]+ elements\).*/) {
- $warning =~ s/[0-9]+/-/g;
- } elsif($warning =~ /array subscript [0-9]+ is above array bounds of '[A-Za-z_\*\.0-9]+[A-Za-z_\*\.\[\]0-9\ ]*'.*/) {
- $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*\.\[\]0-9\ ]*'/'-'/g;
- $warning =~ s/[0-9]+/-/g;
- } elsif($warning =~ /expression which evaluates to zero treated as a null pointer constant of type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'.*/) {
- $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g;
- } elsif($warning =~ /result of comparison of constant [0-9]+ with expression of type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' is always (true|false).*/) {
- $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g;
- $warning =~ s/[0-9]+/-/g;
- } elsif($warning =~ /initializing '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' with an expression of type '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' discards qualifiers.*/) {
- $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g;
- } elsif($warning =~ /implicit conversion from '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' to '[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*' changes value from -?[0-9]+ to -?[0-9]+.*/) {
- $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*0-9\ ]*'/'-'/g;
- $warning =~ s/-?[0-9]+/-/g;
- } elsif($warning =~ /passing '[A-Za-z_\*0-9]+[A-Za-z_\*\[\]0-9\ ]*' to parameter of type '[A-Za-z_\*0-9]+[A-Za-z_\*\[\]0-9\ ]*' converts between pointers to integer types with different sign.*/) {
- $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*\[\]0-9\ ]*'/'-'/g;
- } elsif($warning =~ /address of '[A-Za-z_\*\.0-9]+[A-Za-z_\*\.0-9\ ]*' will always evaluate to 'true'.*/) {
- $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*\.0-9\ ]*'/'-'/g;
- } elsif($warning =~ /length modifier '[A-Za-z]' results in undefined behavior or no effect with '[A-Za-z]' conversion specifier.*/) {
- $warning =~ s/'[A-Za-z]'/'-'/g;
- } elsif($warning =~ /'[A-Za-z_]+' specified bound depends on the length of the source argument.*/) {
- $warning =~ s/'[A-Za-z_]+'/'-'/g;
- } elsif($warning =~ /'[A-Za-z_]+' specified bound [0-9]+ equals destination size.*/) {
- $warning =~ s/'[A-Za-z_]+'/'-'/g;
- $warning =~ s/[0-9]+/-/g;
- } elsif($warning =~ /'[A-Za-z_]+' output may be truncated copying between [0-9]+ and [0-9]+ bytes from a string of length [0-9]+.*/) {
- $warning =~ s/'[A-Za-z_]+'/'-'/g;
- $warning =~ s/[0-9]+/-/g;
- } elsif($warning =~ /'[A-Za-z_]+' output may be truncated before the last format character.*/) {
- $warning =~ s/'[A-Za-z_]+'/'-'/g;
- } elsif($warning =~ /'[A-Za-z_]+' output truncated before terminating nul copying as many bytes from a string as its length.*/) {
- $warning =~ s/'[A-Za-z_]+'/'-'/g;
- } elsif($warning =~ /'[A-Za-z_\:0-9]+' hides overloaded virtual function.*/) {
- $warning =~ s/'[A-Za-z_\:0-9]+'/'-'/g;
- } elsif($warning =~ /'[A-Za-z_]+' storage class specifier is deprecated and incompatible with C\+\+1z.*/) {
- $warning =~ s/'[A-Za-z_]+'/'-'/g;
- } elsif($warning =~ /explicitly assigning value of variable of type '[A-Za-z_\*\.0-9]+[A-Za-z_\*\.0-9\ ]*' to itself.*/) {
- $warning =~ s/'[A-Za-z_\*0-9]+[A-Za-z_\*\.0-9\ ]*'/'-'/g;
- } elsif($warning =~ /private field '[A-Za-z_0-9]+' is not used.*/) {
- $warning =~ s/'[A-Za-z_0-9]+'/'-'/g;
- } elsif($warning =~ /field '[A-Za-z_0-9]+' will be initialized after field '[A-Za-z_0-9]+'.*/) {
- $warning =~ s/'[A-Za-z_0-9]+'/'-'/g;
+ # Genericize C/C++ '<some type>' and printf format '%<some format>' into '-'
+ if($warning =~ /'[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\ ]*'/) {
+ $warning =~ s/'[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\ ]*'/'-'/g;
+ }
+ if($warning =~ /'%[\#0\-\ \+]*[,;\:_]?[0-9\*]*\.?[0-9\*]*[hjltzL]*[aAcdeEfFgGinosuxX]'/) {
+ $warning =~ s/'%[\#0\-\ \+]*[,;\:_]?[0-9\*]*\.?[0-9\*]*[hjltzL]*[aAcdeEfFgGinosuxX]'/'-'/g;
+ }
+
+ # Genericize C/C++ "<macro>" warnings into "-"
+ if($warning =~ /"[A-Za-z_0-9]*"/) {
+ $warning =~ s/"[A-Za-z_0-9]*"/"-"/g;
+ }
+
+ # Genericize [GCC?] C/C++ warning text about suggessted attribute
+ if($warning =~ /attribute=[A-Za-z_0-9]*\]/) {
+ $warning =~ s/=[A-Za-z_0-9]*\]/=-\]/g;
+ }
+
+ # Genericize FORTRAN "at (<n>)" into "at (-)", "REAL(<n>)" into "REAL(-)",
+ # and "INTEGER(<n>)" into "INTEGER(-)"
+ if($warning =~ /.*at\s\([0-9]+\).*/) {
+ $warning =~ s/at\s\([0-9]+\)/at \(-\)/g;
+ }
+ if($warning =~ /.*REAL\([0-9]+\).*/) {
+ $warning =~ s/REAL\([0-9]+\)/REAL\(-\)/g;
+ }
+ if($warning =~ /.*INTEGER\([0-9]+\).*/) {
+ $warning =~ s/INTEGER\([0-9]+\)/INTEGER\(-\)/g;
+ }
+
+ # Genericize standalone numbers in warnings
+ if($warning =~ /\s-?[0-9]+\s/) {
+ $warning =~ s/\s-?[0-9]+\s/\ -\ /g;
+ }
+
+ # Genericize unusual GCC/G++/GFORTRAN warnings that aren't handled above
+ if($warning =~ /\[deprecation\] [A-Za-z_0-9]*\([A-Za-z_,0-9]*\) in [A-Za-z_0-9]* has been deprecated.*/) {
+ $warning =~ s/[A-Za-z_0-9]*\([A-Za-z_,0-9]*\) in [A-Za-z_0-9]*/-\(-\) in -/g;
+ }
}
# print "warning = $warning\n";
+# <end possible GCC-specific code>
# Check if we've already seen this warning on this line in this file
# (Can happen for warnings from inside header files)
@@ -662,7 +455,7 @@ print "\n# of Warnings by filename (warning type)\n";
print "========================================\n";
for my $x (sort {$file_count{$b} <=> $file_count{$a}} keys(%file_count)) {
printf ("[%3d] %4d (%2d) - %s\n", $current_file++, $file_count{$x}, scalar(keys %{$file_warn_line{$x}}), $x);
- if((exists $options{F}) || (exists $options{f})) {
+ if((exists $options{F}) || (exists $options{f}) || (exists $options{S})) {
my $curr_index = $current_file - 1;
my $match = 0;
@@ -696,9 +489,12 @@ for my $x (sort {$file_count{$b} <=> $file_count{$a}} keys(%file_count)) {
}
# Print names of files that were ignored
-print "\nIgnored filenames\n";
-print "=================\n";
-for my $x (sort keys(%ignored_files)) {
- print "$x\n";
+# Check for ignored file
+if(exists $options{i}) {
+ print "\nIgnored filenames\n";
+ print "=================\n";
+ for my $x (sort keys(%ignored_files)) {
+ print "$x\n";
+ }
}