Merge "Add new compiler warning patterns"

am: 415186a71c

Change-Id: I6c7513804b78b80afbea0998d9a3333c5c40cd52
This commit is contained in:
Chih-hung Hsieh 2019-09-25 10:22:56 -07:00 committed by android-build-merger
commit 0bfc7e1f31
1 changed files with 209 additions and 137 deletions

View File

@ -159,11 +159,43 @@ def group_tidy_warn_pattern(description):
return tidy_warn_pattern(description, description + r'-.+') return tidy_warn_pattern(description, description + r'-.+')
def analyzer_high(description, patterns):
# Important clang analyzer warnings to be fixed ASAP.
return {
'category': 'C/C++',
'severity': Severity.HIGH,
'description': description,
'patterns': patterns
}
def analyzer_high_check(check):
return analyzer_high(check, [r'.*: .+\[' + check + r'\]$'])
def analyzer_group_high(check):
return analyzer_high(check, [r'.*: .+\[' + check + r'.+\]$'])
def analyzer_warn(description, patterns):
return {
'category': 'C/C++',
'severity': Severity.ANALYZER,
'description': description,
'patterns': patterns
}
def analyzer_warn_check(check):
return analyzer_warn(check, [r'.*: .+\[' + check + r'\]$'])
def analyzer_group_check(check):
return analyzer_warn(check, [r'.*: .+\[' + check + r'.+\]$'])
warn_patterns = [ warn_patterns = [
# pylint:disable=line-too-long,g-inconsistent-quotes # pylint:disable=line-too-long,g-inconsistent-quotes
{'category': 'C/C++', 'severity': Severity.ANALYZER,
'description': 'clang-analyzer Security warning',
'patterns': [r".*: warning: .+\[clang-analyzer-security.*\]"]},
{'category': 'make', 'severity': Severity.MEDIUM, {'category': 'make', 'severity': Severity.MEDIUM,
'description': 'make: overriding commands/ignoring old commands', 'description': 'make: overriding commands/ignoring old commands',
'patterns': [r".*: warning: overriding commands for target .+", 'patterns': [r".*: warning: overriding commands for target .+",
@ -183,7 +215,7 @@ warn_patterns = [
{'category': 'make', 'severity': Severity.MEDIUM, {'category': 'make', 'severity': Severity.MEDIUM,
'description': 'Duplicate header copy', 'description': 'Duplicate header copy',
'patterns': [r".*: warning: Duplicate header copy: .+"]}, 'patterns': [r".*: warning: Duplicate header copy: .+"]},
{'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wimplicit-function-declaration', {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit-function-declaration',
'description': 'Implicit function declaration', 'description': 'Implicit function declaration',
'patterns': [r".*: warning: implicit declaration of function .+", 'patterns': [r".*: warning: implicit declaration of function .+",
r".*: warning: implicitly declaring library function"]}, r".*: warning: implicitly declaring library function"]},
@ -195,17 +227,17 @@ warn_patterns = [
'patterns': [r".*: warning: comparison is always .+ due to limited range of data type", 'patterns': [r".*: warning: comparison is always .+ due to limited range of data type",
r".*: warning: comparison of unsigned .*expression .+ is always true", r".*: warning: comparison of unsigned .*expression .+ is always true",
r".*: warning: comparison of unsigned .*expression .+ is always false"]}, r".*: warning: comparison of unsigned .*expression .+ is always false"]},
{'category': 'C/C++', 'severity': Severity.HIGH, # {'category': 'C/C++', 'severity': Severity.HIGH,
'description': 'Potential leak of memory, bad free, use after free', # 'description': 'Potential leak of memory, bad free, use after free',
'patterns': [r".*: warning: Potential leak of memory", # 'patterns': [r".*: warning: Potential leak of memory",
r".*: warning: Potential memory leak", # r".*: warning: Potential memory leak",
r".*: warning: Memory allocated by alloca\(\) should not be deallocated", # r".*: warning: Memory allocated by alloca\(\) should not be deallocated",
r".*: warning: Memory allocated by .+ should be deallocated by .+ not .+", # r".*: warning: Memory allocated by .+ should be deallocated by .+ not .+",
r".*: warning: 'delete' applied to a pointer that was allocated", # r".*: warning: 'delete' applied to a pointer that was allocated",
r".*: warning: Use of memory after it is freed", # r".*: warning: Use of memory after it is freed",
r".*: warning: Argument to .+ is the address of .+ variable", # r".*: warning: Argument to .+ is the address of .+ variable",
r".*: warning: Argument to free\(\) is offset by .+ of memory allocated by", # r".*: warning: Argument to free\(\) is offset by .+ of memory allocated by",
r".*: warning: Attempt to .+ released memory"]}, # r".*: warning: Attempt to .+ released memory"]},
{'category': 'C/C++', 'severity': Severity.HIGH, {'category': 'C/C++', 'severity': Severity.HIGH,
'description': 'Use transient memory for control value', 'description': 'Use transient memory for control value',
'patterns': [r".*: warning: .+Using such transient memory for the control value is .*dangerous."]}, 'patterns': [r".*: warning: .+Using such transient memory for the control value is .*dangerous."]},
@ -213,10 +245,10 @@ warn_patterns = [
'description': 'Return address of stack memory', 'description': 'Return address of stack memory',
'patterns': [r".*: warning: Address of stack memory .+ returned to caller", 'patterns': [r".*: warning: Address of stack memory .+ returned to caller",
r".*: warning: Address of stack memory .+ will be a dangling reference"]}, r".*: warning: Address of stack memory .+ will be a dangling reference"]},
{'category': 'C/C++', 'severity': Severity.HIGH, # {'category': 'C/C++', 'severity': Severity.HIGH,
'description': 'Problem with vfork', # 'description': 'Problem with vfork',
'patterns': [r".*: warning: This .+ is prohibited after a successful vfork", # 'patterns': [r".*: warning: This .+ is prohibited after a successful vfork",
r".*: warning: Call to function '.+' is insecure "]}, # r".*: warning: Call to function '.+' is insecure "]},
{'category': 'C/C++', 'severity': Severity.HIGH, 'option': 'infinite-recursion', {'category': 'C/C++', 'severity': Severity.HIGH, 'option': 'infinite-recursion',
'description': 'Infinite recursion', 'description': 'Infinite recursion',
'patterns': [r".*: warning: all paths through this function will call itself"]}, 'patterns': [r".*: warning: all paths through this function will call itself"]},
@ -271,6 +303,9 @@ warn_patterns = [
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wdate-time', {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wdate-time',
'description': 'Expansion of data or time macro', 'description': 'Expansion of data or time macro',
'patterns': [r".*: warning: expansion of date or time macro is not reproducible"]}, 'patterns': [r".*: warning: expansion of date or time macro is not reproducible"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wexpansion-to-defined',
'description': 'Macro expansion has undefined behavior',
'patterns': [r".*: warning: macro expansion .* has undefined behavior"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat', {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat',
'description': 'Format string does not match arguments', 'description': 'Format string does not match arguments',
'patterns': [r".*: warning: format '.+' expects type '.+', but argument [0-9]+ has type '.+'", 'patterns': [r".*: warning: format '.+' expects type '.+', but argument [0-9]+ has type '.+'",
@ -398,16 +433,16 @@ warn_patterns = [
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit int', {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit int',
'description': 'No type or storage class (will default to int)', 'description': 'No type or storage class (will default to int)',
'patterns': [r".*: warning: data definition has no type or storage class"]}, 'patterns': [r".*: warning: data definition has no type or storage class"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, # {'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Null pointer', # 'description': 'Null pointer',
'patterns': [r".*: warning: Dereference of null pointer", # 'patterns': [r".*: warning: Dereference of null pointer",
r".*: warning: Called .+ pointer is null", # r".*: warning: Called .+ pointer is null",
r".*: warning: Forming reference to null pointer", # r".*: warning: Forming reference to null pointer",
r".*: warning: Returning null reference", # r".*: warning: Returning null reference",
r".*: warning: Null pointer passed as an argument to a 'nonnull' parameter", # r".*: warning: Null pointer passed as an argument to a 'nonnull' parameter",
r".*: warning: .+ results in a null pointer dereference", # r".*: warning: .+ results in a null pointer dereference",
r".*: warning: Access to .+ results in a dereference of a null pointer", # r".*: warning: Access to .+ results in a dereference of a null pointer",
r".*: warning: Null pointer argument in"]}, # r".*: warning: Null pointer argument in"]},
{'category': 'cont.', 'severity': Severity.SKIP, {'category': 'cont.', 'severity': Severity.SKIP,
'description': 'skip, parameter name (without types) in function declaration', 'description': 'skip, parameter name (without types) in function declaration',
'patterns': [r".*: warning: parameter names \(without types\) in function declaration"]}, 'patterns': [r".*: warning: parameter names \(without types\) in function declaration"]},
@ -422,8 +457,8 @@ warn_patterns = [
'description': 'Cast to pointer from integer of different size', 'description': 'Cast to pointer from integer of different size',
'patterns': [r".*: warning: cast to pointer from integer of different size"]}, 'patterns': [r".*: warning: cast to pointer from integer of different size"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, {'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Symbol redefined', 'description': 'Macro redefined',
'patterns': [r".*: warning: "".+"" redefined"]}, 'patterns': [r".*: warning: '.+' macro redefined"]},
{'category': 'cont.', 'severity': Severity.SKIP, {'category': 'cont.', 'severity': Severity.SKIP,
'description': 'skip, ... location of the previous definition', 'description': 'skip, ... location of the previous definition',
'patterns': [r".*: warning: this is the location of the previous definition"]}, 'patterns': [r".*: warning: this is the location of the previous definition"]},
@ -463,7 +498,7 @@ warn_patterns = [
{'category': 'cont.', 'severity': Severity.SKIP, {'category': 'cont.', 'severity': Severity.SKIP,
'description': 'skip, previous declaration ... was here', 'description': 'skip, previous declaration ... was here',
'patterns': [r".*: warning: previous declaration of '.+' was here"]}, 'patterns': [r".*: warning: previous declaration of '.+' was here"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wswitch-enum', {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wswitch-enum',
'description': 'Enum value not handled in switch', 'description': 'Enum value not handled in switch',
'patterns': [r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"]}, 'patterns': [r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wuser-defined-warnings', {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wuser-defined-warnings',
@ -484,6 +519,9 @@ warn_patterns = [
{'category': 'java', 'severity': Severity.MEDIUM, {'category': 'java', 'severity': Severity.MEDIUM,
'description': '_ used as an identifier', 'description': '_ used as an identifier',
'patterns': [r".*: warning: '_' used as an identifier"]}, 'patterns': [r".*: warning: '_' used as an identifier"]},
{'category': 'java', 'severity': Severity.MEDIUM,
'description': 'Java: hidden superclass',
'patterns': [r".*: warning: .* stripped of .* superclass .* \[HiddenSuperclass\]"]},
{'category': 'java', 'severity': Severity.HIGH, {'category': 'java', 'severity': Severity.HIGH,
'description': 'Use of internal proprietary API', 'description': 'Use of internal proprietary API',
'patterns': [r".*: warning: .* is internal proprietary API and may be removed"]}, 'patterns': [r".*: warning: .* is internal proprietary API and may be removed"]},
@ -2184,11 +2222,11 @@ warn_patterns = [
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wundefined-inline', {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wundefined-inline',
'description': 'Inline function is not defined', 'description': 'Inline function is not defined',
'patterns': [r".*: warning: inline function '.*' is not defined"]}, 'patterns': [r".*: warning: inline function '.*' is not defined"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Warray-bounds', # {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Warray-bounds',
'description': 'Array subscript out of bounds', # 'description': 'Array subscript out of bounds',
'patterns': [r".*: warning: array subscript is above array bounds", # 'patterns': [r".*: warning: array subscript is above array bounds",
r".*: warning: Array subscript is undefined", # r".*: warning: Array subscript is undefined",
r".*: warning: array subscript is below array bounds"]}, # r".*: warning: array subscript is below array bounds"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, {'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Excess elements in initializer', 'description': 'Excess elements in initializer',
'patterns': [r".*: warning: excess elements in .+ initializer"]}, 'patterns': [r".*: warning: excess elements in .+ initializer"]},
@ -2289,14 +2327,7 @@ warn_patterns = [
'patterns': [r".*: warning: multi-line comment"]}, 'patterns': [r".*: warning: multi-line comment"]},
{'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcomment', {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcomment',
'description': 'Comment inside comment', 'description': 'Comment inside comment',
'patterns': [r".*: warning: "".+"" within comment"]}, 'patterns': [r".*: warning: '.+' within block comment .*-Wcomment"]},
# Warning "value stored is never read" could be from clang-tidy or clang static analyzer.
{'category': 'C/C++', 'severity': Severity.ANALYZER,
'description': 'clang-analyzer Value stored is never read',
'patterns': [r".*: warning: Value stored to .+ is never read.*clang-analyzer-deadcode.DeadStores"]},
{'category': 'C/C++', 'severity': Severity.LOW,
'description': 'Value stored is never read',
'patterns': [r".*: warning: Value stored to .+ is never read"]},
{'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wdeprecated-declarations', {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wdeprecated-declarations',
'description': 'Deprecated declarations', 'description': 'Deprecated declarations',
'patterns': [r".*: warning: .+ is deprecated.+deprecated-declarations"]}, 'patterns': [r".*: warning: .+ is deprecated.+deprecated-declarations"]},
@ -2311,7 +2342,8 @@ warn_patterns = [
'patterns': [r".*: warning: extra tokens at end of #endif directive"]}, 'patterns': [r".*: warning: extra tokens at end of #endif directive"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wenum-compare', {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wenum-compare',
'description': 'Comparison between different enums', 'description': 'Comparison between different enums',
'patterns': [r".*: warning: comparison between '.+' and '.+'.+Wenum-compare"]}, 'patterns': [r".*: warning: comparison between '.+' and '.+'.+Wenum-compare",
r".*: warning: comparison of .* enumeration types .*-Wenum-compare-switch"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wconversion', {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wconversion',
'description': 'Conversion may change value', 'description': 'Conversion may change value',
'patterns': [r".*: warning: converting negative value '.+' to '.+'", 'patterns': [r".*: warning: converting negative value '.+' to '.+'",
@ -2329,8 +2361,9 @@ warn_patterns = [
'description': 'Zero used as null pointer', 'description': 'Zero used as null pointer',
'patterns': [r".*: warning: expression .* zero treated as a null pointer constant"]}, 'patterns': [r".*: warning: expression .* zero treated as a null pointer constant"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, {'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Implicit conversion changes value', 'description': 'Implicit conversion changes value or loses precision',
'patterns': [r".*: warning: implicit conversion .* changes value from .* to .*-conversion"]}, 'patterns': [r".*: warning: implicit conversion .* changes value from .* to .*-conversion",
r".*: warning: implicit conversion loses integer precision:"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, {'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Passing NULL as non-pointer argument', 'description': 'Passing NULL as non-pointer argument',
'patterns': [r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"]}, 'patterns': [r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"]},
@ -2361,9 +2394,9 @@ warn_patterns = [
{'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wextra', {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wextra',
'description': 'Base should be explicitly initialized in copy constructor', 'description': 'Base should be explicitly initialized in copy constructor',
'patterns': [r".*: warning: base class '.+' should be explicitly initialized in the copy constructor"]}, 'patterns': [r".*: warning: base class '.+' should be explicitly initialized in the copy constructor"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, # {'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'VLA has zero or negative size', # 'description': 'VLA has zero or negative size',
'patterns': [r".*: warning: Declared variable-length array \(VLA\) has .+ size"]}, # 'patterns': [r".*: warning: Declared variable-length array \(VLA\) has .+ size"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, {'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Return value from void function', 'description': 'Return value from void function',
'patterns': [r".*: warning: 'return' with a value, in function returning void"]}, 'patterns': [r".*: warning: 'return' with a value, in function returning void"]},
@ -2420,9 +2453,9 @@ warn_patterns = [
{'category': 'logtags', 'severity': Severity.LOW, 'option': 'overloaded-virtual', {'category': 'logtags', 'severity': Severity.LOW, 'option': 'overloaded-virtual',
'description': 'Hides overloaded virtual function', 'description': 'Hides overloaded virtual function',
'patterns': [r".*: '.+' hides overloaded virtual function"]}, 'patterns': [r".*: '.+' hides overloaded virtual function"]},
{'category': 'logtags', 'severity': Severity.LOW, 'option': 'incompatible-pointer-types', {'category': 'logtags', 'severity': Severity.LOW,
'description': 'Incompatible pointer types', 'description': 'Incompatible pointer types',
'patterns': [r".*: warning: incompatible pointer types .+Wincompatible-pointer-types"]}, 'patterns': [r".*: warning: incompatible .*pointer types .*-Wincompatible-.*pointer-types"]},
{'category': 'logtags', 'severity': Severity.LOW, 'option': 'asm-operand-widths', {'category': 'logtags', 'severity': Severity.LOW, 'option': 'asm-operand-widths',
'description': 'ASM value size does not match register size', 'description': 'ASM value size does not match register size',
'patterns': [r".*: warning: value size does not match register size specified by the constraint and modifier"]}, 'patterns': [r".*: warning: value size does not match register size specified by the constraint and modifier"]},
@ -2474,35 +2507,38 @@ warn_patterns = [
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'switch', {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'switch',
'description': 'case value not in enumerated type', 'description': 'case value not in enumerated type',
'patterns': [r".*: warning: case value not in enumerated type '.+'"]}, 'patterns': [r".*: warning: case value not in enumerated type '.+'"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, # {'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Undefined result', # 'description': 'Undefined result',
'patterns': [r".*: warning: The result of .+ is undefined", # 'patterns': [r".*: warning: The result of .+ is undefined",
r".*: warning: passing an object that .+ has undefined behavior \[-Wvarargs\]", # r".*: warning: passing an object that .+ has undefined behavior \[-Wvarargs\]",
r".*: warning: 'this' pointer cannot be null in well-defined C\+\+ code;", # r".*: warning: 'this' pointer cannot be null in well-defined C\+\+ code;",
r".*: warning: shifting a negative signed value is undefined"]}, # r".*: warning: shifting a negative signed value is undefined"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, # {'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Division by zero', # 'description': 'Division by zero',
'patterns': [r".*: warning: Division by zero"]}, # 'patterns': [r".*: warning: Division by zero"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, {'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Use of deprecated method', 'description': 'Use of deprecated method',
'patterns': [r".*: warning: '.+' is deprecated .+"]}, 'patterns': [r".*: warning: '.+' is deprecated .+"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, {'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Use of garbage or uninitialized value', 'description': 'Use of garbage or uninitialized value',
'patterns': [r".*: warning: .+ is a garbage value", 'patterns': [r".*: warning: .+ uninitialized .+\[-Wsometimes-uninitialized\]"]},
r".*: warning: Function call argument is an uninitialized value", # {'category': 'C/C++', 'severity': Severity.MEDIUM,
r".*: warning: Undefined or garbage value returned to caller", # 'description': 'Use of garbage or uninitialized value',
r".*: warning: Called .+ pointer is.+uninitialized", # 'patterns': [r".*: warning: .+ is a garbage value",
r".*: warning: Called .+ pointer is.+uninitalized", # match a typo in compiler message # r".*: warning: Function call argument is an uninitialized value",
r".*: warning: Use of zero-allocated memory", # r".*: warning: Undefined or garbage value returned to caller",
r".*: warning: Dereference of undefined pointer value", # r".*: warning: Called .+ pointer is.+uninitialized",
r".*: warning: Passed-by-value .+ contains uninitialized data", # r".*: warning: Called .+ pointer is.+uninitalized", # match a typo in compiler message
r".*: warning: Branch condition evaluates to a garbage value", # r".*: warning: Use of zero-allocated memory",
r".*: warning: The .+ of .+ is an uninitialized value.", # r".*: warning: Dereference of undefined pointer value",
r".*: warning: .+ is used uninitialized whenever .+sometimes-uninitialized", # r".*: warning: Passed-by-value .+ contains uninitialized data",
r".*: warning: Assigned value is garbage or undefined"]}, # r".*: warning: Branch condition evaluates to a garbage value",
{'category': 'C/C++', 'severity': Severity.MEDIUM, # r".*: warning: The .+ of .+ is an uninitialized value.",
'description': 'Result of malloc type incompatible with sizeof operand type', # r".*: warning: .+ is used uninitialized whenever .+sometimes-uninitialized",
'patterns': [r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"]}, # r".*: warning: Assigned value is garbage or undefined"]},
# {'category': 'C/C++', 'severity': Severity.MEDIUM,
# 'description': 'Result of malloc type incompatible with sizeof operand type',
# 'patterns': [r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsizeof-array-argument', {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsizeof-array-argument',
'description': 'Sizeof on array argument', 'description': 'Sizeof on array argument',
'patterns': [r".*: warning: sizeof on array function parameter will return"]}, 'patterns': [r".*: warning: sizeof on array function parameter will return"]},
@ -2515,12 +2551,12 @@ warn_patterns = [
{'category': 'C/C++', 'severity': Severity.MEDIUM, {'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Possible heap pollution', 'description': 'Possible heap pollution',
'patterns': [r".*: warning: .*Possible heap pollution from .+ type .+"]}, 'patterns': [r".*: warning: .*Possible heap pollution from .+ type .+"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, # {'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Allocation size of 0 byte', # 'description': 'Allocation size of 0 byte',
'patterns': [r".*: warning: Call to .+ has an allocation size of 0 byte"]}, # 'patterns': [r".*: warning: Call to .+ has an allocation size of 0 byte"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, # {'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Result of malloc type incompatible with sizeof operand type', # 'description': 'Result of malloc type incompatible with sizeof operand type',
'patterns': [r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"]}, # 'patterns': [r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wfor-loop-analysis', {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wfor-loop-analysis',
'description': 'Variable used in loop condition not modified in loop body', 'description': 'Variable used in loop condition not modified in loop body',
'patterns': [r".*: warning: variable '.+' used in loop condition.*Wfor-loop-analysis"]}, 'patterns': [r".*: warning: variable '.+' used in loop condition.*Wfor-loop-analysis"]},
@ -2554,12 +2590,15 @@ warn_patterns = [
{'category': 'FindEmulator', 'severity': Severity.HARMLESS, {'category': 'FindEmulator', 'severity': Severity.HARMLESS,
'description': 'FindEmulator: No such file or directory', 'description': 'FindEmulator: No such file or directory',
'patterns': [r".*: warning: FindEmulator: .* No such file or directory"]}, 'patterns': [r".*: warning: FindEmulator: .* No such file or directory"]},
{'category': 'google_tests', 'severity': Severity.HARMLESS, {'category': 'make', 'severity': Severity.HARMLESS,
'description': 'google_tests: unknown installed file', 'description': 'make: unknown installed file',
'patterns': [r".*: warning: .*_tests: Unknown installed file for module"]}, 'patterns': [r".*: warning: .*_tests: Unknown installed file for module"]},
{'category': 'make', 'severity': Severity.HARMLESS, {'category': 'make', 'severity': Severity.HARMLESS,
'description': 'unusual tags debug eng', 'description': 'unusual tags debug eng',
'patterns': [r".*: warning: .*: unusual tags debug eng"]}, 'patterns': [r".*: warning: .*: unusual tags debug eng"]},
{'category': 'make', 'severity': Severity.MEDIUM,
'description': 'make: please convert to soong',
'patterns': [r".*: warning: .* has been deprecated. Please convert to Soong."]},
# these next ones are to deal with formatting problems resulting from the log being mixed up by 'make -j' # these next ones are to deal with formatting problems resulting from the log being mixed up by 'make -j'
{'category': 'C/C++', 'severity': Severity.SKIP, {'category': 'C/C++', 'severity': Severity.SKIP,
@ -2574,6 +2613,7 @@ warn_patterns = [
# warnings from clang-tidy # warnings from clang-tidy
group_tidy_warn_pattern('android'), group_tidy_warn_pattern('android'),
simple_tidy_warn_pattern('abseil-string-find-startswith'),
simple_tidy_warn_pattern('bugprone-argument-comment'), simple_tidy_warn_pattern('bugprone-argument-comment'),
simple_tidy_warn_pattern('bugprone-copy-constructor-init'), simple_tidy_warn_pattern('bugprone-copy-constructor-init'),
simple_tidy_warn_pattern('bugprone-fold-init-type'), simple_tidy_warn_pattern('bugprone-fold-init-type'),
@ -2633,66 +2673,98 @@ warn_patterns = [
simple_tidy_warn_pattern('performance-type-promotion-in-math-fn'), simple_tidy_warn_pattern('performance-type-promotion-in-math-fn'),
simple_tidy_warn_pattern('performance-unnecessary-copy-initialization'), simple_tidy_warn_pattern('performance-unnecessary-copy-initialization'),
simple_tidy_warn_pattern('performance-unnecessary-value-param'), simple_tidy_warn_pattern('performance-unnecessary-value-param'),
simple_tidy_warn_pattern('portability-simd-intrinsics'),
group_tidy_warn_pattern('performance'), group_tidy_warn_pattern('performance'),
group_tidy_warn_pattern('readability'), group_tidy_warn_pattern('readability'),
# warnings from clang-tidy's clang-analyzer checks # warnings from clang-tidy's clang-analyzer checks
{'category': 'C/C++', 'severity': Severity.ANALYZER, analyzer_high('clang-analyzer-core, null pointer',
'description': 'clang-analyzer Unreachable code', [r".*: warning: .+ pointer is null .*\[clang-analyzer-core"]),
'patterns': [r".*: warning: This statement is never executed.*UnreachableCode"]}, analyzer_high('clang-analyzer-core, uninitialized value',
{'category': 'C/C++', 'severity': Severity.ANALYZER, [r".*: warning: .+ uninitialized (value|data) .*\[clang-analyzer-core"]),
'description': 'clang-analyzer Size of malloc may overflow', analyzer_warn('clang-analyzer-optin.performance.Padding',
'patterns': [r".*: warning: .* size of .* may overflow .*MallocOverflow"]}, [r".*: warning: Excessive padding in '.*'"]),
{'category': 'C/C++', 'severity': Severity.ANALYZER, # analyzer_warn('clang-analyzer Unreachable code',
'description': 'clang-analyzer Stream pointer might be NULL', # [r".*: warning: This statement is never executed.*UnreachableCode"]),
'patterns': [r".*: warning: Stream pointer might be NULL .*unix.Stream"]}, analyzer_warn('clang-analyzer Size of malloc may overflow',
{'category': 'C/C++', 'severity': Severity.ANALYZER, [r".*: warning: .* size of .* may overflow .*MallocOverflow"]),
'description': 'clang-analyzer Opened file never closed', analyzer_warn('clang-analyzer sozeof() on a pointer type',
'patterns': [r".*: warning: Opened File never closed.*unix.Stream"]}, [r".*: warning: .*calls sizeof.* on a pointer type.*SizeofPtr"]),
{'category': 'C/C++', 'severity': Severity.ANALYZER, analyzer_warn('clang-analyzer Pointer arithmetic on non-array variables',
'description': 'clang-analyzer sozeof() on a pointer type', [r".*: warning: Pointer arithmetic on non-array variables .*PointerArithm"]),
'patterns': [r".*: warning: .*calls sizeof.* on a pointer type.*SizeofPtr"]}, analyzer_warn('clang-analyzer Subtraction of pointers of different memory chunks',
{'category': 'C/C++', 'severity': Severity.ANALYZER, [r".*: warning: Subtraction of two pointers .*PointerSub"]),
'description': 'clang-analyzer Pointer arithmetic on non-array variables', analyzer_warn('clang-analyzer Access out-of-bound array element',
'patterns': [r".*: warning: Pointer arithmetic on non-array variables .*PointerArithm"]}, [r".*: warning: Access out-of-bound array element .*ArrayBound"]),
{'category': 'C/C++', 'severity': Severity.ANALYZER, analyzer_warn('clang-analyzer Out of bound memory access',
'description': 'clang-analyzer Subtraction of pointers of different memory chunks', [r".*: warning: Out of bound memory access .*ArrayBoundV2"]),
'patterns': [r".*: warning: Subtraction of two pointers .*PointerSub"]}, analyzer_warn('clang-analyzer Possible lock order reversal',
{'category': 'C/C++', 'severity': Severity.ANALYZER, [r".*: warning: .* Possible lock order reversal.*PthreadLock"]),
'description': 'clang-analyzer Access out-of-bound array element', analyzer_warn('clang-analyzer call path problems',
'patterns': [r".*: warning: Access out-of-bound array element .*ArrayBound"]}, [r".*: warning: Call Path : .+"]),
{'category': 'C/C++', 'severity': Severity.ANALYZER, analyzer_warn_check('clang-analyzer-core.CallAndMessage'),
'description': 'clang-analyzer Out of bound memory access', analyzer_high_check('clang-analyzer-core.NonNullParamChecker'),
'patterns': [r".*: warning: Out of bound memory access .*ArrayBoundV2"]}, analyzer_high_check('clang-analyzer-core.NullDereference'),
{'category': 'C/C++', 'severity': Severity.ANALYZER, analyzer_warn_check('clang-analyzer-core.UndefinedBinaryOperatorResult'),
'description': 'clang-analyzer Possible lock order reversal', analyzer_warn_check('clang-analyzer-core.DivideZero'),
'patterns': [r".*: warning: .* Possible lock order reversal.*PthreadLock"]}, analyzer_warn_check('clang-analyzer-core.VLASize'),
{'category': 'C/C++', 'severity': Severity.ANALYZER, analyzer_warn_check('clang-analyzer-core.uninitialized.ArraySubscript'),
'description': 'clang-analyzer Argument is a pointer to uninitialized value', analyzer_warn_check('clang-analyzer-core.uninitialized.Assign'),
'patterns': [r".*: warning: .* argument is a pointer to uninitialized value .*CallAndMessage"]}, analyzer_warn_check('clang-analyzer-core.uninitialized.UndefReturn'),
{'category': 'C/C++', 'severity': Severity.ANALYZER, analyzer_warn_check('clang-analyzer-cplusplus.Move'),
'description': 'clang-analyzer cast to struct', analyzer_warn_check('clang-analyzer-deadcode.DeadStores'),
'patterns': [r".*: warning: Casting a non-structure type to a structure type .*CastToStruct"]}, analyzer_warn_check('clang-analyzer-optin.cplusplus.UninitializedObject'),
{'category': 'C/C++', 'severity': Severity.ANALYZER, analyzer_warn_check('clang-analyzer-optin.cplusplus.VirtualCall'),
'description': 'clang-analyzer call path problems', analyzer_warn_check('clang-analyzer-portability.UnixAPI'),
'patterns': [r".*: warning: Call Path : .+"]}, analyzer_warn_check('clang-analyzer-unix.cstring.NullArg'),
{'category': 'C/C++', 'severity': Severity.ANALYZER, analyzer_high_check('clang-analyzer-unix.MallocSizeof'),
'description': 'clang-analyzer excessive padding', analyzer_warn_check('clang-analyzer-valist.Uninitialized'),
'patterns': [r".*: warning: Excessive padding in '.*'"]}, analyzer_warn_check('clang-analyzer-valist.Unterminated'),
{'category': 'C/C++', 'severity': Severity.ANALYZER, analyzer_group_check('clang-analyzer-core.uninitialized'),
'description': 'clang-analyzer other', analyzer_group_check('clang-analyzer-deadcode'),
'patterns': [r".*: .+\[clang-analyzer-.+\]$", analyzer_warn_check('clang-analyzer-security.insecureAPI.strcpy'),
r".*: Call Path : .+$"]}, analyzer_group_high('clang-analyzer-security.insecureAPI'),
analyzer_group_high('clang-analyzer-security'),
analyzer_group_check('clang-analyzer-unix.Malloc'),
analyzer_group_check('clang-analyzer-unix'),
analyzer_group_check('clang-analyzer'), # catch al
# Assembler warnings
{'category': 'Asm', 'severity': Severity.MEDIUM,
'description': 'Asm: IT instruction is deprecated',
'patterns': [r".*: warning: applying IT instruction .* is deprecated"]},
# NDK warnings
{'category': 'NDK', 'severity': Severity.HIGH,
'description': 'NDK: Generate guard with empty availability, obsoleted',
'patterns': [r".*: warning: .* generate guard with empty availability: obsoleted ="]},
# Protoc warnings
{'category': 'Protoc', 'severity': Severity.MEDIUM,
'description': 'Proto: Enum name colision after strip',
'patterns': [r".*: warning: Enum .* has the same name .* ignore case and strip"]},
# Kotlin warnings
{'category': 'Kotlin', 'severity': Severity.MEDIUM,
'description': 'Kotlin: never used parameter',
'patterns': [r".*: warning: parameter '.*' is never used"]},
{'category': 'Kotlin', 'severity': Severity.MEDIUM,
'description': 'Kotlin: Deprecated in Java',
'patterns': [r".*: warning: '.*' is deprecated. Deprecated in Java"]},
{'category': 'Kotlin', 'severity': Severity.MEDIUM,
'description': 'Kotlin: library has Kotlin runtime',
'patterns': [r".*: warning: library has Kotlin runtime bundled into it",
r".*: warning: some JAR files .* have the Kotlin Runtime library"]},
# rustc warnings # rustc warnings
{'category': 'rust', 'severity': Severity.HIGH, {'category': 'Rust', 'severity': Severity.HIGH,
'description': 'Does not derive Copy', 'description': 'Rust: Does not derive Copy',
'patterns': [r".*: warning: .+ does not derive Copy"]}, 'patterns': [r".*: warning: .+ does not derive Copy"]},
{'category': 'rust', 'severity': Severity.MEDIUM, {'category': 'Rust', 'severity': Severity.MEDIUM,
'description': 'Deprecated range pattern', 'description': 'Rust: Deprecated range pattern',
'patterns': [r".*: warning: .+ range patterns are deprecated"]}, 'patterns': [r".*: warning: .+ range patterns are deprecated"]},
{'category': 'rust', 'severity': Severity.MEDIUM, {'category': 'Rust', 'severity': Severity.MEDIUM,
'description': 'Deprecated missing explicit \'dyn\'', 'description': 'Rust: Deprecated missing explicit \'dyn\'',
'patterns': [r".*: warning: .+ without an explicit `dyn` are deprecated"]}, 'patterns': [r".*: warning: .+ without an explicit `dyn` are deprecated"]},
# catch-all for warnings this script doesn't know about yet # catch-all for warnings this script doesn't know about yet