blob: 8ea45df406ac50fcaaece48b8105271e7ddf9e80 [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:
33 return 'blue'
34 return 'grey'
35
36warnpatterns = [
37 { 'category':'make', 'severity':severity.MEDIUM, 'members':[], 'option':'',
38 'description':'make: overriding commands/ignoring old commands',
39 'patterns':[r".*: warning: overriding commands for target .+",
40 r".*: warning: ignoring old commands for target .+"] },
41 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wimplicit-function-declaration',
42 'description':'Implicit function declaration',
43 'patterns':[r".*: warning: implicit declaration of function .+"] },
44 { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'',
45 'description':'',
46 'patterns':[r".*: warning: conflicting types for '.+'"] },
47 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wtype-limits',
48 'description':'Expression always evaluates to true or false',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -070049 'patterns':[r".*: warning: comparison is always .+ due to limited range of data type",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -070050 r".*: warning: comparison of unsigned .*expression .+ is always true",
51 r".*: warning: comparison of unsigned .*expression .+ is always false"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -070052 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'',
53 'description':'Potential leak of memory, bad free, use after free',
54 'patterns':[r".*: warning: Potential leak of memory",
55 r".*: warning: Potential memory leak",
56 r".*: warning: Memory allocated by .+ should be deallocated by .+ not .+",
57 r".*: warning: 'delete' applied to a pointer that was allocated",
58 r".*: warning: Use of memory after it is freed",
59 r".*: warning: Argument to .+ is the address of .+ variable",
60 r".*: warning: Argument to free\(\) is offset by .+ of memory allocated by",
61 r".*: warning: Attempt to .+ released memory"] },
62 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'',
63 'description':'Return address of stack memory',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -070064 'patterns':[r".*: warning: Address of stack memory .+ returned to caller",
65 r".*: warning: Address of stack memory .+ will be a dangling reference"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -070066 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'',
67 'description':'Problem with vfork',
68 'patterns':[r".*: warning: This .+ is prohibited after a successful vfork",
69 r".*: warning: Call to function 'vfork' is insecure "] },
70 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'infinite-recursion',
71 'description':'Infinite recursion',
72 'patterns':[r".*: warning: all paths through this function will call itself"] },
73 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'',
74 'description':'Potential buffer overflow',
75 'patterns':[r".*: warning: Size argument is greater than .+ the destination buffer",
76 r".*: warning: Potential buffer overflow.",
77 r".*: warning: String copy function overflows destination buffer"] },
Marco Nelissen594375d2009-07-14 09:04:04 -070078 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
79 'description':'Incompatible pointer types',
80 'patterns':[r".*: warning: assignment from incompatible pointer type",
Marco Nelissen8e201962010-03-10 16:16:02 -080081 r".*: warning: return from incompatible pointer type",
Marco Nelissen594375d2009-07-14 09:04:04 -070082 r".*: warning: passing argument [0-9]+ of '.*' from incompatible pointer type",
83 r".*: warning: initialization from incompatible pointer type"] },
84 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-fno-builtin',
85 'description':'Incompatible declaration of built in function',
86 'patterns':[r".*: warning: incompatible implicit declaration of built-in function .+"] },
87 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused-parameter',
88 'description':'Unused parameter',
89 'patterns':[r".*: warning: unused parameter '.*'"] },
90 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused',
91 'description':'Unused function, variable or label',
Marco Nelissen8e201962010-03-10 16:16:02 -080092 'patterns':[r".*: warning: '.+' defined but not used",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -070093 r".*: warning: unused function '.+'",
Marco Nelissen8e201962010-03-10 16:16:02 -080094 r".*: warning: unused variable '.+'"] },
Marco Nelissen594375d2009-07-14 09:04:04 -070095 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused-value',
96 'description':'Statement with no effect',
97 'patterns':[r".*: warning: statement with no effect"] },
98 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmissing-field-initializers',
99 'description':'Missing initializer',
100 'patterns':[r".*: warning: missing initializer"] },
101 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
102 'description':'',
103 'patterns':[r".*: warning: \(near initialization for '.+'\)"] },
104 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wformat',
105 'description':'Format string does not match arguments',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700106 'patterns':[r".*: warning: format '.+' expects type '.+', but argument [0-9]+ has type '.+'",
107 r".*: warning: more '%' conversions than data arguments",
108 r".*: warning: data argument not used by format string",
109 r".*: warning: incomplete format specifier",
110 r".*: warning: format .+ expects .+ but argument .+Wformat=",
111 r".*: warning: field precision should have .+ but argument has .+Wformat",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700112 r".*: warning: format specifies type .+ but the argument has .*type .+Wformat"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700113 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wformat-extra-args',
114 'description':'Too many arguments for format string',
115 'patterns':[r".*: warning: too many arguments for format"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700116 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wformat-invalid-specifier',
117 'description':'Invalid format specifier',
118 'patterns':[r".*: warning: invalid .+ specifier '.+'.+format-invalid-specifier"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700119 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wsign-compare',
120 'description':'Comparison between signed and unsigned',
121 'patterns':[r".*: warning: comparison between signed and unsigned",
122 r".*: warning: comparison of promoted \~unsigned with unsigned",
123 r".*: warning: signed and unsigned type in conditional expression"] },
Marco Nelissen8e201962010-03-10 16:16:02 -0800124 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
125 'description':'Comparison between enum and non-enum',
126 'patterns':[r".*: warning: enumeral and non-enumeral type in conditional expression"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700127 { 'category':'libpng', 'severity':severity.MEDIUM, 'members':[], 'option':'',
128 'description':'libpng: zero area',
129 'patterns':[r".*libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area"] },
130 { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'',
131 'description':'aapt: no comment for public symbol',
132 'patterns':[r".*: warning: No comment for public symbol .+"] },
133 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmissing-braces',
134 'description':'Missing braces around initializer',
135 'patterns':[r".*: warning: missing braces around initializer.*"] },
136 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
137 'description':'No newline at end of file',
138 'patterns':[r".*: warning: no newline at end of file"] },
139 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wcast-qual',
140 'description':'Qualifier discarded',
141 'patterns':[r".*: warning: passing argument [0-9]+ of '.+' discards qualifiers from pointer target type",
142 r".*: warning: assignment discards qualifiers from pointer target type",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700143 r".*: warning: passing .+ to parameter of type .+ discards qualifiers",
144 r".*: warning: assigning to .+ from .+ discards qualifiers",
Marco Nelissen594375d2009-07-14 09:04:04 -0700145 r".*: warning: return discards qualifiers from pointer target type"] },
146 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wattributes',
147 'description':'Attribute ignored',
148 'patterns':[r".*: warning: '_*packed_*' attribute ignored"] },
149 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wattributes',
150 'description':'Visibility mismatch',
151 'patterns':[r".*: warning: '.+' declared with greater visibility than the type of its field '.+'"] },
152 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
153 'description':'Shift count greater than width of type',
154 'patterns':[r".*: warning: (left|right) shift count >= width of type"] },
155 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
156 'description':'extern &lt;foo&gt; is initialized',
157 'patterns':[r".*: warning: '.+' initialized and declared 'extern'"] },
158 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wold-style-declaration',
159 'description':'Old style declaration',
160 'patterns':[r".*: warning: 'static' is not at beginning of declaration"] },
161 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wuninitialized',
162 'description':'Variable may be used uninitialized',
163 'patterns':[r".*: warning: '.+' may be used uninitialized in this function"] },
164 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wuninitialized',
165 'description':'Variable is used uninitialized',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700166 'patterns':[r".*: warning: '.+' is used uninitialized in this function",
167 r".*: warning: variable '.+' is uninitialized when used here"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700168 { 'category':'ld', 'severity':severity.MEDIUM, 'members':[], 'option':'-fshort-enums',
169 'description':'ld: possible enum size mismatch',
170 'patterns':[r".*: warning: .* uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail"] },
171 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wpointer-sign',
172 'description':'Pointer targets differ in signedness',
173 'patterns':[r".*: warning: pointer targets in initialization differ in signedness",
174 r".*: warning: pointer targets in assignment differ in signedness",
175 r".*: warning: pointer targets in return differ in signedness",
176 r".*: warning: pointer targets in passing argument [0-9]+ of '.+' differ in signedness"] },
177 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wstrict-overflow',
178 'description':'Assuming overflow does not occur',
179 'patterns':[r".*: warning: assuming signed overflow does not occur when assuming that .* is always (true|false)"] },
180 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wempty-body',
181 'description':'Suggest adding braces around empty body',
182 'patterns':[r".*: warning: suggest braces around empty body in an 'if' statement",
183 r".*: warning: empty body in an if-statement",
184 r".*: warning: suggest braces around empty body in an 'else' statement",
185 r".*: warning: empty body in an else-statement"] },
186 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wparentheses',
187 'description':'Suggest adding parentheses',
188 'patterns':[r".*: warning: suggest explicit braces to avoid ambiguous 'else'",
189 r".*: warning: suggest parentheses around arithmetic in operand of '.+'",
190 r".*: warning: suggest parentheses around comparison in operand of '.+'",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700191 r".*: warning: logical not is only applied to the left hand side of this comparison",
192 r".*: warning: using the result of an assignment as a condition without parentheses",
193 r".*: warning: .+ has lower precedence than .+ be evaluated first .+Wparentheses",
Marco Nelissen594375d2009-07-14 09:04:04 -0700194 r".*: warning: suggest parentheses around '.+?' .+ '.+?'",
195 r".*: warning: suggest parentheses around assignment used as truth value"] },
196 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
197 'description':'Static variable used in non-static inline function',
198 'patterns':[r".*: warning: '.+' is static but used in inline function '.+' which is not static"] },
199 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wimplicit int',
200 'description':'No type or storage class (will default to int)',
201 'patterns':[r".*: warning: data definition has no type or storage class"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700202 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
203 'description':'Null pointer',
204 'patterns':[r".*: warning: Dereference of null pointer",
205 r".*: warning: Called .+ pointer is null",
206 r".*: warning: Forming reference to null pointer",
207 r".*: warning: Returning null reference",
208 r".*: warning: Null pointer passed as an argument to a 'nonnull' parameter",
209 r".*: warning: .+ results in a null pointer dereference",
210 r".*: warning: Access to .+ results in a dereference of a null pointer",
211 r".*: warning: Null pointer argument in"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700212 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
213 'description':'',
214 'patterns':[r".*: warning: type defaults to 'int' in declaration of '.+'"] },
215 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
216 'description':'',
217 'patterns':[r".*: warning: parameter names \(without types\) in function declaration"] },
218 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wstrict-aliasing',
219 'description':'Dereferencing &lt;foo&gt; breaks strict aliasing rules',
220 'patterns':[r".*: warning: dereferencing .* break strict-aliasing rules"] },
221 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wpointer-to-int-cast',
222 'description':'Cast from pointer to integer of different size',
223 'patterns':[r".*: warning: cast from pointer to integer of different size"] },
224 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wint-to-pointer-cast',
225 'description':'Cast to pointer from integer of different size',
226 'patterns':[r".*: warning: cast to pointer from integer of different size"] },
227 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
228 'description':'Symbol redefined',
229 'patterns':[r".*: warning: "".+"" redefined"] },
230 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
231 'description':'',
232 'patterns':[r".*: warning: this is the location of the previous definition"] },
233 { 'category':'ld', 'severity':severity.MEDIUM, 'members':[], 'option':'',
234 'description':'ld: type and size of dynamic symbol are not defined',
235 'patterns':[r".*: warning: type and size of dynamic symbol `.+' are not defined"] },
236 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
237 'description':'Pointer from integer without cast',
238 'patterns':[r".*: warning: assignment makes pointer from integer without a cast"] },
239 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
240 'description':'Pointer from integer without cast',
241 'patterns':[r".*: warning: passing argument [0-9]+ of '.+' makes pointer from integer without a cast"] },
242 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
243 'description':'Integer from pointer without cast',
244 'patterns':[r".*: warning: assignment makes integer from pointer without a cast"] },
245 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
246 'description':'Integer from pointer without cast',
247 'patterns':[r".*: warning: passing argument [0-9]+ of '.+' makes integer from pointer without a cast"] },
248 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
249 'description':'Integer from pointer without cast',
250 'patterns':[r".*: warning: return makes integer from pointer without a cast"] },
251 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunknown-pragmas',
252 'description':'Ignoring pragma',
253 'patterns':[r".*: warning: ignoring #pragma .+"] },
254 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wclobbered',
255 'description':'Variable might be clobbered by longjmp or vfork',
256 'patterns':[r".*: warning: variable '.+' might be clobbered by 'longjmp' or 'vfork'"] },
257 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wclobbered',
258 'description':'Argument might be clobbered by longjmp or vfork',
259 'patterns':[r".*: warning: argument '.+' might be clobbered by 'longjmp' or 'vfork'"] },
260 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wredundant-decls',
261 'description':'Redundant declaration',
262 'patterns':[r".*: warning: redundant redeclaration of '.+'"] },
263 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
264 'description':'',
265 'patterns':[r".*: warning: previous declaration of '.+' was here"] },
266 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wswitch-enum',
267 'description':'Enum value not handled in switch',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700268 'patterns':[r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700269 { 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'-encoding',
270 'description':'Java: Non-ascii characters used, but ascii encoding specified',
271 'patterns':[r".*: warning: unmappable character for encoding ascii"] },
272 { 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'',
273 'description':'Java: Non-varargs call of varargs method with inexact argument type for last parameter',
274 'patterns':[r".*: warning: non-varargs call of varargs method with inexact argument type for last parameter"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700275 { 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'',
276 'description':'Java: Unchecked method invocation',
277 'patterns':[r".*: warning: \[unchecked\] unchecked method invocation: .+ in class .+"] },
278 { 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'',
279 'description':'Java: Unchecked conversion',
280 'patterns':[r".*: warning: \[unchecked\] unchecked conversion"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700281 { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Marco Nelissen8e201962010-03-10 16:16:02 -0800282 'description':'aapt: No default translation',
283 'patterns':[r".*: warning: string '.+' has no default translation in .*"] },
284 { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'',
285 'description':'aapt: Missing default or required localization',
286 'patterns':[r".*: warning: \*\*\*\* string '.+' has no default or required localization for '.+' in .+"] },
287 { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Marco Nelissen594375d2009-07-14 09:04:04 -0700288 'description':'aapt: String marked untranslatable, but translation exists',
289 'patterns':[r".*: warning: string '.+' in .* marked untranslatable but exists in locale '??_??'"] },
290 { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'',
291 'description':'aapt: empty span in string',
292 'patterns':[r".*: warning: empty '.+' span found in text '.+"] },
293 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
294 'description':'Taking address of temporary',
295 'patterns':[r".*: warning: taking address of temporary"] },
296 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
297 'description':'Possible broken line continuation',
298 'patterns':[r".*: warning: backslash and newline separated by space"] },
299 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Warray-bounds',
300 'description':'Array subscript out of bounds',
Marco Nelissen8e201962010-03-10 16:16:02 -0800301 'patterns':[r".*: warning: array subscript is above array bounds",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700302 r".*: warning: Array subscript is undefined",
Marco Nelissen8e201962010-03-10 16:16:02 -0800303 r".*: warning: array subscript is below array bounds"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700304 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700305 'description':'Excess elements in initializer',
306 'patterns':[r".*: warning: excess elements in .+ initializer"] },
307 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Marco Nelissen594375d2009-07-14 09:04:04 -0700308 'description':'Decimal constant is unsigned only in ISO C90',
309 'patterns':[r".*: warning: this decimal constant is unsigned only in ISO C90"] },
310 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmain',
311 'description':'main is usually a function',
312 'patterns':[r".*: warning: 'main' is usually a function"] },
313 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
314 'description':'Typedef ignored',
315 'patterns':[r".*: warning: 'typedef' was ignored in this declaration"] },
316 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Waddress',
317 'description':'Address always evaluates to true',
318 'patterns':[r".*: warning: the address of '.+' will always evaluate as 'true'"] },
319 { 'category':'C/C++', 'severity':severity.FIXMENOW, 'members':[], 'option':'',
320 'description':'Freeing a non-heap object',
321 'patterns':[r".*: warning: attempt to free a non-heap object '.+'"] },
322 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wchar-subscripts',
323 'description':'Array subscript has type char',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700324 'patterns':[r".*: warning: array subscript .+ type 'char'.+Wchar-subscripts"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700325 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
326 'description':'Constant too large for type',
327 'patterns':[r".*: warning: integer constant is too large for '.+' type"] },
328 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Woverflow',
329 'description':'Constant too large for type, truncated',
330 'patterns':[r".*: warning: large integer implicitly truncated to unsigned type"] },
331 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Woverflow',
332 'description':'Overflow in implicit constant conversion',
333 'patterns':[r".*: warning: overflow in implicit constant conversion"] },
334 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
335 'description':'Declaration does not declare anything',
336 'patterns':[r".*: warning: declaration 'class .+' does not declare anything"] },
337 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wreorder',
338 'description':'Initialization order will be different',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700339 'patterns':[r".*: warning: '.+' will be initialized after",
340 r".*: warning: field .+ will be initialized after .+Wreorder"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700341 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
342 'description':'',
343 'patterns':[r".*: warning: '.+'"] },
344 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
345 'description':'',
Marco Nelissen8e201962010-03-10 16:16:02 -0800346 'patterns':[r".*: warning: base '.+'"] },
347 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
348 'description':'',
Marco Nelissen594375d2009-07-14 09:04:04 -0700349 'patterns':[r".*: warning: when initialized here"] },
350 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmissing-parameter-type',
351 'description':'Parameter type not specified',
352 'patterns':[r".*: warning: type of '.+' defaults to 'int'"] },
353 { 'category':'gcc', 'severity':severity.MEDIUM, 'members':[], 'option':'',
354 'description':'Invalid option for C file',
355 'patterns':[r".*: warning: command line option "".+"" is valid for C\+\+\/ObjC\+\+ but not for C"] },
356 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
357 'description':'User warning',
358 'patterns':[r".*: warning: #warning "".+"""] },
359 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wextra',
360 'description':'Dereferencing void*',
361 'patterns':[r".*: warning: dereferencing 'void \*' pointer"] },
362 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wextra',
363 'description':'Comparison of pointer to zero',
364 'patterns':[r".*: warning: ordered comparison of pointer with integer zero"] },
365 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wwrite-strings',
366 'description':'Conversion of string constant to non-const char*',
367 'patterns':[r".*: warning: deprecated conversion from string constant to '.+'"] },
368 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wstrict-prototypes',
369 'description':'Function declaration isn''t a prototype',
370 'patterns':[r".*: warning: function declaration isn't a prototype"] },
371 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wignored-qualifiers',
372 'description':'Type qualifiers ignored on function return value',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700373 'patterns':[r".*: warning: type qualifiers ignored on function return type",
374 r".*: warning: .+ type qualifier .+ has no effect .+Wignored-qualifiers"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700375 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
376 'description':'&lt;foo&gt; declared inside parameter list, scope limited to this definition',
377 'patterns':[r".*: warning: '.+' declared inside parameter list"] },
378 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
379 'description':'',
380 'patterns':[r".*: warning: its scope is only this definition or declaration, which is probably not what you want"] },
381 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wcomment',
382 'description':'Line continuation inside comment',
383 'patterns':[r".*: warning: multi-line comment"] },
Marco Nelissen8e201962010-03-10 16:16:02 -0800384 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wcomment',
385 'description':'Comment inside comment',
386 'patterns':[r".*: warning: "".+"" within comment"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700387 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'',
388 'description':'Value stored is never read',
389 'patterns':[r".*: warning: Value stored to .+ is never read"] },
390 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wdeprecated-declarations',
391 'description':'Deprecated declarations',
392 'patterns':[r".*: warning: .+ is deprecated.+deprecated-declarations"] },
393 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wpointer-sign',
394 'description':'Converts between pointers to integer types with different sign',
395 'patterns':[r".*: warning: .+ converts between pointers to integer types with different sign"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700396 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
397 'description':'Extra tokens after #endif',
398 'patterns':[r".*: warning: extra tokens at end of #endif directive"] },
399 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wenum-compare',
400 'description':'Comparison between different enums',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700401 'patterns':[r".*: warning: comparison between '.+' and '.+'.+Wenum-compare"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700402 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wconversion',
403 'description':'Implicit conversion of negative number to unsigned type',
404 'patterns':[r".*: warning: converting negative value '.+' to '.+'"] },
405 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
406 'description':'Passing NULL as non-pointer argument',
Marco Nelissen5236fbd2009-07-31 08:30:34 -0700407 'patterns':[r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700408 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wctor-dtor-privacy',
409 'description':'Class seems unusable because of private ctor/dtor' ,
410 'patterns':[r".*: warning: all member functions in class '.+' are private"] },
411 # skip this next one, because it only points out some RefBase-based classes where having a private destructor is perfectly fine
412 { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'-Wctor-dtor-privacy',
413 'description':'Class seems unusable because of private ctor/dtor' ,
414 'patterns':[r".*: warning: 'class .+' only defines a private destructor and has no friends"] },
415 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wctor-dtor-privacy',
416 'description':'Class seems unusable because of private ctor/dtor' ,
417 'patterns':[r".*: warning: 'class .+' only defines private constructors and has no friends"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700418 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wgnu-static-float-init',
419 'description':'In-class initializer for static const float/double' ,
420 'patterns':[r".*: warning: in-class initializer for static data member of .+const (float|double)"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700421 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wpointer-arith',
422 'description':'void* used in arithmetic' ,
423 'patterns':[r".*: warning: pointer of type 'void \*' used in (arithmetic|subtraction)",
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700424 r".*: warning: arithmetic on .+ to void is a GNU extension.*Wpointer-arith",
Marco Nelissen594375d2009-07-14 09:04:04 -0700425 r".*: warning: wrong type argument to increment"] },
426 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wsign-promo',
427 'description':'Overload resolution chose to promote from unsigned or enum to signed type' ,
428 'patterns':[r".*: warning: passing '.+' chooses 'int' over '.* int'"] },
429 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
430 'description':'',
431 'patterns':[r".*: warning: in call to '.+'"] },
Marco Nelissen5236fbd2009-07-31 08:30:34 -0700432 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wextra',
433 'description':'Base should be explicitly initialized in copy constructor',
434 'patterns':[r".*: warning: base class '.+' should be explicitly initialized in the copy constructor"] },
435 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
436 'description':'Converting from <type> to <other type>',
437 'patterns':[r".*: warning: converting to '.+' from '.+'"] },
Marco Nelissen8e201962010-03-10 16:16:02 -0800438 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700439 'description':'VLA has zero or negative size',
440 'patterns':[r".*: warning: Declared variable-length array \(VLA\) has .+ size"] },
441 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Marco Nelissen8e201962010-03-10 16:16:02 -0800442 'description':'Return value from void function',
443 'patterns':[r".*: warning: 'return' with a value, in function returning void"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700444 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'multichar',
445 'description':'Multi-character character constant',
446 'patterns':[r".*: warning: multi-character character constant"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700447 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'writable-strings',
448 'description':'Conversion from string literal to char*',
449 'patterns':[r".*: warning: .+ does not allow conversion from string literal to 'char \*'"] },
Marco Nelissen8e201962010-03-10 16:16:02 -0800450 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'',
451 'description':'Useless specifier',
452 'patterns':[r".*: warning: useless storage class specifier in empty declaration"] },
453 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'',
454 'description':'Duplicate logtag',
455 'patterns':[r".*: warning: tag "".+"" \(None\) duplicated in .+"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700456 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'typedef-redefinition',
457 'description':'Typedef redefinition',
458 'patterns':[r".*: warning: redefinition of typedef '.+' is a C11 feature"] },
459 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'gnu-designator',
460 'description':'GNU old-style field designator',
461 'patterns':[r".*: warning: use of GNU old-style field designator extension"] },
462 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'missing-field-initializers',
463 'description':'Missing field initializers',
464 'patterns':[r".*: warning: missing field '.+' initializer"] },
465 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'missing-braces',
466 'description':'Missing braces',
467 'patterns':[r".*: warning: suggest braces around initialization of",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700468 r".*: warning: too many braces around scalar initializer .+Wmany-braces-around-scalar-init",
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700469 r".*: warning: braces around scalar initializer"] },
470 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'sign-compare',
471 'description':'Comparison of integers of different signs',
472 'patterns':[r".*: warning: comparison of integers of different signs.+sign-compare"] },
473 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'dangling-else',
474 'description':'Add braces to avoid dangling else',
475 'patterns':[r".*: warning: add explicit braces to avoid dangling else"] },
476 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'initializer-overrides',
477 'description':'Initializer overrides prior initialization',
478 'patterns':[r".*: warning: initializer overrides prior initialization of this subobject"] },
479 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'self-assign',
480 'description':'Assigning value to self',
481 'patterns':[r".*: warning: explicitly assigning value of .+ to itself"] },
482 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'gnu-variable-sized-type-not-at-end',
483 'description':'GNU extension, variable sized type not at end',
484 'patterns':[r".*: warning: field '.+' with variable sized type '.+' not at the end of a struct or class"] },
485 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'tautological-constant-out-of-range-compare',
486 'description':'Comparison of constant is always false/true',
487 'patterns':[r".*: comparison of .+ is always .+Wtautological-constant-out-of-range-compare"] },
488 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'overloaded-virtual',
489 'description':'Hides overloaded virtual function',
490 'patterns':[r".*: '.+' hides overloaded virtual function"] },
491 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'incompatible-pointer-types',
492 'description':'Incompatible pointer types',
493 'patterns':[r".*: warning: incompatible pointer types .+Wincompatible-pointer-types"] },
494 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'asm-operand-widths',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700495 'description':'ASM value size does not match register size',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700496 'patterns':[r".*: warning: value size does not match register size specified by the constraint and modifier"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700497 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'literal-suffix',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700498 'description':'Needs a space between literal and string macro',
499 'patterns':[r".*: warning: invalid suffix on literal.+ requires a space .+Wliteral-suffix"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700500 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'#warnings',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700501 'description':'Warnings from #warning',
502 'patterns':[r".*: warning: .+-W#warnings"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700503 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'absolute-value',
504 'description':'Using float/int absolute value function with int/float argument',
505 'patterns':[r".*: warning: using .+ absolute value function .+ when argument is .+ type .+Wabsolute-value"] },
506 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'',
507 'description':'Refers to implicitly defined namespace',
508 'patterns':[r".*: warning: using directive refers to implicitly-defined namespace .+"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700509
Marco Nelissen8e201962010-03-10 16:16:02 -0800510 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
511 'description':'Operator new returns NULL',
512 'patterns':[r".*: warning: 'operator new' must not return NULL unless it is declared 'throw\(\)' .+"] },
513 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
514 'description':'NULL used in arithmetic',
515 'patterns':[r".*: warning: NULL used in arithmetic"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700516 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'header-guard',
517 'description':'Misspelled header guard',
518 'patterns':[r".*: warning: '.+' is used as a header guard .+ followed by .+ different macro"] },
519 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'empty-body',
520 'description':'Empty loop body',
521 'patterns':[r".*: warning: .+ loop has empty body"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700522 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'enum-conversion',
523 'description':'Implicit conversion from enumeration type',
524 'patterns':[r".*: warning: implicit conversion from enumeration type '.+'"] },
525 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'switch',
526 'description':'case value not in enumerated type',
527 'patterns':[r".*: warning: case value not in enumerated type '.+'"] },
528 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
529 'description':'Undefined result',
530 'patterns':[r".*: warning: The result of .+ is undefined",
531 r".*: warning: 'this' pointer cannot be null in well-defined C\+\+ code;",
532 r".*: warning: shifting a negative signed value is undefined"] },
533 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
534 'description':'Division by zero',
535 'patterns':[r".*: warning: Division by zero"] },
Marco Nelissen8e201962010-03-10 16:16:02 -0800536 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
537 'description':'Use of deprecated method',
538 'patterns':[r".*: warning: '.+' is deprecated .+"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700539 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
540 'description':'Use of garbage or uninitialized value',
541 'patterns':[r".*: warning: .+ is a garbage value",
542 r".*: warning: Function call argument is an uninitialized value",
543 r".*: warning: Undefined or garbage value returned to caller",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700544 r".*: warning: Called .+ pointer is.+uninitialized",
545 r".*: warning: Called .+ pointer is.+uninitalized", # match a typo in compiler message
546 r".*: warning: Use of zero-allocated memory",
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700547 r".*: warning: Dereference of undefined pointer value",
548 r".*: warning: Passed-by-value .+ contains uninitialized data",
549 r".*: warning: Branch condition evaluates to a garbage value",
550 r".*: warning: The .+ of .+ is an uninitialized value.",
551 r".*: warning: .+ is used uninitialized whenever .+sometimes-uninitialized",
552 r".*: warning: Assigned value is garbage or undefined"] },
553 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
554 'description':'Result of malloc type incompatible with sizeof operand type',
555 'patterns':[r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"] },
556 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
557 'description':'Return value not checked',
558 'patterns':[r".*: warning: The return value from .+ is not checked"] },
559 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
560 'description':'Possible heap pollution',
561 'patterns':[r".*: warning: .*Possible heap pollution from .+ type .+"] },
562 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
563 'description':'Allocation size of 0 byte',
564 'patterns':[r".*: warning: Call to .+ has an allocation size of 0 byte"] },
565 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
566 'description':'Result of malloc type incompatible with sizeof operand type',
567 'patterns':[r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"] },
568
569 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
570 'description':'Discarded qualifier from pointer target type',
571 'patterns':[r".*: warning: .+ discards '.+' qualifier from pointer target type"] },
572 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
573 'description':'Use snprintf instead of sprintf',
574 'patterns':[r".*: warning: .*sprintf is often misused; please use snprintf"] },
575 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
576 'description':'Unsupported optimizaton flag',
577 'patterns':[r".*: warning: optimization flag '.+' is not supported"] },
578 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
579 'description':'Extra or missing parentheses',
580 'patterns':[r".*: warning: equality comparison with extraneous parentheses",
581 r".*: warning: .+ within .+Wlogical-op-parentheses"] },
582 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'mismatched-tags',
583 'description':'Mismatched class vs struct tags',
584 'patterns':[r".*: warning: '.+' defined as a .+ here but previously declared as a .+mismatched-tags",
585 r".*: warning: .+ was previously declared as a .+mismatched-tags"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700586
587 # these next ones are to deal with formatting problems resulting from the log being mixed up by 'make -j'
588 { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'',
589 'description':'',
590 'patterns':[r".*: warning: ,$"] },
591 { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'',
592 'description':'',
593 'patterns':[r".*: warning: $"] },
594 { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'',
595 'description':'',
596 'patterns':[r".*: warning: In file included from .+,"] },
597
598 # catch-all for warnings this script doesn't know about yet
599 { 'category':'C/C++', 'severity':severity.UNKNOWN, 'members':[], 'option':'',
600 'description':'Unclassified/unrecognized warnings',
601 'patterns':[r".*: warning: .+"] },
602]
603
604anchor = 0
605cur_row_color = 0
606row_colors = [ 'e0e0e0', 'd0d0d0' ]
607
608def output(text):
609 print text,
610
611def htmlbig(param):
612 return '<font size="+2">' + param + '</font>'
613
614def dumphtmlprologue(title):
615 output('<html>\n<head>\n<title>' + title + '</title>\n<body>\n')
616 output(htmlbig(title))
617 output('<p>\n')
618
619def tablerow(text):
620 global cur_row_color
621 output('<tr bgcolor="' + row_colors[cur_row_color] + '"><td colspan="2">',)
622 cur_row_color = 1 - cur_row_color
623 output(text,)
624 output('</td></tr>')
625
626def begintable(text, backgroundcolor):
627 global anchor
628 output('<table border="1" rules="cols" frame="box" width="100%" bgcolor="black"><tr bgcolor="' +
629 backgroundcolor + '"><a name="anchor' + str(anchor) + '"><td>')
630 output(htmlbig(text[0]) + '<br>')
631 for i in text[1:]:
632 output(i + '<br>')
633 output('</td>')
634 output('<td width="100" bgcolor="grey"><a align="right" href="#anchor' + str(anchor-1) +
635 '">previous</a><br><a align="right" href="#anchor' + str(anchor+1) + '">next</a>')
636 output('</td></a></tr>')
637 anchor += 1
638
639def endtable():
640 output('</table><p>')
641
642
643# dump some stats about total number of warnings and such
644def dumpstats():
645 known = 0
646 unknown = 0
647 for i in warnpatterns:
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700648 i['members'] = sorted(set(i['members']))
Marco Nelissen594375d2009-07-14 09:04:04 -0700649 if i['severity'] == severity.UNKNOWN:
650 unknown += len(i['members'])
651 elif i['severity'] != severity.SKIP:
652 known += len(i['members'])
653 output('Number of classified warnings: <b>' + str(known) + '</b><br>' )
654 output('Number of unclassified warnings: <b>' + str(unknown) + '</b><br>')
655 total = unknown + known
656 output('Total number of warnings: <b>' + str(total) + '</b>')
657 if total < 1000:
658 output('(low count may indicate incremental build)')
659 output('<p>')
660
661def allpatterns(cat):
662 pats = ''
663 for i in cat['patterns']:
664 pats += i
665 pats += ' / '
666 return pats
667
668def descriptionfor(cat):
669 if cat['description'] != '':
670 return cat['description']
671 return allpatterns(cat)
672
673
674# show which warnings no longer occur
675def dumpfixed():
676 tablestarted = False
677 for i in warnpatterns:
678 if len(i['members']) == 0 and i['severity'] != severity.SKIP:
679 if tablestarted == False:
680 tablestarted = True
681 begintable(['Fixed warnings', 'No more occurences. Please consider turning these in to errors if possible, before they are reintroduced in to the build'], 'blue')
682 tablerow(i['description'] + ' (' + allpatterns(i) + ') ' + i['option'])
683 if tablestarted:
684 endtable()
685
686
687# dump a category, provided it is not marked as 'SKIP' and has more than 0 occurrences
688def dumpcategory(cat):
689 if cat['severity'] != severity.SKIP and len(cat['members']) != 0:
690 header = [descriptionfor(cat),str(len(cat['members'])) + ' occurences:']
691 if cat['option'] != '':
692 header[1:1] = [' (related option: ' + cat['option'] +')']
693 begintable(header, colorforseverity(cat['severity']))
694 for i in cat['members']:
695 tablerow(i)
696 endtable()
697
698
699# dump everything for a given severity
700def dumpseverity(sev):
701 for i in warnpatterns:
702 if i['severity'] == sev:
703 dumpcategory(i)
704
705
706def classifywarning(line):
707 for i in warnpatterns:
Marco Nelissen2bdc7ec2009-09-29 10:19:29 -0700708 for cpat in i['compiledpatterns']:
709 if cpat.match(line):
Marco Nelissen594375d2009-07-14 09:04:04 -0700710 i['members'].append(line)
711 return
712 else:
713 # If we end up here, there was a problem parsing the log
714 # probably caused by 'make -j' mixing the output from
715 # 2 or more concurrent compiles
716 pass
717
Marco Nelissen2bdc7ec2009-09-29 10:19:29 -0700718# precompiling every pattern speeds up parsing by about 30x
719def compilepatterns():
720 for i in warnpatterns:
721 i['compiledpatterns'] = []
722 for pat in i['patterns']:
723 i['compiledpatterns'].append(re.compile(pat))
Marco Nelissen594375d2009-07-14 09:04:04 -0700724
725infile = open(sys.argv[1], 'r')
726warnings = []
727
728platformversion = 'unknown'
729targetproduct = 'unknown'
730targetvariant = 'unknown'
731linecounter = 0
732
733warningpattern = re.compile('.* warning:.*')
Marco Nelissen2bdc7ec2009-09-29 10:19:29 -0700734compilepatterns()
Marco Nelissen594375d2009-07-14 09:04:04 -0700735
736# read the log file and classify all the warnings
737lastmatchedline = ''
738for line in infile:
Marco Nelissen8e201962010-03-10 16:16:02 -0800739 # replace fancy quotes with plain ol' quotes
740 line = line.replace("‘", "'");
741 line = line.replace("’", "'");
Marco Nelissen594375d2009-07-14 09:04:04 -0700742 if warningpattern.match(line):
743 if line != lastmatchedline:
744 classifywarning(line)
745 lastmatchedline = line
746 else:
747 # save a little bit of time by only doing this for the first few lines
748 if linecounter < 50:
749 linecounter +=1
750 m = re.search('(?<=^PLATFORM_VERSION=).*', line)
751 if m != None:
752 platformversion = m.group(0)
753 m = re.search('(?<=^TARGET_PRODUCT=).*', line)
754 if m != None:
755 targetproduct = m.group(0)
756 m = re.search('(?<=^TARGET_BUILD_VARIANT=).*', line)
757 if m != None:
758 targetvariant = m.group(0)
759
760
761# dump the html output to stdout
762dumphtmlprologue('Warnings for ' + platformversion + ' - ' + targetproduct + ' - ' + targetvariant)
763dumpstats()
764dumpseverity(severity.FIXMENOW)
765dumpseverity(severity.HIGH)
766dumpseverity(severity.MEDIUM)
767dumpseverity(severity.LOW)
768dumpseverity(severity.HARMLESS)
769dumpseverity(severity.UNKNOWN)
770dumpfixed()
771