forked from openkylin/platform_build
Add more patterns, dump sorted unique warnings.
* Sort and remove duplicated warning messages. * Recognize more warning message patterns from new clang compiler. BUG: http://b/27698849 Change-Id: Iebbe8600353269d8c2d49ef9d97a72be1d978a24
This commit is contained in:
parent
003bec431c
commit
ba0ddcd099
|
@ -47,8 +47,8 @@ warnpatterns = [
|
|||
{ 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wtype-limits',
|
||||
'description':'Expression always evaluates to true or false',
|
||||
'patterns':[r".*: warning: comparison is always .+ due to limited range of data type",
|
||||
r".*: warning: comparison of unsigned expression >= 0 is always true",
|
||||
r".*: warning: comparison of unsigned expression < 0 is always false"] },
|
||||
r".*: warning: comparison of unsigned .*expression .+ is always true",
|
||||
r".*: warning: comparison of unsigned .*expression .+ is always false"] },
|
||||
{ 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'',
|
||||
'description':'Potential leak of memory, bad free, use after free',
|
||||
'patterns':[r".*: warning: Potential leak of memory",
|
||||
|
@ -61,7 +61,8 @@ warnpatterns = [
|
|||
r".*: warning: Attempt to .+ released memory"] },
|
||||
{ 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'',
|
||||
'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"] },
|
||||
{ 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'',
|
||||
'description':'Problem with vfork',
|
||||
'patterns':[r".*: warning: This .+ is prohibited after a successful vfork",
|
||||
|
@ -89,6 +90,7 @@ warnpatterns = [
|
|||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused',
|
||||
'description':'Unused function, variable or label',
|
||||
'patterns':[r".*: warning: '.+' defined but not used",
|
||||
r".*: warning: unused function '.+'",
|
||||
r".*: warning: unused variable '.+'"] },
|
||||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused-value',
|
||||
'description':'Statement with no effect',
|
||||
|
@ -107,7 +109,7 @@ warnpatterns = [
|
|||
r".*: warning: incomplete format specifier",
|
||||
r".*: warning: format .+ expects .+ but argument .+Wformat=",
|
||||
r".*: warning: field precision should have .+ but argument has .+Wformat",
|
||||
r".*: warning: format specifies type .+ but the argument has type .+Wformat"] },
|
||||
r".*: warning: format specifies type .+ but the argument has .*type .+Wformat"] },
|
||||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wformat-extra-args',
|
||||
'description':'Too many arguments for format string',
|
||||
'patterns':[r".*: warning: too many arguments for format"] },
|
||||
|
@ -138,6 +140,8 @@ warnpatterns = [
|
|||
'description':'Qualifier discarded',
|
||||
'patterns':[r".*: warning: passing argument [0-9]+ of '.+' discards qualifiers from pointer target type",
|
||||
r".*: warning: assignment discards qualifiers from pointer target type",
|
||||
r".*: warning: passing .+ to parameter of type .+ discards qualifiers",
|
||||
r".*: warning: assigning to .+ from .+ discards qualifiers",
|
||||
r".*: warning: return discards qualifiers from pointer target type"] },
|
||||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wattributes',
|
||||
'description':'Attribute ignored',
|
||||
|
@ -184,6 +188,9 @@ warnpatterns = [
|
|||
'patterns':[r".*: warning: suggest explicit braces to avoid ambiguous 'else'",
|
||||
r".*: warning: suggest parentheses around arithmetic in operand of '.+'",
|
||||
r".*: warning: suggest parentheses around comparison in operand of '.+'",
|
||||
r".*: warning: logical not is only applied to the left hand side of this comparison",
|
||||
r".*: warning: using the result of an assignment as a condition without parentheses",
|
||||
r".*: warning: .+ has lower precedence than .+ be evaluated first .+Wparentheses",
|
||||
r".*: warning: suggest parentheses around '.+?' .+ '.+?'",
|
||||
r".*: warning: suggest parentheses around assignment used as truth value"] },
|
||||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
|
||||
|
@ -258,13 +265,19 @@ warnpatterns = [
|
|||
'patterns':[r".*: warning: previous declaration of '.+' was here"] },
|
||||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wswitch-enum',
|
||||
'description':'Enum value not handled in switch',
|
||||
'patterns':[r".*: warning: enumeration value '.+' not handled in switch"] },
|
||||
'patterns':[r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"] },
|
||||
{ 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'-encoding',
|
||||
'description':'Java: Non-ascii characters used, but ascii encoding specified',
|
||||
'patterns':[r".*: warning: unmappable character for encoding ascii"] },
|
||||
{ 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'',
|
||||
'description':'Java: Non-varargs call of varargs method with inexact argument type for last parameter',
|
||||
'patterns':[r".*: warning: non-varargs call of varargs method with inexact argument type for last parameter"] },
|
||||
{ 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'',
|
||||
'description':'Java: Unchecked method invocation',
|
||||
'patterns':[r".*: warning: \[unchecked\] unchecked method invocation: .+ in class .+"] },
|
||||
{ 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'',
|
||||
'description':'Java: Unchecked conversion',
|
||||
'patterns':[r".*: warning: \[unchecked\] unchecked conversion"] },
|
||||
{ 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'',
|
||||
'description':'aapt: No default translation',
|
||||
'patterns':[r".*: warning: string '.+' has no default translation in .*"] },
|
||||
|
@ -286,7 +299,11 @@ warnpatterns = [
|
|||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Warray-bounds',
|
||||
'description':'Array subscript out of bounds',
|
||||
'patterns':[r".*: warning: array subscript is above array bounds",
|
||||
r".*: warning: Array subscript is undefined",
|
||||
r".*: warning: array subscript is below array bounds"] },
|
||||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
|
||||
'description':'Excess elements in initializer',
|
||||
'patterns':[r".*: warning: excess elements in .+ initializer"] },
|
||||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
|
||||
'description':'Decimal constant is unsigned only in ISO C90',
|
||||
'patterns':[r".*: warning: this decimal constant is unsigned only in ISO C90"] },
|
||||
|
@ -319,7 +336,8 @@ warnpatterns = [
|
|||
'patterns':[r".*: warning: declaration 'class .+' does not declare anything"] },
|
||||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wreorder',
|
||||
'description':'Initialization order will be different',
|
||||
'patterns':[r".*: warning: '.+' will be initialized after"] },
|
||||
'patterns':[r".*: warning: '.+' will be initialized after",
|
||||
r".*: warning: field .+ will be initialized after .+Wreorder"] },
|
||||
{ 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
|
||||
'description':'',
|
||||
'patterns':[r".*: warning: '.+'"] },
|
||||
|
@ -397,6 +415,9 @@ warnpatterns = [
|
|||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wctor-dtor-privacy',
|
||||
'description':'Class seems unusable because of private ctor/dtor' ,
|
||||
'patterns':[r".*: warning: 'class .+' only defines private constructors and has no friends"] },
|
||||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wgnu-static-float-init',
|
||||
'description':'In-class initializer for static const float/double' ,
|
||||
'patterns':[r".*: warning: in-class initializer for static data member of .+const (float|double)"] },
|
||||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wpointer-arith',
|
||||
'description':'void* used in arithmetic' ,
|
||||
'patterns':[r".*: warning: pointer of type 'void \*' used in (arithmetic|subtraction)",
|
||||
|
@ -423,6 +444,9 @@ warnpatterns = [
|
|||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'multichar',
|
||||
'description':'Multi-character character constant',
|
||||
'patterns':[r".*: warning: multi-character character constant"] },
|
||||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'writable-strings',
|
||||
'description':'Conversion from string literal to char*',
|
||||
'patterns':[r".*: warning: .+ does not allow conversion from string literal to 'char \*'"] },
|
||||
{ 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'',
|
||||
'description':'Useless specifier',
|
||||
'patterns':[r".*: warning: useless storage class specifier in empty declaration"] },
|
||||
|
@ -441,6 +465,7 @@ warnpatterns = [
|
|||
{ 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'missing-braces',
|
||||
'description':'Missing braces',
|
||||
'patterns':[r".*: warning: suggest braces around initialization of",
|
||||
r".*: warning: too many braces around scalar initializer .+Wmany-braces-around-scalar-init",
|
||||
r".*: warning: braces around scalar initializer"] },
|
||||
{ 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'sign-compare',
|
||||
'description':'Comparison of integers of different signs',
|
||||
|
@ -467,14 +492,20 @@ warnpatterns = [
|
|||
'description':'Incompatible pointer types',
|
||||
'patterns':[r".*: warning: incompatible pointer types .+Wincompatible-pointer-types"] },
|
||||
{ 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'asm-operand-widths',
|
||||
'description':'ASM value size does not match registyer 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"] },
|
||||
{ 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'literal-suffix',
|
||||
{ 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'literal-suffix',
|
||||
'description':'Needs a space between literal and string macro',
|
||||
'patterns':[r".*: warning: invalid suffix on literal.+ requires a space .+Wliteral-suffix"] },
|
||||
{ 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'#warnings',
|
||||
{ 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'#warnings',
|
||||
'description':'Warnings from #warning',
|
||||
'patterns':[r".*: warning: .+-W#warnings"] },
|
||||
{ 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'absolute-value',
|
||||
'description':'Using float/int absolute value function with int/float argument',
|
||||
'patterns':[r".*: warning: using .+ absolute value function .+ when argument is .+ type .+Wabsolute-value"] },
|
||||
{ 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'',
|
||||
'description':'Refers to implicitly defined namespace',
|
||||
'patterns':[r".*: warning: using directive refers to implicitly-defined namespace .+"] },
|
||||
|
||||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
|
||||
'description':'Operator new returns NULL',
|
||||
|
@ -482,6 +513,12 @@ warnpatterns = [
|
|||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
|
||||
'description':'NULL used in arithmetic',
|
||||
'patterns':[r".*: warning: NULL used in arithmetic"] },
|
||||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'header-guard',
|
||||
'description':'Misspelled header guard',
|
||||
'patterns':[r".*: warning: '.+' is used as a header guard .+ followed by .+ different macro"] },
|
||||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'empty-body',
|
||||
'description':'Empty loop body',
|
||||
'patterns':[r".*: warning: .+ loop has empty body"] },
|
||||
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'enum-conversion',
|
||||
'description':'Implicit conversion from enumeration type',
|
||||
'patterns':[r".*: warning: implicit conversion from enumeration type '.+'"] },
|
||||
|
@ -504,6 +541,9 @@ warnpatterns = [
|
|||
'patterns':[r".*: warning: .+ is a garbage value",
|
||||
r".*: warning: Function call argument is an uninitialized value",
|
||||
r".*: warning: Undefined or garbage value returned to caller",
|
||||
r".*: warning: Called .+ pointer is.+uninitialized",
|
||||
r".*: warning: Called .+ pointer is.+uninitalized", # match a typo in compiler message
|
||||
r".*: warning: Use of zero-allocated memory",
|
||||
r".*: warning: Dereference of undefined pointer value",
|
||||
r".*: warning: Passed-by-value .+ contains uninitialized data",
|
||||
r".*: warning: Branch condition evaluates to a garbage value",
|
||||
|
@ -605,6 +645,7 @@ def dumpstats():
|
|||
known = 0
|
||||
unknown = 0
|
||||
for i in warnpatterns:
|
||||
i['members'] = sorted(set(i['members']))
|
||||
if i['severity'] == severity.UNKNOWN:
|
||||
unknown += len(i['members'])
|
||||
elif i['severity'] != severity.SKIP:
|
||||
|
|
Loading…
Reference in New Issue