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