-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathccwarn.pm
94 lines (84 loc) · 3.08 KB
/
ccwarn.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
sub initwarn {
#
# Read a list of regexes of patterns we ignore and will not count nor
# show as compiler error/warnings
#
open(IGNORE, "<ignores") || return;
while(<IGNORE>) {
if($_ =~ /^\#/) {
next;
}
chomp $_;
if($_) {
push @ig, $_;
}
}
close(IGNORE);
return 0;
}
# given an input line it returns TRUE if it is a CC compiler warning/error
sub checkwarn {
my ($l)=@_;
# gcc warning:
if (($l =~ /^([.\/\\:a-zA-Z0-9-_]*)\.[ch]:([0-9:]*): (warning|error)/) ||
# AIX xlc warnings:
($l =~ /\"([_.\/a-zA-Z0-9]+)\", line/) ||
# Tru64 DEC/Compaq C compiler:
($l =~ /^cc: ((Warning)|(Error)|(Severe))?: ([.\/a-zA-Z0-9]*)/) ||
# MIPSPro C 7.3:
($l =~ /cc: (REMARK|WARNING|ERROR) File/) ||
# Intel icc 8.0:
($l =~ /: (remark|warning|error) \#/) ||
# Intel icc 10.1:
($l =~ /\(([0-9][0-9]*)\): (error)?: /) ||
# Intel icc linker:
($l =~ /: warning: warning: /) ||
# MIPS o32 compiler:
($l =~ /^cfe: (Warning |Error)(\d*):/) ||
# MSVC
($l =~ /^[\.\\]*([.\\\/a-zA-Z0-9-_]*)\.[chy]\(([0-9:]*)\) *: /) ||
# Clang warnings not caught elsewhere:
($l =~ /^clang: warning: /) ||
($l =~ /^warning: unknown warning option /) ||
# libtool 2 prefixes lots of "normal" lines with "libool: link: " so we
# cannot use that simple rule to detect errors. Adding "warning:" reduces
# false positives but skip some legitimate warnings that do not contain
# "warning:".
($l =~ /^libtool: \w+: warning:/) ||
($l =~ /^libtool: link:.*cannot find the library/) ||
($l =~ /^libtool: link:.*is not a valid libtool object/) ||
($l =~ /Warning: .* library needs some functionality/) ||
($l =~ /Warning: .* does not have real file for/) ||
# curl tool detecting libcurl violating CURL_MAX_WRITE_SIZE
($l =~ /Warning: .* exceeds single call write limit/) ||
# torture test leaving test server unresponsive
($l =~ /server precheck FAILED /) ||
# NetWare's nlmconv linker
($l =~ /^nlmconv:/) ||
# GNU and MIPS ld error
($l =~ /^[^ ?*]*ld((32)|(64))?: /) ||
# Wine runtime problems
($l =~ /^fixme:.*:.*[sS][tT][uU][bB]/) ||
($l =~ /^fixme:.*:.*[sS][uU][pP][pP][oO][rR][tT]/) ||
# AC_MSG_WARN output in configure script
($l =~ /configure: WARNING: .*compiler options rejected/) ||
($l =~ /configure: WARNING: .*cannot determine strerror_r/) ||
($l =~ /configure: WARNING: .*cannot determine non-blocking/) ||
# problem in runtests.pl script
($l =~ /runtests\.pl line/) ||
# autoconf overquoting in configure script
($l =~ /configure: .*command not found/))
{
my $re;
foreach $re (@ig) {
if($l =~ /$re/) {
# a line to ignore
return 0;
}
}
return 1;
}
# not a warning or error
return 0;
}
1;