blob: 8ae0a3cfc97e6fd464ce9ab43cc9aee8cc9138d7 [file] [log] [blame]
Chih-Hung Hsieh888d1432019-12-09 19:32:03 -08001#
2# Copyright (C) 2019 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16"""Warning patterns for C/C++ compiler, but not clang-tidy."""
17
18from severity import Severity
19
20patterns = [
21 # pylint:disable=line-too-long,g-inconsistent-quotes
22 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit-function-declaration',
23 'description': 'Implicit function declaration',
24 'patterns': [r".*: warning: implicit declaration of function .+",
25 r".*: warning: implicitly declaring library function"]},
26 {'category': 'C/C++', 'severity': Severity.SKIP,
27 'description': 'skip, conflicting types for ...',
28 'patterns': [r".*: warning: conflicting types for '.+'"]},
29 {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wtype-limits',
30 'description': 'Expression always evaluates to true or false',
31 'patterns': [r".*: warning: comparison is always .+ due to limited range of data type",
32 r".*: warning: comparison of unsigned .*expression .+ is always true",
33 r".*: warning: comparison of unsigned .*expression .+ is always false"]},
34 {'category': 'C/C++', 'severity': Severity.HIGH,
35 'description': 'Use transient memory for control value',
36 'patterns': [r".*: warning: .+Using such transient memory for the control value is .*dangerous."]},
37 {'category': 'C/C++', 'severity': Severity.HIGH,
38 'description': 'Return address of stack memory',
39 'patterns': [r".*: warning: Address of stack memory .+ returned to caller",
40 r".*: warning: Address of stack memory .+ will be a dangling reference"]},
41 {'category': 'C/C++', 'severity': Severity.HIGH, 'option': 'infinite-recursion',
42 'description': 'Infinite recursion',
43 'patterns': [r".*: warning: all paths through this function will call itself"]},
44 {'category': 'C/C++', 'severity': Severity.HIGH,
45 'description': 'Potential buffer overflow',
46 'patterns': [r".*: warning: Size argument is greater than .+ the destination buffer",
47 r".*: warning: Potential buffer overflow.",
48 r".*: warning: String copy function overflows destination buffer"]},
49 {'category': 'C/C++', 'severity': Severity.MEDIUM,
50 'description': 'Incompatible pointer types',
51 'patterns': [r".*: warning: assignment from incompatible pointer type",
52 r".*: warning: return from incompatible pointer type",
53 r".*: warning: passing argument [0-9]+ of '.*' from incompatible pointer type",
54 r".*: warning: initialization from incompatible pointer type"]},
55 {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-fno-builtin',
56 'description': 'Incompatible declaration of built in function',
57 'patterns': [r".*: warning: incompatible implicit declaration of built-in function .+"]},
58 {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wincompatible-library-redeclaration',
59 'description': 'Incompatible redeclaration of library function',
60 'patterns': [r".*: warning: incompatible redeclaration of library function .+"]},
61 {'category': 'C/C++', 'severity': Severity.HIGH,
62 'description': 'Null passed as non-null argument',
63 'patterns': [r".*: warning: Null passed to a callee that requires a non-null"]},
64 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-parameter',
65 'description': 'Unused parameter',
66 'patterns': [r".*: warning: unused parameter '.*'"]},
67 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused',
68 'description': 'Unused function, variable, label, comparison, etc.',
69 'patterns': [r".*: warning: '.+' defined but not used",
70 r".*: warning: unused function '.+'",
71 r".*: warning: unused label '.+'",
72 r".*: warning: relational comparison result unused",
73 r".*: warning: lambda capture .* is not used",
74 r".*: warning: private field '.+' is not used",
75 r".*: warning: unused variable '.+'"]},
76 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-value',
77 'description': 'Statement with no effect or result unused',
78 'patterns': [r".*: warning: statement with no effect",
79 r".*: warning: expression result unused"]},
80 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-result',
81 'description': 'Ignoreing return value of function',
82 'patterns': [r".*: warning: ignoring return value of function .+Wunused-result"]},
83 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-field-initializers',
84 'description': 'Missing initializer',
85 'patterns': [r".*: warning: missing initializer"]},
86 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wdelete-non-virtual-dtor',
87 'description': 'Need virtual destructor',
88 'patterns': [r".*: warning: delete called .* has virtual functions but non-virtual destructor"]},
89 {'category': 'cont.', 'severity': Severity.SKIP,
90 'description': 'skip, near initialization for ...',
91 'patterns': [r".*: warning: \(near initialization for '.+'\)"]},
92 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wdate-time',
93 'description': 'Expansion of data or time macro',
94 'patterns': [r".*: warning: expansion of date or time macro is not reproducible"]},
95 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wexpansion-to-defined',
96 'description': 'Macro expansion has undefined behavior',
97 'patterns': [r".*: warning: macro expansion .* has undefined behavior"]},
98 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat',
99 'description': 'Format string does not match arguments',
100 'patterns': [r".*: warning: format '.+' expects type '.+', but argument [0-9]+ has type '.+'",
101 r".*: warning: more '%' conversions than data arguments",
102 r".*: warning: data argument not used by format string",
103 r".*: warning: incomplete format specifier",
104 r".*: warning: unknown conversion type .* in format",
105 r".*: warning: format .+ expects .+ but argument .+Wformat=",
106 r".*: warning: field precision should have .+ but argument has .+Wformat",
107 r".*: warning: format specifies type .+ but the argument has .*type .+Wformat"]},
108 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat-extra-args',
109 'description': 'Too many arguments for format string',
110 'patterns': [r".*: warning: too many arguments for format"]},
111 {'category': 'C/C++', 'severity': Severity.MEDIUM,
112 'description': 'Too many arguments in call',
113 'patterns': [r".*: warning: too many arguments in call to "]},
114 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat-invalid-specifier',
115 'description': 'Invalid format specifier',
116 'patterns': [r".*: warning: invalid .+ specifier '.+'.+format-invalid-specifier"]},
117 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-compare',
118 'description': 'Comparison between signed and unsigned',
119 'patterns': [r".*: warning: comparison between signed and unsigned",
120 r".*: warning: comparison of promoted \~unsigned with unsigned",
121 r".*: warning: signed and unsigned type in conditional expression"]},
122 {'category': 'C/C++', 'severity': Severity.MEDIUM,
123 'description': 'Comparison between enum and non-enum',
124 'patterns': [r".*: warning: enumeral and non-enumeral type in conditional expression"]},
125 {'category': 'libpng', 'severity': Severity.MEDIUM,
126 'description': 'libpng: zero area',
127 'patterns': [r".*libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area"]},
128 {'category': 'aapt', 'severity': Severity.MEDIUM,
129 'description': 'aapt: no comment for public symbol',
130 'patterns': [r".*: warning: No comment for public symbol .+"]},
131 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-braces',
132 'description': 'Missing braces around initializer',
133 'patterns': [r".*: warning: missing braces around initializer.*"]},
134 {'category': 'C/C++', 'severity': Severity.HARMLESS,
135 'description': 'No newline at end of file',
136 'patterns': [r".*: warning: no newline at end of file"]},
137 {'category': 'C/C++', 'severity': Severity.HARMLESS,
138 'description': 'Missing space after macro name',
139 'patterns': [r".*: warning: missing whitespace after the macro name"]},
140 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcast-align',
141 'description': 'Cast increases required alignment',
142 'patterns': [r".*: warning: cast from .* to .* increases required alignment .*"]},
143 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wcast-qual',
144 'description': 'Qualifier discarded',
145 'patterns': [r".*: warning: passing argument [0-9]+ of '.+' discards qualifiers from pointer target type",
146 r".*: warning: assignment discards qualifiers from pointer target type",
147 r".*: warning: passing .+ to parameter of type .+ discards qualifiers",
148 r".*: warning: assigning to .+ from .+ discards qualifiers",
149 r".*: warning: initializing .+ discards qualifiers .+types-discards-qualifiers",
150 r".*: warning: return discards qualifiers from pointer target type"]},
151 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunknown-attributes',
152 'description': 'Unknown attribute',
153 'patterns': [r".*: warning: unknown attribute '.+'"]},
154 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wignored-attributes',
155 'description': 'Attribute ignored',
156 'patterns': [r".*: warning: '_*packed_*' attribute ignored",
157 r".*: warning: attribute declaration must precede definition .+ignored-attributes"]},
158 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wvisibility',
159 'description': 'Visibility problem',
160 'patterns': [r".*: warning: declaration of '.+' will not be visible outside of this function"]},
161 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wattributes',
162 'description': 'Visibility mismatch',
163 'patterns': [r".*: warning: '.+' declared with greater visibility than the type of its field '.+'"]},
164 {'category': 'C/C++', 'severity': Severity.MEDIUM,
165 'description': 'Shift count greater than width of type',
166 'patterns': [r".*: warning: (left|right) shift count >= width of type"]},
167 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wextern-initializer',
168 'description': 'extern <foo> is initialized',
169 'patterns': [r".*: warning: '.+' initialized and declared 'extern'",
170 r".*: warning: 'extern' variable has an initializer"]},
171 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wold-style-declaration',
172 'description': 'Old style declaration',
173 'patterns': [r".*: warning: 'static' is not at beginning of declaration"]},
174 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wreturn-type',
175 'description': 'Missing return value',
176 'patterns': [r".*: warning: control reaches end of non-void function"]},
177 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit-int',
178 'description': 'Implicit int type',
179 'patterns': [r".*: warning: type specifier missing, defaults to 'int'",
180 r".*: warning: type defaults to 'int' in declaration of '.+'"]},
181 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmain-return-type',
182 'description': 'Main function should return int',
183 'patterns': [r".*: warning: return type of 'main' is not 'int'"]},
184 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wuninitialized',
185 'description': 'Variable may be used uninitialized',
186 'patterns': [r".*: warning: '.+' may be used uninitialized in this function"]},
187 {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wuninitialized',
188 'description': 'Variable is used uninitialized',
189 'patterns': [r".*: warning: '.+' is used uninitialized in this function",
190 r".*: warning: variable '.+' is uninitialized when used here"]},
191 {'category': 'ld', 'severity': Severity.MEDIUM, 'option': '-fshort-enums',
192 'description': 'ld: possible enum size mismatch',
193 'patterns': [r".*: warning: .* uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail"]},
194 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-sign',
195 'description': 'Pointer targets differ in signedness',
196 'patterns': [r".*: warning: pointer targets in initialization differ in signedness",
197 r".*: warning: pointer targets in assignment differ in signedness",
198 r".*: warning: pointer targets in return differ in signedness",
199 r".*: warning: pointer targets in passing argument [0-9]+ of '.+' differ in signedness"]},
200 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-overflow',
201 'description': 'Assuming overflow does not occur',
202 'patterns': [r".*: warning: assuming signed overflow does not occur when assuming that .* is always (true|false)"]},
203 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wempty-body',
204 'description': 'Suggest adding braces around empty body',
205 'patterns': [r".*: warning: suggest braces around empty body in an 'if' statement",
206 r".*: warning: empty body in an if-statement",
207 r".*: warning: suggest braces around empty body in an 'else' statement",
208 r".*: warning: empty body in an else-statement"]},
209 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wparentheses',
210 'description': 'Suggest adding parentheses',
211 'patterns': [r".*: warning: suggest explicit braces to avoid ambiguous 'else'",
212 r".*: warning: suggest parentheses around arithmetic in operand of '.+'",
213 r".*: warning: suggest parentheses around comparison in operand of '.+'",
214 r".*: warning: logical not is only applied to the left hand side of this comparison",
215 r".*: warning: using the result of an assignment as a condition without parentheses",
216 r".*: warning: .+ has lower precedence than .+ be evaluated first .+Wparentheses",
217 r".*: warning: suggest parentheses around '.+?' .+ '.+?'",
218 r".*: warning: suggest parentheses around assignment used as truth value"]},
219 {'category': 'C/C++', 'severity': Severity.MEDIUM,
220 'description': 'Static variable used in non-static inline function',
221 'patterns': [r".*: warning: '.+' is static but used in inline function '.+' which is not static"]},
222 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit int',
223 'description': 'No type or storage class (will default to int)',
224 'patterns': [r".*: warning: data definition has no type or storage class"]},
225 {'category': 'cont.', 'severity': Severity.SKIP,
226 'description': 'skip, parameter name (without types) in function declaration',
227 'patterns': [r".*: warning: parameter names \(without types\) in function declaration"]},
228 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-aliasing',
229 'description': 'Dereferencing <foo> breaks strict aliasing rules',
230 'patterns': [r".*: warning: dereferencing .* break strict-aliasing rules"]},
231 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-to-int-cast',
232 'description': 'Cast from pointer to integer of different size',
233 'patterns': [r".*: warning: cast from pointer to integer of different size",
234 r".*: warning: initialization makes pointer from integer without a cast"]},
235 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wint-to-pointer-cast',
236 'description': 'Cast to pointer from integer of different size',
237 'patterns': [r".*: warning: cast to pointer from integer of different size"]},
238 {'category': 'C/C++', 'severity': Severity.MEDIUM,
239 'description': 'Macro redefined',
240 'patterns': [r".*: warning: '.+' macro redefined"]},
241 {'category': 'cont.', 'severity': Severity.SKIP,
242 'description': 'skip, ... location of the previous definition',
243 'patterns': [r".*: warning: this is the location of the previous definition"]},
244 {'category': 'ld', 'severity': Severity.MEDIUM,
245 'description': 'ld: type and size of dynamic symbol are not defined',
246 'patterns': [r".*: warning: type and size of dynamic symbol `.+' are not defined"]},
247 {'category': 'C/C++', 'severity': Severity.MEDIUM,
248 'description': 'Pointer from integer without cast',
249 'patterns': [r".*: warning: assignment makes pointer from integer without a cast"]},
250 {'category': 'C/C++', 'severity': Severity.MEDIUM,
251 'description': 'Pointer from integer without cast',
252 'patterns': [r".*: warning: passing argument [0-9]+ of '.+' makes pointer from integer without a cast"]},
253 {'category': 'C/C++', 'severity': Severity.MEDIUM,
254 'description': 'Integer from pointer without cast',
255 'patterns': [r".*: warning: assignment makes integer from pointer without a cast"]},
256 {'category': 'C/C++', 'severity': Severity.MEDIUM,
257 'description': 'Integer from pointer without cast',
258 'patterns': [r".*: warning: passing argument [0-9]+ of '.+' makes integer from pointer without a cast"]},
259 {'category': 'C/C++', 'severity': Severity.MEDIUM,
260 'description': 'Integer from pointer without cast',
261 'patterns': [r".*: warning: return makes integer from pointer without a cast"]},
262 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunknown-pragmas',
263 'description': 'Ignoring pragma',
264 'patterns': [r".*: warning: ignoring #pragma .+"]},
265 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-W#pragma-messages',
266 'description': 'Pragma warning messages',
267 'patterns': [r".*: warning: .+W#pragma-messages"]},
268 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wclobbered',
269 'description': 'Variable might be clobbered by longjmp or vfork',
270 'patterns': [r".*: warning: variable '.+' might be clobbered by 'longjmp' or 'vfork'"]},
271 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wclobbered',
272 'description': 'Argument might be clobbered by longjmp or vfork',
273 'patterns': [r".*: warning: argument '.+' might be clobbered by 'longjmp' or 'vfork'"]},
274 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wredundant-decls',
275 'description': 'Redundant declaration',
276 'patterns': [r".*: warning: redundant redeclaration of '.+'"]},
277 {'category': 'cont.', 'severity': Severity.SKIP,
278 'description': 'skip, previous declaration ... was here',
279 'patterns': [r".*: warning: previous declaration of '.+' was here"]},
280 {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wswitch-enum',
281 'description': 'Enum value not handled in switch',
282 'patterns': [r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"]},
283 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wuser-defined-warnings',
284 'description': 'User defined warnings',
285 'patterns': [r".*: warning: .* \[-Wuser-defined-warnings\]$"]},
286 {'category': 'C/C++', 'severity': Severity.MEDIUM,
287 'description': 'Taking address of temporary',
288 'patterns': [r".*: warning: taking address of temporary"]},
289 {'category': 'C/C++', 'severity': Severity.MEDIUM,
290 'description': 'Taking address of packed member',
291 'patterns': [r".*: warning: taking address of packed member"]},
292 {'category': 'C/C++', 'severity': Severity.MEDIUM,
293 'description': 'Possible broken line continuation',
294 'patterns': [r".*: warning: backslash and newline separated by space"]},
295 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wundefined-var-template',
296 'description': 'Undefined variable template',
297 'patterns': [r".*: warning: instantiation of variable .* no definition is available"]},
298 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wundefined-inline',
299 'description': 'Inline function is not defined',
300 'patterns': [r".*: warning: inline function '.*' is not defined"]},
301 {'category': 'C/C++', 'severity': Severity.MEDIUM,
302 'description': 'Excess elements in initializer',
303 'patterns': [r".*: warning: excess elements in .+ initializer"]},
304 {'category': 'C/C++', 'severity': Severity.MEDIUM,
305 'description': 'Decimal constant is unsigned only in ISO C90',
306 'patterns': [r".*: warning: this decimal constant is unsigned only in ISO C90"]},
307 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmain',
308 'description': 'main is usually a function',
309 'patterns': [r".*: warning: 'main' is usually a function"]},
310 {'category': 'C/C++', 'severity': Severity.MEDIUM,
311 'description': 'Typedef ignored',
312 'patterns': [r".*: warning: 'typedef' was ignored in this declaration"]},
313 {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Waddress',
314 'description': 'Address always evaluates to true',
315 'patterns': [r".*: warning: the address of '.+' will always evaluate as 'true'"]},
316 {'category': 'C/C++', 'severity': Severity.FIXMENOW,
317 'description': 'Freeing a non-heap object',
318 'patterns': [r".*: warning: attempt to free a non-heap object '.+'"]},
319 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wchar-subscripts',
320 'description': 'Array subscript has type char',
321 'patterns': [r".*: warning: array subscript .+ type 'char'.+Wchar-subscripts"]},
322 {'category': 'C/C++', 'severity': Severity.MEDIUM,
323 'description': 'Constant too large for type',
324 'patterns': [r".*: warning: integer constant is too large for '.+' type"]},
325 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Woverflow',
326 'description': 'Constant too large for type, truncated',
327 'patterns': [r".*: warning: large integer implicitly truncated to unsigned type"]},
328 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Winteger-overflow',
329 'description': 'Overflow in expression',
330 'patterns': [r".*: warning: overflow in expression; .*Winteger-overflow"]},
331 {'category': 'C/C++', 'severity': Severity.MEDIUM, '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,
335 'description': 'Declaration does not declare anything',
336 'patterns': [r".*: warning: declaration 'class .+' does not declare anything"]},
337 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wreorder',
338 'description': 'Initialization order will be different',
339 'patterns': [r".*: warning: '.+' will be initialized after",
340 r".*: warning: field .+ will be initialized after .+Wreorder"]},
341 {'category': 'cont.', 'severity': Severity.SKIP,
342 'description': 'skip, ....',
343 'patterns': [r".*: warning: '.+'"]},
344 {'category': 'cont.', 'severity': Severity.SKIP,
345 'description': 'skip, base ...',
346 'patterns': [r".*: warning: base '.+'"]},
347 {'category': 'cont.', 'severity': Severity.SKIP,
348 'description': 'skip, when initialized here',
349 'patterns': [r".*: warning: when initialized here"]},
350 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-parameter-type',
351 'description': 'Parameter type not specified',
352 'patterns': [r".*: warning: type of '.+' defaults to 'int'"]},
353 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-declarations',
354 'description': 'Missing declarations',
355 'patterns': [r".*: warning: declaration does not declare anything"]},
356 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-noreturn',
357 'description': 'Missing noreturn',
358 'patterns': [r".*: warning: function '.*' could be declared with attribute 'noreturn'"]},
359 {'category': 'C/C++', 'severity': Severity.MEDIUM,
360 'description': 'User warning',
361 'patterns': [r".*: warning: #warning "".+"""]},
362 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wvexing-parse',
363 'description': 'Vexing parsing problem',
364 'patterns': [r".*: warning: empty parentheses interpreted as a function declaration"]},
365 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wextra',
366 'description': 'Dereferencing void*',
367 'patterns': [r".*: warning: dereferencing 'void \*' pointer"]},
368 {'category': 'C/C++', 'severity': Severity.MEDIUM,
369 'description': 'Comparison of pointer and integer',
370 'patterns': [r".*: warning: ordered comparison of pointer with integer zero",
371 r".*: warning: .*comparison between pointer and integer"]},
372 {'category': 'C/C++', 'severity': Severity.MEDIUM,
373 'description': 'Use of error-prone unary operator',
374 'patterns': [r".*: warning: use of unary operator that may be intended as compound assignment"]},
375 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wwrite-strings',
376 'description': 'Conversion of string constant to non-const char*',
377 'patterns': [r".*: warning: deprecated conversion from string constant to '.+'"]},
378 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-prototypes',
379 'description': 'Function declaration isn''t a prototype',
380 'patterns': [r".*: warning: function declaration isn't a prototype"]},
381 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wignored-qualifiers',
382 'description': 'Type qualifiers ignored on function return value',
383 'patterns': [r".*: warning: type qualifiers ignored on function return type",
384 r".*: warning: .+ type qualifier .+ has no effect .+Wignored-qualifiers"]},
385 {'category': 'C/C++', 'severity': Severity.MEDIUM,
386 'description': '<foo> declared inside parameter list, scope limited to this definition',
387 'patterns': [r".*: warning: '.+' declared inside parameter list"]},
388 {'category': 'cont.', 'severity': Severity.SKIP,
389 'description': 'skip, its scope is only this ...',
390 'patterns': [r".*: warning: its scope is only this definition or declaration, which is probably not what you want"]},
391 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcomment',
392 'description': 'Line continuation inside comment',
393 'patterns': [r".*: warning: multi-line comment"]},
394 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcomment',
395 'description': 'Comment inside comment',
396 'patterns': [r".*: warning: '.+' within block comment .*-Wcomment"]},
397 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wdeprecated-declarations',
398 'description': 'Deprecated declarations',
399 'patterns': [r".*: warning: .+ is deprecated.+deprecated-declarations"]},
400 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wdeprecated-register',
401 'description': 'Deprecated register',
402 'patterns': [r".*: warning: 'register' storage class specifier is deprecated"]},
403 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wpointer-sign',
404 'description': 'Converts between pointers to integer types with different sign',
405 'patterns': [r".*: warning: .+ converts between pointers to integer types with different sign"]},
406 {'category': 'C/C++', 'severity': Severity.HARMLESS,
407 'description': 'Extra tokens after #endif',
408 'patterns': [r".*: warning: extra tokens at end of #endif directive"]},
409 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wenum-compare',
410 'description': 'Comparison between different enums',
411 'patterns': [r".*: warning: comparison between '.+' and '.+'.+Wenum-compare",
412 r".*: warning: comparison of .* enumeration types .*-Wenum-compare-switch"]},
413 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wconversion',
414 'description': 'Conversion may change value',
415 'patterns': [r".*: warning: converting negative value '.+' to '.+'",
416 r".*: warning: conversion to '.+' .+ may (alter|change)"]},
417 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wconversion-null',
418 'description': 'Converting to non-pointer type from NULL',
419 'patterns': [r".*: warning: converting to non-pointer type '.+' from NULL"]},
420 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-conversion',
421 'description': 'Implicit sign conversion',
422 'patterns': [r".*: warning: implicit conversion changes signedness"]},
423 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnull-conversion',
424 'description': 'Converting NULL to non-pointer type',
425 'patterns': [r".*: warning: implicit conversion of NULL constant to '.+'"]},
426 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnon-literal-null-conversion',
427 'description': 'Zero used as null pointer',
428 'patterns': [r".*: warning: expression .* zero treated as a null pointer constant"]},
429 {'category': 'C/C++', 'severity': Severity.MEDIUM,
430 'description': 'Implicit conversion changes value or loses precision',
431 'patterns': [r".*: warning: implicit conversion .* changes value from .* to .*-conversion",
432 r".*: warning: implicit conversion loses integer precision:"]},
433 {'category': 'C/C++', 'severity': Severity.MEDIUM,
434 'description': 'Passing NULL as non-pointer argument',
435 'patterns': [r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"]},
436 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wctor-dtor-privacy',
437 'description': 'Class seems unusable because of private ctor/dtor',
438 'patterns': [r".*: warning: all member functions in class '.+' are private"]},
439 # skip this next one, because it only points out some RefBase-based classes
440 # where having a private destructor is perfectly fine
441 {'category': 'C/C++', 'severity': Severity.SKIP, 'option': '-Wctor-dtor-privacy',
442 'description': 'Class seems unusable because of private ctor/dtor',
443 'patterns': [r".*: warning: 'class .+' only defines a private destructor and has no friends"]},
444 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wctor-dtor-privacy',
445 'description': 'Class seems unusable because of private ctor/dtor',
446 'patterns': [r".*: warning: 'class .+' only defines private constructors and has no friends"]},
447 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wgnu-static-float-init',
448 'description': 'In-class initializer for static const float/double',
449 'patterns': [r".*: warning: in-class initializer for static data member of .+const (float|double)"]},
450 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-arith',
451 'description': 'void* used in arithmetic',
452 'patterns': [r".*: warning: pointer of type 'void \*' used in (arithmetic|subtraction)",
453 r".*: warning: arithmetic on .+ to void is a GNU extension.*Wpointer-arith",
454 r".*: warning: wrong type argument to increment"]},
455 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-promo',
456 'description': 'Overload resolution chose to promote from unsigned or enum to signed type',
457 'patterns': [r".*: warning: passing '.+' chooses '.+' over '.+'.*Wsign-promo"]},
458 {'category': 'cont.', 'severity': Severity.SKIP,
459 'description': 'skip, in call to ...',
460 'patterns': [r".*: warning: in call to '.+'"]},
461 {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wextra',
462 'description': 'Base should be explicitly initialized in copy constructor',
463 'patterns': [r".*: warning: base class '.+' should be explicitly initialized in the copy constructor"]},
464 {'category': 'C/C++', 'severity': Severity.MEDIUM,
465 'description': 'Return value from void function',
466 'patterns': [r".*: warning: 'return' with a value, in function returning void"]},
467 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'multichar',
468 'description': 'Multi-character character constant',
469 'patterns': [r".*: warning: multi-character character constant"]},
470 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'writable-strings',
471 'description': 'Conversion from string literal to char*',
472 'patterns': [r".*: warning: .+ does not allow conversion from string literal to 'char \*'"]},
473 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wextra-semi',
474 'description': 'Extra \';\'',
475 'patterns': [r".*: warning: extra ';' .+extra-semi"]},
476 {'category': 'C/C++', 'severity': Severity.LOW,
477 'description': 'Useless specifier',
478 'patterns': [r".*: warning: useless storage class specifier in empty declaration"]},
479 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wduplicate-decl-specifier',
480 'description': 'Duplicate declaration specifier',
481 'patterns': [r".*: warning: duplicate '.+' declaration specifier"]},
482 {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'tautological-compare',
483 'description': 'Comparison of self is always false',
484 'patterns': [r".*: self-comparison always evaluates to false"]},
485 {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'constant-logical-operand',
486 'description': 'Logical op with constant operand',
487 'patterns': [r".*: use of logical '.+' with constant operand"]},
488 {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'literal-suffix',
489 'description': 'Needs a space between literal and string macro',
490 'patterns': [r".*: warning: invalid suffix on literal.+ requires a space .+Wliteral-suffix"]},
491 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '#warnings',
492 'description': 'Warnings from #warning',
493 'patterns': [r".*: warning: .+-W#warnings"]},
494 {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'absolute-value',
495 'description': 'Using float/int absolute value function with int/float argument',
496 'patterns': [r".*: warning: using .+ absolute value function .+ when argument is .+ type .+Wabsolute-value",
497 r".*: warning: absolute value function '.+' given .+ which may cause truncation .+Wabsolute-value"]},
498 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wc++11-extensions',
499 'description': 'Using C++11 extensions',
500 'patterns': [r".*: warning: 'auto' type specifier is a C\+\+11 extension"]},
501 {'category': 'C/C++', 'severity': Severity.LOW,
502 'description': 'Refers to implicitly defined namespace',
503 'patterns': [r".*: warning: using directive refers to implicitly-defined namespace .+"]},
504 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Winvalid-pp-token',
505 'description': 'Invalid pp token',
506 'patterns': [r".*: warning: missing .+Winvalid-pp-token"]},
507 {'category': 'link', 'severity': Severity.LOW,
508 'description': 'need glibc to link',
509 'patterns': [r".*: warning: .* requires at runtime .* glibc .* for linking"]},
510
511 {'category': 'C/C++', 'severity': Severity.MEDIUM,
512 'description': 'Operator new returns NULL',
513 'patterns': [r".*: warning: 'operator new' must not return NULL unless it is declared 'throw\(\)' .+"]},
514 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnull-arithmetic',
515 'description': 'NULL used in arithmetic',
516 'patterns': [r".*: warning: NULL used in arithmetic",
517 r".*: warning: comparison between NULL and non-pointer"]},
518 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'header-guard',
519 'description': 'Misspelled header guard',
520 'patterns': [r".*: warning: '.+' is used as a header guard .+ followed by .+ different macro"]},
521 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'empty-body',
522 'description': 'Empty loop body',
523 'patterns': [r".*: warning: .+ loop has empty body"]},
524 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'enum-conversion',
525 'description': 'Implicit conversion from enumeration type',
526 'patterns': [r".*: warning: implicit conversion from enumeration type '.+'"]},
527 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'switch',
528 'description': 'case value not in enumerated type',
529 'patterns': [r".*: warning: case value not in enumerated type '.+'"]},
530 {'category': 'C/C++', 'severity': Severity.MEDIUM,
531 'description': 'Use of deprecated method',
532 'patterns': [r".*: warning: '.+' is deprecated .+"]},
533 {'category': 'C/C++', 'severity': Severity.MEDIUM,
534 'description': 'Use of garbage or uninitialized value',
535 'patterns': [r".*: warning: .+ uninitialized .+\[-Wsometimes-uninitialized\]"]},
536 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsizeof-array-argument',
537 'description': 'Sizeof on array argument',
538 'patterns': [r".*: warning: sizeof on array function parameter will return"]},
539 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsizeof-pointer-memacces',
540 'description': 'Bad argument size of memory access functions',
541 'patterns': [r".*: warning: .+\[-Wsizeof-pointer-memaccess\]"]},
542 {'category': 'C/C++', 'severity': Severity.MEDIUM,
543 'description': 'Return value not checked',
544 'patterns': [r".*: warning: The return value from .+ is not checked"]},
545 {'category': 'C/C++', 'severity': Severity.MEDIUM,
546 'description': 'Possible heap pollution',
547 'patterns': [r".*: warning: .*Possible heap pollution from .+ type .+"]},
548 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wfor-loop-analysis',
549 'description': 'Variable used in loop condition not modified in loop body',
550 'patterns': [r".*: warning: variable '.+' used in loop condition.*Wfor-loop-analysis"]},
551 {'category': 'C/C++', 'severity': Severity.MEDIUM,
552 'description': 'Closing a previously closed file',
553 'patterns': [r".*: warning: Closing a previously closed file"]},
554 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunnamed-type-template-args',
555 'description': 'Unnamed template type argument',
556 'patterns': [r".*: warning: template argument.+Wunnamed-type-template-args"]},
557 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit-fallthrough',
558 'description': 'Unannotated fall-through between switch labels',
559 'patterns': [r".*: warning: unannotated fall-through between switch labels.+Wimplicit-fallthrough"]},
560 {'category': 'C/C++', 'severity': Severity.HARMLESS,
561 'description': 'Discarded qualifier from pointer target type',
562 'patterns': [r".*: warning: .+ discards '.+' qualifier from pointer target type"]},
563 {'category': 'C/C++', 'severity': Severity.HARMLESS,
564 'description': 'Use snprintf instead of sprintf',
565 'patterns': [r".*: warning: .*sprintf is often misused; please use snprintf"]},
566 {'category': 'C/C++', 'severity': Severity.HARMLESS,
567 'description': 'Unsupported optimizaton flag',
568 'patterns': [r".*: warning: optimization flag '.+' is not supported"]},
569 {'category': 'C/C++', 'severity': Severity.HARMLESS,
570 'description': 'Extra or missing parentheses',
571 'patterns': [r".*: warning: equality comparison with extraneous parentheses",
572 r".*: warning: .+ within .+Wlogical-op-parentheses"]},
573 {'category': 'C/C++', 'severity': Severity.HARMLESS, 'option': 'mismatched-tags',
574 'description': 'Mismatched class vs struct tags',
575 'patterns': [r".*: warning: '.+' defined as a .+ here but previously declared as a .+mismatched-tags",
576 r".*: warning: .+ was previously declared as a .+mismatched-tags"]},
577]