blob: bb3b08d987f6732ffd80dc5da8725f4ba8b1c0d7 [file] [log] [blame]
Marco Nelissen594375d2009-07-14 09:04:04 -07001#!/usr/bin/env python
Marco Nelissen8e201962010-03-10 16:16:02 -08002# This file uses the following encoding: utf-8
Marco Nelissen594375d2009-07-14 09:04:04 -07003
4import sys
5import re
6
7if len(sys.argv) == 1:
8 print 'usage: ' + sys.argv[0] + ' <build.log>'
9 sys.exit()
10
11# if you add another level, don't forget to give it a color below
12class severity:
13 UNKNOWN=0
14 SKIP=100
15 FIXMENOW=1
16 HIGH=2
17 MEDIUM=3
18 LOW=4
19 HARMLESS=5
20
21def colorforseverity(sev):
22 if sev == severity.FIXMENOW:
23 return 'fuchsia'
24 if sev == severity.HIGH:
25 return 'red'
26 if sev == severity.MEDIUM:
27 return 'orange'
28 if sev == severity.LOW:
29 return 'yellow'
30 if sev == severity.HARMLESS:
31 return 'limegreen'
32 if sev == severity.UNKNOWN:
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -070033 return 'lightblue'
Marco Nelissen594375d2009-07-14 09:04:04 -070034 return 'grey'
35
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -070036def headerforseverity(sev):
37 if sev == severity.FIXMENOW:
38 return 'Critical warnings, fix me now'
39 if sev == severity.HIGH:
40 return 'High severity warnings'
41 if sev == severity.MEDIUM:
42 return 'Medium severity warnings'
43 if sev == severity.LOW:
44 return 'Low severity warnings'
45 if sev == severity.HARMLESS:
46 return 'Harmless warnings'
47 if sev == severity.UNKNOWN:
48 return 'Unknown warnings'
49 return 'Unhandled warnings'
50
Marco Nelissen594375d2009-07-14 09:04:04 -070051warnpatterns = [
52 { 'category':'make', 'severity':severity.MEDIUM, 'members':[], 'option':'',
53 'description':'make: overriding commands/ignoring old commands',
54 'patterns':[r".*: warning: overriding commands for target .+",
55 r".*: warning: ignoring old commands for target .+"] },
56 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wimplicit-function-declaration',
57 'description':'Implicit function declaration',
58 'patterns':[r".*: warning: implicit declaration of function .+"] },
59 { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'',
60 'description':'',
61 'patterns':[r".*: warning: conflicting types for '.+'"] },
62 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wtype-limits',
63 'description':'Expression always evaluates to true or false',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -070064 'patterns':[r".*: warning: comparison is always .+ due to limited range of data type",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -070065 r".*: warning: comparison of unsigned .*expression .+ is always true",
66 r".*: warning: comparison of unsigned .*expression .+ is always false"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -070067 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'',
68 'description':'Potential leak of memory, bad free, use after free',
69 'patterns':[r".*: warning: Potential leak of memory",
70 r".*: warning: Potential memory leak",
71 r".*: warning: Memory allocated by .+ should be deallocated by .+ not .+",
72 r".*: warning: 'delete' applied to a pointer that was allocated",
73 r".*: warning: Use of memory after it is freed",
74 r".*: warning: Argument to .+ is the address of .+ variable",
75 r".*: warning: Argument to free\(\) is offset by .+ of memory allocated by",
76 r".*: warning: Attempt to .+ released memory"] },
77 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'',
78 'description':'Return address of stack memory',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -070079 'patterns':[r".*: warning: Address of stack memory .+ returned to caller",
80 r".*: warning: Address of stack memory .+ will be a dangling reference"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -070081 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'',
82 'description':'Problem with vfork',
83 'patterns':[r".*: warning: This .+ is prohibited after a successful vfork",
84 r".*: warning: Call to function 'vfork' is insecure "] },
85 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'infinite-recursion',
86 'description':'Infinite recursion',
87 'patterns':[r".*: warning: all paths through this function will call itself"] },
88 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'',
89 'description':'Potential buffer overflow',
90 'patterns':[r".*: warning: Size argument is greater than .+ the destination buffer",
91 r".*: warning: Potential buffer overflow.",
92 r".*: warning: String copy function overflows destination buffer"] },
Marco Nelissen594375d2009-07-14 09:04:04 -070093 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
94 'description':'Incompatible pointer types',
95 'patterns':[r".*: warning: assignment from incompatible pointer type",
Marco Nelissen8e201962010-03-10 16:16:02 -080096 r".*: warning: return from incompatible pointer type",
Marco Nelissen594375d2009-07-14 09:04:04 -070097 r".*: warning: passing argument [0-9]+ of '.*' from incompatible pointer type",
98 r".*: warning: initialization from incompatible pointer type"] },
99 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-fno-builtin',
100 'description':'Incompatible declaration of built in function',
101 'patterns':[r".*: warning: incompatible implicit declaration of built-in function .+"] },
102 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused-parameter',
103 'description':'Unused parameter',
104 'patterns':[r".*: warning: unused parameter '.*'"] },
105 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused',
106 'description':'Unused function, variable or label',
Marco Nelissen8e201962010-03-10 16:16:02 -0800107 'patterns':[r".*: warning: '.+' defined but not used",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700108 r".*: warning: unused function '.+'",
Marco Nelissen8e201962010-03-10 16:16:02 -0800109 r".*: warning: unused variable '.+'"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700110 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused-value',
111 'description':'Statement with no effect',
112 'patterns':[r".*: warning: statement with no effect"] },
113 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmissing-field-initializers',
114 'description':'Missing initializer',
115 'patterns':[r".*: warning: missing initializer"] },
116 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
117 'description':'',
118 'patterns':[r".*: warning: \(near initialization for '.+'\)"] },
119 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wformat',
120 'description':'Format string does not match arguments',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700121 'patterns':[r".*: warning: format '.+' expects type '.+', but argument [0-9]+ has type '.+'",
122 r".*: warning: more '%' conversions than data arguments",
123 r".*: warning: data argument not used by format string",
124 r".*: warning: incomplete format specifier",
125 r".*: warning: format .+ expects .+ but argument .+Wformat=",
126 r".*: warning: field precision should have .+ but argument has .+Wformat",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700127 r".*: warning: format specifies type .+ but the argument has .*type .+Wformat"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700128 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wformat-extra-args',
129 'description':'Too many arguments for format string',
130 'patterns':[r".*: warning: too many arguments for format"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700131 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wformat-invalid-specifier',
132 'description':'Invalid format specifier',
133 'patterns':[r".*: warning: invalid .+ specifier '.+'.+format-invalid-specifier"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700134 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wsign-compare',
135 'description':'Comparison between signed and unsigned',
136 'patterns':[r".*: warning: comparison between signed and unsigned",
137 r".*: warning: comparison of promoted \~unsigned with unsigned",
138 r".*: warning: signed and unsigned type in conditional expression"] },
Marco Nelissen8e201962010-03-10 16:16:02 -0800139 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
140 'description':'Comparison between enum and non-enum',
141 'patterns':[r".*: warning: enumeral and non-enumeral type in conditional expression"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700142 { 'category':'libpng', 'severity':severity.MEDIUM, 'members':[], 'option':'',
143 'description':'libpng: zero area',
144 'patterns':[r".*libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area"] },
145 { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'',
146 'description':'aapt: no comment for public symbol',
147 'patterns':[r".*: warning: No comment for public symbol .+"] },
148 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmissing-braces',
149 'description':'Missing braces around initializer',
150 'patterns':[r".*: warning: missing braces around initializer.*"] },
151 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
152 'description':'No newline at end of file',
153 'patterns':[r".*: warning: no newline at end of file"] },
154 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wcast-qual',
155 'description':'Qualifier discarded',
156 'patterns':[r".*: warning: passing argument [0-9]+ of '.+' discards qualifiers from pointer target type",
157 r".*: warning: assignment discards qualifiers from pointer target type",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700158 r".*: warning: passing .+ to parameter of type .+ discards qualifiers",
159 r".*: warning: assigning to .+ from .+ discards qualifiers",
Marco Nelissen594375d2009-07-14 09:04:04 -0700160 r".*: warning: return discards qualifiers from pointer target type"] },
161 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wattributes',
162 'description':'Attribute ignored',
163 'patterns':[r".*: warning: '_*packed_*' attribute ignored"] },
164 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wattributes',
165 'description':'Visibility mismatch',
166 'patterns':[r".*: warning: '.+' declared with greater visibility than the type of its field '.+'"] },
167 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
168 'description':'Shift count greater than width of type',
169 'patterns':[r".*: warning: (left|right) shift count >= width of type"] },
170 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
171 'description':'extern &lt;foo&gt; is initialized',
172 'patterns':[r".*: warning: '.+' initialized and declared 'extern'"] },
173 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wold-style-declaration',
174 'description':'Old style declaration',
175 'patterns':[r".*: warning: 'static' is not at beginning of declaration"] },
176 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wuninitialized',
177 'description':'Variable may be used uninitialized',
178 'patterns':[r".*: warning: '.+' may be used uninitialized in this function"] },
179 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wuninitialized',
180 'description':'Variable is used uninitialized',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700181 'patterns':[r".*: warning: '.+' is used uninitialized in this function",
182 r".*: warning: variable '.+' is uninitialized when used here"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700183 { 'category':'ld', 'severity':severity.MEDIUM, 'members':[], 'option':'-fshort-enums',
184 'description':'ld: possible enum size mismatch',
185 'patterns':[r".*: warning: .* uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail"] },
186 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wpointer-sign',
187 'description':'Pointer targets differ in signedness',
188 'patterns':[r".*: warning: pointer targets in initialization differ in signedness",
189 r".*: warning: pointer targets in assignment differ in signedness",
190 r".*: warning: pointer targets in return differ in signedness",
191 r".*: warning: pointer targets in passing argument [0-9]+ of '.+' differ in signedness"] },
192 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wstrict-overflow',
193 'description':'Assuming overflow does not occur',
194 'patterns':[r".*: warning: assuming signed overflow does not occur when assuming that .* is always (true|false)"] },
195 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wempty-body',
196 'description':'Suggest adding braces around empty body',
197 'patterns':[r".*: warning: suggest braces around empty body in an 'if' statement",
198 r".*: warning: empty body in an if-statement",
199 r".*: warning: suggest braces around empty body in an 'else' statement",
200 r".*: warning: empty body in an else-statement"] },
201 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wparentheses',
202 'description':'Suggest adding parentheses',
203 'patterns':[r".*: warning: suggest explicit braces to avoid ambiguous 'else'",
204 r".*: warning: suggest parentheses around arithmetic in operand of '.+'",
205 r".*: warning: suggest parentheses around comparison in operand of '.+'",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700206 r".*: warning: logical not is only applied to the left hand side of this comparison",
207 r".*: warning: using the result of an assignment as a condition without parentheses",
208 r".*: warning: .+ has lower precedence than .+ be evaluated first .+Wparentheses",
Marco Nelissen594375d2009-07-14 09:04:04 -0700209 r".*: warning: suggest parentheses around '.+?' .+ '.+?'",
210 r".*: warning: suggest parentheses around assignment used as truth value"] },
211 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
212 'description':'Static variable used in non-static inline function',
213 'patterns':[r".*: warning: '.+' is static but used in inline function '.+' which is not static"] },
214 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wimplicit int',
215 'description':'No type or storage class (will default to int)',
216 'patterns':[r".*: warning: data definition has no type or storage class"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700217 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
218 'description':'Null pointer',
219 'patterns':[r".*: warning: Dereference of null pointer",
220 r".*: warning: Called .+ pointer is null",
221 r".*: warning: Forming reference to null pointer",
222 r".*: warning: Returning null reference",
223 r".*: warning: Null pointer passed as an argument to a 'nonnull' parameter",
224 r".*: warning: .+ results in a null pointer dereference",
225 r".*: warning: Access to .+ results in a dereference of a null pointer",
226 r".*: warning: Null pointer argument in"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700227 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
228 'description':'',
229 'patterns':[r".*: warning: type defaults to 'int' in declaration of '.+'"] },
230 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
231 'description':'',
232 'patterns':[r".*: warning: parameter names \(without types\) in function declaration"] },
233 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wstrict-aliasing',
234 'description':'Dereferencing &lt;foo&gt; breaks strict aliasing rules',
235 'patterns':[r".*: warning: dereferencing .* break strict-aliasing rules"] },
236 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wpointer-to-int-cast',
237 'description':'Cast from pointer to integer of different size',
238 'patterns':[r".*: warning: cast from pointer to integer of different size"] },
239 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wint-to-pointer-cast',
240 'description':'Cast to pointer from integer of different size',
241 'patterns':[r".*: warning: cast to pointer from integer of different size"] },
242 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
243 'description':'Symbol redefined',
244 'patterns':[r".*: warning: "".+"" redefined"] },
245 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
246 'description':'',
247 'patterns':[r".*: warning: this is the location of the previous definition"] },
248 { 'category':'ld', 'severity':severity.MEDIUM, 'members':[], 'option':'',
249 'description':'ld: type and size of dynamic symbol are not defined',
250 'patterns':[r".*: warning: type and size of dynamic symbol `.+' are not defined"] },
251 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
252 'description':'Pointer from integer without cast',
253 'patterns':[r".*: warning: assignment makes pointer from integer without a cast"] },
254 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
255 'description':'Pointer from integer without cast',
256 'patterns':[r".*: warning: passing argument [0-9]+ of '.+' makes pointer from integer without a cast"] },
257 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
258 'description':'Integer from pointer without cast',
259 'patterns':[r".*: warning: assignment makes integer from pointer without a cast"] },
260 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
261 'description':'Integer from pointer without cast',
262 'patterns':[r".*: warning: passing argument [0-9]+ of '.+' makes integer from pointer without a cast"] },
263 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
264 'description':'Integer from pointer without cast',
265 'patterns':[r".*: warning: return makes integer from pointer without a cast"] },
266 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunknown-pragmas',
267 'description':'Ignoring pragma',
268 'patterns':[r".*: warning: ignoring #pragma .+"] },
269 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wclobbered',
270 'description':'Variable might be clobbered by longjmp or vfork',
271 'patterns':[r".*: warning: variable '.+' might be clobbered by 'longjmp' or 'vfork'"] },
272 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wclobbered',
273 'description':'Argument might be clobbered by longjmp or vfork',
274 'patterns':[r".*: warning: argument '.+' might be clobbered by 'longjmp' or 'vfork'"] },
275 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wredundant-decls',
276 'description':'Redundant declaration',
277 'patterns':[r".*: warning: redundant redeclaration of '.+'"] },
278 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
279 'description':'',
280 'patterns':[r".*: warning: previous declaration of '.+' was here"] },
281 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wswitch-enum',
282 'description':'Enum value not handled in switch',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700283 'patterns':[r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700284 { 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'-encoding',
285 'description':'Java: Non-ascii characters used, but ascii encoding specified',
286 'patterns':[r".*: warning: unmappable character for encoding ascii"] },
287 { 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'',
288 'description':'Java: Non-varargs call of varargs method with inexact argument type for last parameter',
289 'patterns':[r".*: warning: non-varargs call of varargs method with inexact argument type for last parameter"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700290 { 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'',
291 'description':'Java: Unchecked method invocation',
292 'patterns':[r".*: warning: \[unchecked\] unchecked method invocation: .+ in class .+"] },
293 { 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'',
294 'description':'Java: Unchecked conversion',
295 'patterns':[r".*: warning: \[unchecked\] unchecked conversion"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700296 { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Marco Nelissen8e201962010-03-10 16:16:02 -0800297 'description':'aapt: No default translation',
298 'patterns':[r".*: warning: string '.+' has no default translation in .*"] },
299 { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'',
300 'description':'aapt: Missing default or required localization',
301 'patterns':[r".*: warning: \*\*\*\* string '.+' has no default or required localization for '.+' in .+"] },
302 { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Marco Nelissen594375d2009-07-14 09:04:04 -0700303 'description':'aapt: String marked untranslatable, but translation exists',
304 'patterns':[r".*: warning: string '.+' in .* marked untranslatable but exists in locale '??_??'"] },
305 { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'',
306 'description':'aapt: empty span in string',
307 'patterns':[r".*: warning: empty '.+' span found in text '.+"] },
308 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
309 'description':'Taking address of temporary',
310 'patterns':[r".*: warning: taking address of temporary"] },
311 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
312 'description':'Possible broken line continuation',
313 'patterns':[r".*: warning: backslash and newline separated by space"] },
314 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Warray-bounds',
315 'description':'Array subscript out of bounds',
Marco Nelissen8e201962010-03-10 16:16:02 -0800316 'patterns':[r".*: warning: array subscript is above array bounds",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700317 r".*: warning: Array subscript is undefined",
Marco Nelissen8e201962010-03-10 16:16:02 -0800318 r".*: warning: array subscript is below array bounds"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700319 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700320 'description':'Excess elements in initializer',
321 'patterns':[r".*: warning: excess elements in .+ initializer"] },
322 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Marco Nelissen594375d2009-07-14 09:04:04 -0700323 'description':'Decimal constant is unsigned only in ISO C90',
324 'patterns':[r".*: warning: this decimal constant is unsigned only in ISO C90"] },
325 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmain',
326 'description':'main is usually a function',
327 'patterns':[r".*: warning: 'main' is usually a function"] },
328 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
329 'description':'Typedef ignored',
330 'patterns':[r".*: warning: 'typedef' was ignored in this declaration"] },
331 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Waddress',
332 'description':'Address always evaluates to true',
333 'patterns':[r".*: warning: the address of '.+' will always evaluate as 'true'"] },
334 { 'category':'C/C++', 'severity':severity.FIXMENOW, 'members':[], 'option':'',
335 'description':'Freeing a non-heap object',
336 'patterns':[r".*: warning: attempt to free a non-heap object '.+'"] },
337 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wchar-subscripts',
338 'description':'Array subscript has type char',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700339 'patterns':[r".*: warning: array subscript .+ type 'char'.+Wchar-subscripts"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700340 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
341 'description':'Constant too large for type',
342 'patterns':[r".*: warning: integer constant is too large for '.+' type"] },
343 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Woverflow',
344 'description':'Constant too large for type, truncated',
345 'patterns':[r".*: warning: large integer implicitly truncated to unsigned type"] },
346 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Woverflow',
347 'description':'Overflow in implicit constant conversion',
348 'patterns':[r".*: warning: overflow in implicit constant conversion"] },
349 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
350 'description':'Declaration does not declare anything',
351 'patterns':[r".*: warning: declaration 'class .+' does not declare anything"] },
352 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wreorder',
353 'description':'Initialization order will be different',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700354 'patterns':[r".*: warning: '.+' will be initialized after",
355 r".*: warning: field .+ will be initialized after .+Wreorder"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700356 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
357 'description':'',
358 'patterns':[r".*: warning: '.+'"] },
359 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
360 'description':'',
Marco Nelissen8e201962010-03-10 16:16:02 -0800361 'patterns':[r".*: warning: base '.+'"] },
362 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
363 'description':'',
Marco Nelissen594375d2009-07-14 09:04:04 -0700364 'patterns':[r".*: warning: when initialized here"] },
365 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmissing-parameter-type',
366 'description':'Parameter type not specified',
367 'patterns':[r".*: warning: type of '.+' defaults to 'int'"] },
368 { 'category':'gcc', 'severity':severity.MEDIUM, 'members':[], 'option':'',
369 'description':'Invalid option for C file',
370 'patterns':[r".*: warning: command line option "".+"" is valid for C\+\+\/ObjC\+\+ but not for C"] },
371 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
372 'description':'User warning',
373 'patterns':[r".*: warning: #warning "".+"""] },
374 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wextra',
375 'description':'Dereferencing void*',
376 'patterns':[r".*: warning: dereferencing 'void \*' pointer"] },
377 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wextra',
378 'description':'Comparison of pointer to zero',
379 'patterns':[r".*: warning: ordered comparison of pointer with integer zero"] },
380 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wwrite-strings',
381 'description':'Conversion of string constant to non-const char*',
382 'patterns':[r".*: warning: deprecated conversion from string constant to '.+'"] },
383 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wstrict-prototypes',
384 'description':'Function declaration isn''t a prototype',
385 'patterns':[r".*: warning: function declaration isn't a prototype"] },
386 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wignored-qualifiers',
387 'description':'Type qualifiers ignored on function return value',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700388 'patterns':[r".*: warning: type qualifiers ignored on function return type",
389 r".*: warning: .+ type qualifier .+ has no effect .+Wignored-qualifiers"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700390 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
391 'description':'&lt;foo&gt; declared inside parameter list, scope limited to this definition',
392 'patterns':[r".*: warning: '.+' declared inside parameter list"] },
393 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
394 'description':'',
395 'patterns':[r".*: warning: its scope is only this definition or declaration, which is probably not what you want"] },
396 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wcomment',
397 'description':'Line continuation inside comment',
398 'patterns':[r".*: warning: multi-line comment"] },
Marco Nelissen8e201962010-03-10 16:16:02 -0800399 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wcomment',
400 'description':'Comment inside comment',
401 'patterns':[r".*: warning: "".+"" within comment"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700402 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'',
403 'description':'Value stored is never read',
404 'patterns':[r".*: warning: Value stored to .+ is never read"] },
405 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wdeprecated-declarations',
406 'description':'Deprecated declarations',
407 'patterns':[r".*: warning: .+ is deprecated.+deprecated-declarations"] },
408 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wpointer-sign',
409 'description':'Converts between pointers to integer types with different sign',
410 'patterns':[r".*: warning: .+ converts between pointers to integer types with different sign"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700411 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
412 'description':'Extra tokens after #endif',
413 'patterns':[r".*: warning: extra tokens at end of #endif directive"] },
414 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wenum-compare',
415 'description':'Comparison between different enums',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700416 'patterns':[r".*: warning: comparison between '.+' and '.+'.+Wenum-compare"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700417 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wconversion',
418 'description':'Implicit conversion of negative number to unsigned type',
419 'patterns':[r".*: warning: converting negative value '.+' to '.+'"] },
420 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
421 'description':'Passing NULL as non-pointer argument',
Marco Nelissen5236fbd2009-07-31 08:30:34 -0700422 'patterns':[r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700423 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wctor-dtor-privacy',
424 'description':'Class seems unusable because of private ctor/dtor' ,
425 'patterns':[r".*: warning: all member functions in class '.+' are private"] },
426 # skip this next one, because it only points out some RefBase-based classes where having a private destructor is perfectly fine
427 { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'-Wctor-dtor-privacy',
428 'description':'Class seems unusable because of private ctor/dtor' ,
429 'patterns':[r".*: warning: 'class .+' only defines a private destructor and has no friends"] },
430 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wctor-dtor-privacy',
431 'description':'Class seems unusable because of private ctor/dtor' ,
432 'patterns':[r".*: warning: 'class .+' only defines private constructors and has no friends"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700433 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wgnu-static-float-init',
434 'description':'In-class initializer for static const float/double' ,
435 'patterns':[r".*: warning: in-class initializer for static data member of .+const (float|double)"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700436 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wpointer-arith',
437 'description':'void* used in arithmetic' ,
438 'patterns':[r".*: warning: pointer of type 'void \*' used in (arithmetic|subtraction)",
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700439 r".*: warning: arithmetic on .+ to void is a GNU extension.*Wpointer-arith",
Marco Nelissen594375d2009-07-14 09:04:04 -0700440 r".*: warning: wrong type argument to increment"] },
441 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wsign-promo',
442 'description':'Overload resolution chose to promote from unsigned or enum to signed type' ,
443 'patterns':[r".*: warning: passing '.+' chooses 'int' over '.* int'"] },
444 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
445 'description':'',
446 'patterns':[r".*: warning: in call to '.+'"] },
Marco Nelissen5236fbd2009-07-31 08:30:34 -0700447 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wextra',
448 'description':'Base should be explicitly initialized in copy constructor',
449 'patterns':[r".*: warning: base class '.+' should be explicitly initialized in the copy constructor"] },
450 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
451 'description':'Converting from <type> to <other type>',
452 'patterns':[r".*: warning: converting to '.+' from '.+'"] },
Marco Nelissen8e201962010-03-10 16:16:02 -0800453 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700454 'description':'VLA has zero or negative size',
455 'patterns':[r".*: warning: Declared variable-length array \(VLA\) has .+ size"] },
456 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Marco Nelissen8e201962010-03-10 16:16:02 -0800457 'description':'Return value from void function',
458 'patterns':[r".*: warning: 'return' with a value, in function returning void"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700459 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'multichar',
460 'description':'Multi-character character constant',
461 'patterns':[r".*: warning: multi-character character constant"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700462 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'writable-strings',
463 'description':'Conversion from string literal to char*',
464 'patterns':[r".*: warning: .+ does not allow conversion from string literal to 'char \*'"] },
Marco Nelissen8e201962010-03-10 16:16:02 -0800465 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'',
466 'description':'Useless specifier',
467 'patterns':[r".*: warning: useless storage class specifier in empty declaration"] },
468 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'',
469 'description':'Duplicate logtag',
470 'patterns':[r".*: warning: tag "".+"" \(None\) duplicated in .+"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700471 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'typedef-redefinition',
472 'description':'Typedef redefinition',
473 'patterns':[r".*: warning: redefinition of typedef '.+' is a C11 feature"] },
474 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'gnu-designator',
475 'description':'GNU old-style field designator',
476 'patterns':[r".*: warning: use of GNU old-style field designator extension"] },
477 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'missing-field-initializers',
478 'description':'Missing field initializers',
479 'patterns':[r".*: warning: missing field '.+' initializer"] },
480 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'missing-braces',
481 'description':'Missing braces',
482 'patterns':[r".*: warning: suggest braces around initialization of",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700483 r".*: warning: too many braces around scalar initializer .+Wmany-braces-around-scalar-init",
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700484 r".*: warning: braces around scalar initializer"] },
485 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'sign-compare',
486 'description':'Comparison of integers of different signs',
487 'patterns':[r".*: warning: comparison of integers of different signs.+sign-compare"] },
488 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'dangling-else',
489 'description':'Add braces to avoid dangling else',
490 'patterns':[r".*: warning: add explicit braces to avoid dangling else"] },
491 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'initializer-overrides',
492 'description':'Initializer overrides prior initialization',
493 'patterns':[r".*: warning: initializer overrides prior initialization of this subobject"] },
494 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'self-assign',
495 'description':'Assigning value to self',
496 'patterns':[r".*: warning: explicitly assigning value of .+ to itself"] },
497 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'gnu-variable-sized-type-not-at-end',
498 'description':'GNU extension, variable sized type not at end',
499 'patterns':[r".*: warning: field '.+' with variable sized type '.+' not at the end of a struct or class"] },
500 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'tautological-constant-out-of-range-compare',
501 'description':'Comparison of constant is always false/true',
502 'patterns':[r".*: comparison of .+ is always .+Wtautological-constant-out-of-range-compare"] },
503 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'overloaded-virtual',
504 'description':'Hides overloaded virtual function',
505 'patterns':[r".*: '.+' hides overloaded virtual function"] },
506 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'incompatible-pointer-types',
507 'description':'Incompatible pointer types',
508 'patterns':[r".*: warning: incompatible pointer types .+Wincompatible-pointer-types"] },
509 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'asm-operand-widths',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700510 'description':'ASM value size does not match register size',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700511 'patterns':[r".*: warning: value size does not match register size specified by the constraint and modifier"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700512 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'literal-suffix',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700513 'description':'Needs a space between literal and string macro',
514 'patterns':[r".*: warning: invalid suffix on literal.+ requires a space .+Wliteral-suffix"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700515 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'#warnings',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700516 'description':'Warnings from #warning',
517 'patterns':[r".*: warning: .+-W#warnings"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700518 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'absolute-value',
519 'description':'Using float/int absolute value function with int/float argument',
520 'patterns':[r".*: warning: using .+ absolute value function .+ when argument is .+ type .+Wabsolute-value"] },
521 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'',
522 'description':'Refers to implicitly defined namespace',
523 'patterns':[r".*: warning: using directive refers to implicitly-defined namespace .+"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700524
Marco Nelissen8e201962010-03-10 16:16:02 -0800525 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
526 'description':'Operator new returns NULL',
527 'patterns':[r".*: warning: 'operator new' must not return NULL unless it is declared 'throw\(\)' .+"] },
528 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
529 'description':'NULL used in arithmetic',
530 'patterns':[r".*: warning: NULL used in arithmetic"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700531 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'header-guard',
532 'description':'Misspelled header guard',
533 'patterns':[r".*: warning: '.+' is used as a header guard .+ followed by .+ different macro"] },
534 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'empty-body',
535 'description':'Empty loop body',
536 'patterns':[r".*: warning: .+ loop has empty body"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700537 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'enum-conversion',
538 'description':'Implicit conversion from enumeration type',
539 'patterns':[r".*: warning: implicit conversion from enumeration type '.+'"] },
540 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'switch',
541 'description':'case value not in enumerated type',
542 'patterns':[r".*: warning: case value not in enumerated type '.+'"] },
543 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
544 'description':'Undefined result',
545 'patterns':[r".*: warning: The result of .+ is undefined",
546 r".*: warning: 'this' pointer cannot be null in well-defined C\+\+ code;",
547 r".*: warning: shifting a negative signed value is undefined"] },
548 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
549 'description':'Division by zero',
550 'patterns':[r".*: warning: Division by zero"] },
Marco Nelissen8e201962010-03-10 16:16:02 -0800551 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
552 'description':'Use of deprecated method',
553 'patterns':[r".*: warning: '.+' is deprecated .+"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700554 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
555 'description':'Use of garbage or uninitialized value',
556 'patterns':[r".*: warning: .+ is a garbage value",
557 r".*: warning: Function call argument is an uninitialized value",
558 r".*: warning: Undefined or garbage value returned to caller",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700559 r".*: warning: Called .+ pointer is.+uninitialized",
560 r".*: warning: Called .+ pointer is.+uninitalized", # match a typo in compiler message
561 r".*: warning: Use of zero-allocated memory",
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700562 r".*: warning: Dereference of undefined pointer value",
563 r".*: warning: Passed-by-value .+ contains uninitialized data",
564 r".*: warning: Branch condition evaluates to a garbage value",
565 r".*: warning: The .+ of .+ is an uninitialized value.",
566 r".*: warning: .+ is used uninitialized whenever .+sometimes-uninitialized",
567 r".*: warning: Assigned value is garbage or undefined"] },
568 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
569 'description':'Result of malloc type incompatible with sizeof operand type',
570 'patterns':[r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"] },
571 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
572 'description':'Return value not checked',
573 'patterns':[r".*: warning: The return value from .+ is not checked"] },
574 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
575 'description':'Possible heap pollution',
576 'patterns':[r".*: warning: .*Possible heap pollution from .+ type .+"] },
577 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
578 'description':'Allocation size of 0 byte',
579 'patterns':[r".*: warning: Call to .+ has an allocation size of 0 byte"] },
580 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
581 'description':'Result of malloc type incompatible with sizeof operand type',
582 'patterns':[r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"] },
583
584 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
585 'description':'Discarded qualifier from pointer target type',
586 'patterns':[r".*: warning: .+ discards '.+' qualifier from pointer target type"] },
587 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
588 'description':'Use snprintf instead of sprintf',
589 'patterns':[r".*: warning: .*sprintf is often misused; please use snprintf"] },
590 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
591 'description':'Unsupported optimizaton flag',
592 'patterns':[r".*: warning: optimization flag '.+' is not supported"] },
593 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
594 'description':'Extra or missing parentheses',
595 'patterns':[r".*: warning: equality comparison with extraneous parentheses",
596 r".*: warning: .+ within .+Wlogical-op-parentheses"] },
597 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'mismatched-tags',
598 'description':'Mismatched class vs struct tags',
599 'patterns':[r".*: warning: '.+' defined as a .+ here but previously declared as a .+mismatched-tags",
600 r".*: warning: .+ was previously declared as a .+mismatched-tags"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700601
602 # these next ones are to deal with formatting problems resulting from the log being mixed up by 'make -j'
603 { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'',
604 'description':'',
605 'patterns':[r".*: warning: ,$"] },
606 { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'',
607 'description':'',
608 'patterns':[r".*: warning: $"] },
609 { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'',
610 'description':'',
611 'patterns':[r".*: warning: In file included from .+,"] },
612
613 # catch-all for warnings this script doesn't know about yet
614 { 'category':'C/C++', 'severity':severity.UNKNOWN, 'members':[], 'option':'',
615 'description':'Unclassified/unrecognized warnings',
616 'patterns':[r".*: warning: .+"] },
617]
618
619anchor = 0
620cur_row_color = 0
621row_colors = [ 'e0e0e0', 'd0d0d0' ]
622
623def output(text):
624 print text,
625
626def htmlbig(param):
627 return '<font size="+2">' + param + '</font>'
628
629def dumphtmlprologue(title):
630 output('<html>\n<head>\n<title>' + title + '</title>\n<body>\n')
631 output(htmlbig(title))
632 output('<p>\n')
633
634def tablerow(text):
635 global cur_row_color
636 output('<tr bgcolor="' + row_colors[cur_row_color] + '"><td colspan="2">',)
637 cur_row_color = 1 - cur_row_color
638 output(text,)
639 output('</td></tr>')
640
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -0700641def begintable(text, backgroundcolor, extraanchor):
Marco Nelissen594375d2009-07-14 09:04:04 -0700642 global anchor
643 output('<table border="1" rules="cols" frame="box" width="100%" bgcolor="black"><tr bgcolor="' +
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -0700644 backgroundcolor + '"><a name="anchor' + str(anchor) + '">')
645 if extraanchor:
646 output('<a name="' + extraanchor + '">')
647 output('<td>')
Marco Nelissen594375d2009-07-14 09:04:04 -0700648 output(htmlbig(text[0]) + '<br>')
649 for i in text[1:]:
650 output(i + '<br>')
651 output('</td>')
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -0700652 output('<td width="100" bgcolor="grey">' +
653 '<a align="right" href="#WarningTOC">top</a><br>' +
654 '<a align="right" href="#anchor' + str(anchor-1) + '">previous</a><br>' +
655 '<a align="right" href="#anchor' + str(anchor+1) + '">next</a>')
Marco Nelissen594375d2009-07-14 09:04:04 -0700656 output('</td></a></tr>')
657 anchor += 1
658
659def endtable():
660 output('</table><p>')
661
662
663# dump some stats about total number of warnings and such
664def dumpstats():
665 known = 0
666 unknown = 0
667 for i in warnpatterns:
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700668 i['members'] = sorted(set(i['members']))
Marco Nelissen594375d2009-07-14 09:04:04 -0700669 if i['severity'] == severity.UNKNOWN:
670 unknown += len(i['members'])
671 elif i['severity'] != severity.SKIP:
672 known += len(i['members'])
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -0700673 output('\nNumber of classified warnings: <b>' + str(known) + '</b><br>' )
674 output('\nNumber of unclassified warnings: <b>' + str(unknown) + '</b><br>')
Marco Nelissen594375d2009-07-14 09:04:04 -0700675 total = unknown + known
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -0700676 output('\nTotal number of warnings: <b>' + str(total) + '</b>')
Marco Nelissen594375d2009-07-14 09:04:04 -0700677 if total < 1000:
678 output('(low count may indicate incremental build)')
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -0700679 output('\n<p>\n')
680
681# dump count of warnings of a given severity in TOC
682def dumpcount(sev):
683 first = True
684 for i in warnpatterns:
685 if i['severity'] == sev and len(i['members']) > 0:
686 if first:
687 output(headerforseverity(sev) + ':\n<blockquote>' +
688 '<table border="1" frame="box" width="100%">')
689 output('<tr bgcolor="' + colorforseverity(sev) + '">' +
690 '<td><a href="#' + i['anchor'] + '">' + descriptionfor(i) +
691 ' (' + str(len(i['members'])) + ')</a></td></tr>\n')
692 first = False
693 if not first:
694 output('</table></blockquote>\n')
695
696# dump table of content, list of all warning patterns
697def dumptoc():
698 n = 1
699 output('<a name="WarningTOC"><blockquote>\n')
700 for i in warnpatterns:
701 i['anchor'] = 'Warning' + str(n)
702 n += 1
703 dumpcount(severity.FIXMENOW)
704 dumpcount(severity.HIGH)
705 dumpcount(severity.MEDIUM)
706 dumpcount(severity.LOW)
707 dumpcount(severity.HARMLESS)
708 dumpcount(severity.UNKNOWN)
709 output('</blockquote>\n<p>\n')
Marco Nelissen594375d2009-07-14 09:04:04 -0700710
711def allpatterns(cat):
712 pats = ''
713 for i in cat['patterns']:
714 pats += i
715 pats += ' / '
716 return pats
717
718def descriptionfor(cat):
719 if cat['description'] != '':
720 return cat['description']
721 return allpatterns(cat)
722
723
724# show which warnings no longer occur
725def dumpfixed():
726 tablestarted = False
727 for i in warnpatterns:
728 if len(i['members']) == 0 and i['severity'] != severity.SKIP:
729 if tablestarted == False:
730 tablestarted = True
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -0700731 begintable(['Fixed warnings', 'No more occurences. Please consider turning these in to errors if possible, before they are reintroduced in to the build'], 'blue', '')
Marco Nelissen594375d2009-07-14 09:04:04 -0700732 tablerow(i['description'] + ' (' + allpatterns(i) + ') ' + i['option'])
733 if tablestarted:
734 endtable()
735
736
737# dump a category, provided it is not marked as 'SKIP' and has more than 0 occurrences
738def dumpcategory(cat):
739 if cat['severity'] != severity.SKIP and len(cat['members']) != 0:
740 header = [descriptionfor(cat),str(len(cat['members'])) + ' occurences:']
741 if cat['option'] != '':
742 header[1:1] = [' (related option: ' + cat['option'] +')']
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -0700743 begintable(header, colorforseverity(cat['severity']), cat['anchor'])
Marco Nelissen594375d2009-07-14 09:04:04 -0700744 for i in cat['members']:
745 tablerow(i)
746 endtable()
747
748
749# dump everything for a given severity
750def dumpseverity(sev):
751 for i in warnpatterns:
752 if i['severity'] == sev:
753 dumpcategory(i)
754
755
756def classifywarning(line):
757 for i in warnpatterns:
Marco Nelissen2bdc7ec2009-09-29 10:19:29 -0700758 for cpat in i['compiledpatterns']:
759 if cpat.match(line):
Marco Nelissen594375d2009-07-14 09:04:04 -0700760 i['members'].append(line)
761 return
762 else:
763 # If we end up here, there was a problem parsing the log
764 # probably caused by 'make -j' mixing the output from
765 # 2 or more concurrent compiles
766 pass
767
Marco Nelissen2bdc7ec2009-09-29 10:19:29 -0700768# precompiling every pattern speeds up parsing by about 30x
769def compilepatterns():
770 for i in warnpatterns:
771 i['compiledpatterns'] = []
772 for pat in i['patterns']:
773 i['compiledpatterns'].append(re.compile(pat))
Marco Nelissen594375d2009-07-14 09:04:04 -0700774
775infile = open(sys.argv[1], 'r')
776warnings = []
777
778platformversion = 'unknown'
779targetproduct = 'unknown'
780targetvariant = 'unknown'
781linecounter = 0
782
783warningpattern = re.compile('.* warning:.*')
Marco Nelissen2bdc7ec2009-09-29 10:19:29 -0700784compilepatterns()
Marco Nelissen594375d2009-07-14 09:04:04 -0700785
786# read the log file and classify all the warnings
787lastmatchedline = ''
788for line in infile:
Marco Nelissen8e201962010-03-10 16:16:02 -0800789 # replace fancy quotes with plain ol' quotes
790 line = line.replace("‘", "'");
791 line = line.replace("’", "'");
Marco Nelissen594375d2009-07-14 09:04:04 -0700792 if warningpattern.match(line):
793 if line != lastmatchedline:
794 classifywarning(line)
795 lastmatchedline = line
796 else:
797 # save a little bit of time by only doing this for the first few lines
798 if linecounter < 50:
799 linecounter +=1
800 m = re.search('(?<=^PLATFORM_VERSION=).*', line)
801 if m != None:
802 platformversion = m.group(0)
803 m = re.search('(?<=^TARGET_PRODUCT=).*', line)
804 if m != None:
805 targetproduct = m.group(0)
806 m = re.search('(?<=^TARGET_BUILD_VARIANT=).*', line)
807 if m != None:
808 targetvariant = m.group(0)
809
810
811# dump the html output to stdout
812dumphtmlprologue('Warnings for ' + platformversion + ' - ' + targetproduct + ' - ' + targetvariant)
813dumpstats()
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -0700814dumptoc()
Marco Nelissen594375d2009-07-14 09:04:04 -0700815dumpseverity(severity.FIXMENOW)
816dumpseverity(severity.HIGH)
817dumpseverity(severity.MEDIUM)
818dumpseverity(severity.LOW)
819dumpseverity(severity.HARMLESS)
820dumpseverity(severity.UNKNOWN)
821dumpfixed()
822