Merge "Clean up cpp warning patterns"

This commit is contained in:
Chih-hung Hsieh 2020-01-13 21:59:27 +00:00 committed by Gerrit Code Review
commit 9c65671b91
2 changed files with 421 additions and 561 deletions

View File

@ -22,563 +22,431 @@ import re
from .severity import Severity from .severity import Severity
def cpp_warn(severity, description, pattern_list):
return {
'category': 'C/C++',
'severity': severity,
'description': description,
'patterns': pattern_list
}
def fixmenow(description, pattern_list):
return cpp_warn(Severity.FIXMENOW, description, pattern_list)
def high(description, pattern_list):
return cpp_warn(Severity.HIGH, description, pattern_list)
def medium(description, pattern_list):
return cpp_warn(Severity.MEDIUM, description, pattern_list)
def low(description, pattern_list):
return cpp_warn(Severity.LOW, description, pattern_list)
def skip(description, pattern_list):
return cpp_warn(Severity.SKIP, description, pattern_list)
def harmless(description, pattern_list):
return cpp_warn(Severity.HARMLESS, description, pattern_list)
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.MEDIUM, 'option': '-Wimplicit-function-declaration', medium('Implicit function declaration',
'description': 'Implicit function declaration', [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"]}, skip('skip, conflicting types for ...',
{'category': 'C/C++', 'severity': Severity.SKIP, [r".*: warning: conflicting types for '.+'"]),
'description': 'skip, conflicting types for ...', high('Expression always evaluates to true or false',
'patterns': [r".*: warning: conflicting types for '.+'"]}, [r".*: warning: comparison is always .+ due to limited range of data type",
{'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wtype-limits', r".*: warning: comparison of unsigned .*expression .+ is always true",
'description': 'Expression always evaluates to true or false', r".*: warning: comparison of unsigned .*expression .+ is always false"]),
'patterns': [r".*: warning: comparison is always .+ due to limited range of data type", high('Use transient memory for control value',
r".*: warning: comparison of unsigned .*expression .+ is always true", [r".*: warning: .+Using such transient memory for the control value is .*dangerous."]),
r".*: warning: comparison of unsigned .*expression .+ is always false"]}, high('Return address of stack memory',
{'category': 'C/C++', 'severity': Severity.HIGH, [r".*: warning: Address of stack memory .+ returned to caller",
'description': 'Use transient memory for control value', r".*: warning: Address of stack memory .+ will be a dangling reference"]),
'patterns': [r".*: warning: .+Using such transient memory for the control value is .*dangerous."]}, high('Infinite recursion',
{'category': 'C/C++', 'severity': Severity.HIGH, [r".*: warning: all paths through this function will call itself"]),
'description': 'Return address of stack memory', high('Potential buffer overflow',
'patterns': [r".*: warning: Address of stack memory .+ returned to caller", [r".*: warning: Size argument is greater than .+ the destination buffer",
r".*: warning: Address of stack memory .+ will be a dangling reference"]}, r".*: warning: Potential buffer overflow.",
{'category': 'C/C++', 'severity': Severity.HIGH, 'option': 'infinite-recursion', r".*: warning: String copy function overflows destination buffer"]),
'description': 'Infinite recursion', medium('Incompatible pointer types',
'patterns': [r".*: warning: all paths through this function will call itself"]}, [r".*: warning: assignment from incompatible pointer type",
{'category': 'C/C++', 'severity': Severity.HIGH, r".*: warning: return from incompatible pointer type",
'description': 'Potential buffer overflow', r".*: warning: passing argument [0-9]+ of '.*' from incompatible pointer type",
'patterns': [r".*: warning: Size argument is greater than .+ the destination buffer", r".*: warning: initialization from incompatible pointer type"]),
r".*: warning: Potential buffer overflow.", high('Incompatible declaration of built in function',
r".*: warning: String copy function overflows destination buffer"]}, [r".*: warning: incompatible implicit declaration of built-in function .+"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, high('Incompatible redeclaration of library function',
'description': 'Incompatible pointer types', [r".*: warning: incompatible redeclaration of library function .+"]),
'patterns': [r".*: warning: assignment from incompatible pointer type", high('Null passed as non-null argument',
r".*: warning: return from incompatible pointer type", [r".*: warning: Null passed to a callee that requires a non-null"]),
r".*: warning: passing argument [0-9]+ of '.*' from incompatible pointer type", medium('Unused parameter',
r".*: warning: initialization from incompatible pointer type"]}, [r".*: warning: unused parameter '.*'"]),
{'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-fno-builtin', medium('Unused function, variable, label, comparison, etc.',
'description': 'Incompatible declaration of built in function', [r".*: warning: '.+' defined but not used",
'patterns': [r".*: warning: incompatible implicit declaration of built-in function .+"]}, r".*: warning: unused function '.+'",
{'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wincompatible-library-redeclaration', r".*: warning: unused label '.+'",
'description': 'Incompatible redeclaration of library function', r".*: warning: relational comparison result unused",
'patterns': [r".*: warning: incompatible redeclaration of library function .+"]}, r".*: warning: lambda capture .* is not used",
{'category': 'C/C++', 'severity': Severity.HIGH, r".*: warning: private field '.+' is not used",
'description': 'Null passed as non-null argument', r".*: warning: unused variable '.+'"]),
'patterns': [r".*: warning: Null passed to a callee that requires a non-null"]}, medium('Statement with no effect or result unused',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-parameter', [r".*: warning: statement with no effect",
'description': 'Unused parameter', r".*: warning: expression result unused"]),
'patterns': [r".*: warning: unused parameter '.*'"]}, medium('Ignoreing return value of function',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused', [r".*: warning: ignoring return value of function .+Wunused-result"]),
'description': 'Unused function, variable, label, comparison, etc.', medium('Missing initializer',
'patterns': [r".*: warning: '.+' defined but not used", [r".*: warning: missing initializer"]),
r".*: warning: unused function '.+'", medium('Need virtual destructor',
r".*: warning: unused label '.+'", [r".*: warning: delete called .* has virtual functions but non-virtual destructor"]),
r".*: warning: relational comparison result unused", skip('skip, near initialization for ...',
r".*: warning: lambda capture .* is not used", [r".*: warning: \(near initialization for '.+'\)"]),
r".*: warning: private field '.+' is not used", medium('Expansion of data or time macro',
r".*: warning: unused variable '.+'"]}, [r".*: warning: expansion of date or time macro is not reproducible"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-value', medium('Macro expansion has undefined behavior',
'description': 'Statement with no effect or result unused', [r".*: warning: macro expansion .* has undefined behavior"]),
'patterns': [r".*: warning: statement with no effect", medium('Format string does not match arguments',
r".*: warning: expression result unused"]}, [r".*: warning: format '.+' expects type '.+', but argument [0-9]+ has type '.+'",
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-result', r".*: warning: more '%' conversions than data arguments",
'description': 'Ignoreing return value of function', r".*: warning: data argument not used by format string",
'patterns': [r".*: warning: ignoring return value of function .+Wunused-result"]}, r".*: warning: incomplete format specifier",
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-field-initializers', r".*: warning: unknown conversion type .* in format",
'description': 'Missing initializer', r".*: warning: format .+ expects .+ but argument .+Wformat=",
'patterns': [r".*: warning: missing initializer"]}, r".*: warning: field precision should have .+ but argument has .+Wformat",
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wdelete-non-virtual-dtor', r".*: warning: format specifies type .+ but the argument has .*type .+Wformat"]),
'description': 'Need virtual destructor', medium('Too many arguments for format string',
'patterns': [r".*: warning: delete called .* has virtual functions but non-virtual destructor"]}, [r".*: warning: too many arguments for format"]),
{'category': 'cont.', 'severity': Severity.SKIP, medium('Too many arguments in call',
'description': 'skip, near initialization for ...', [r".*: warning: too many arguments in call to "]),
'patterns': [r".*: warning: \(near initialization for '.+'\)"]}, medium('Invalid format specifier',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wdate-time', [r".*: warning: invalid .+ specifier '.+'.+format-invalid-specifier"]),
'description': 'Expansion of data or time macro', medium('Comparison between signed and unsigned',
'patterns': [r".*: warning: expansion of date or time macro is not reproducible"]}, [r".*: warning: comparison between signed and unsigned",
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wexpansion-to-defined', r".*: warning: comparison of promoted \~unsigned with unsigned",
'description': 'Macro expansion has undefined behavior', r".*: warning: signed and unsigned type in conditional expression"]),
'patterns': [r".*: warning: macro expansion .* has undefined behavior"]}, medium('Comparison between enum and non-enum',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat', [r".*: warning: enumeral and non-enumeral type in conditional expression"]),
'description': 'Format string does not match arguments', medium('libpng: zero area',
'patterns': [r".*: warning: format '.+' expects type '.+', but argument [0-9]+ has type '.+'", [r".*libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area"]),
r".*: warning: more '%' conversions than data arguments", medium('Missing braces around initializer',
r".*: warning: data argument not used by format string", [r".*: warning: missing braces around initializer.*"]),
r".*: warning: incomplete format specifier", harmless('No newline at end of file',
r".*: warning: unknown conversion type .* in format", [r".*: warning: no newline at end of file"]),
r".*: warning: format .+ expects .+ but argument .+Wformat=", harmless('Missing space after macro name',
r".*: warning: field precision should have .+ but argument has .+Wformat", [r".*: warning: missing whitespace after the macro name"]),
r".*: warning: format specifies type .+ but the argument has .*type .+Wformat"]}, low('Cast increases required alignment',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat-extra-args', [r".*: warning: cast from .* to .* increases required alignment .*"]),
'description': 'Too many arguments for format string', medium('Qualifier discarded',
'patterns': [r".*: warning: too many arguments for format"]}, [r".*: warning: passing argument [0-9]+ of '.+' discards qualifiers from pointer target type",
{'category': 'C/C++', 'severity': Severity.MEDIUM, r".*: warning: assignment discards qualifiers from pointer target type",
'description': 'Too many arguments in call', r".*: warning: passing .+ to parameter of type .+ discards qualifiers",
'patterns': [r".*: warning: too many arguments in call to "]}, r".*: warning: assigning to .+ from .+ discards qualifiers",
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat-invalid-specifier', r".*: warning: initializing .+ discards qualifiers .+types-discards-qualifiers",
'description': 'Invalid format specifier', r".*: warning: return discards qualifiers from pointer target type"]),
'patterns': [r".*: warning: invalid .+ specifier '.+'.+format-invalid-specifier"]}, medium('Unknown attribute',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-compare', [r".*: warning: unknown attribute '.+'"]),
'description': 'Comparison between signed and unsigned', medium('Attribute ignored',
'patterns': [r".*: warning: comparison between signed and unsigned", [r".*: warning: '_*packed_*' attribute ignored",
r".*: warning: comparison of promoted \~unsigned with unsigned", r".*: warning: attribute declaration must precede definition .+ignored-attributes"]),
r".*: warning: signed and unsigned type in conditional expression"]}, medium('Visibility problem',
{'category': 'C/C++', 'severity': Severity.MEDIUM, [r".*: warning: declaration of '.+' will not be visible outside of this function"]),
'description': 'Comparison between enum and non-enum', medium('Visibility mismatch',
'patterns': [r".*: warning: enumeral and non-enumeral type in conditional expression"]}, [r".*: warning: '.+' declared with greater visibility than the type of its field '.+'"]),
{'category': 'libpng', 'severity': Severity.MEDIUM, medium('Shift count greater than width of type',
'description': 'libpng: zero area', [r".*: warning: (left|right) shift count >= width of type"]),
'patterns': [r".*libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area"]}, medium('extern <foo> is initialized',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-braces', [r".*: warning: '.+' initialized and declared 'extern'",
'description': 'Missing braces around initializer', r".*: warning: 'extern' variable has an initializer"]),
'patterns': [r".*: warning: missing braces around initializer.*"]}, medium('Old style declaration',
{'category': 'C/C++', 'severity': Severity.HARMLESS, [r".*: warning: 'static' is not at beginning of declaration"]),
'description': 'No newline at end of file', medium('Missing return value',
'patterns': [r".*: warning: no newline at end of file"]}, [r".*: warning: control reaches end of non-void function"]),
{'category': 'C/C++', 'severity': Severity.HARMLESS, medium('Implicit int type',
'description': 'Missing space after macro name', [r".*: warning: type specifier missing, defaults to 'int'",
'patterns': [r".*: warning: missing whitespace after the macro name"]}, r".*: warning: type defaults to 'int' in declaration of '.+'"]),
{'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcast-align', medium('Main function should return int',
'description': 'Cast increases required alignment', [r".*: warning: return type of 'main' is not 'int'"]),
'patterns': [r".*: warning: cast from .* to .* increases required alignment .*"]}, medium('Variable may be used uninitialized',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wcast-qual', [r".*: warning: '.+' may be used uninitialized in this function"]),
'description': 'Qualifier discarded', high('Variable is used uninitialized',
'patterns': [r".*: warning: passing argument [0-9]+ of '.+' discards qualifiers from pointer target type", [r".*: warning: '.+' is used uninitialized in this function",
r".*: warning: assignment discards qualifiers from pointer target type", r".*: warning: variable '.+' is uninitialized when used here"]),
r".*: warning: passing .+ to parameter of type .+ discards qualifiers", medium('ld: possible enum size mismatch',
r".*: warning: assigning to .+ from .+ discards qualifiers", [r".*: warning: .* uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail"]),
r".*: warning: initializing .+ discards qualifiers .+types-discards-qualifiers", medium('Pointer targets differ in signedness',
r".*: warning: return discards qualifiers from pointer target type"]}, [r".*: warning: pointer targets in initialization differ in signedness",
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunknown-attributes', r".*: warning: pointer targets in assignment differ in signedness",
'description': 'Unknown attribute', r".*: warning: pointer targets in return differ in signedness",
'patterns': [r".*: warning: unknown attribute '.+'"]}, r".*: warning: pointer targets in passing argument [0-9]+ of '.+' differ in signedness"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wignored-attributes', medium('Assuming overflow does not occur',
'description': 'Attribute ignored', [r".*: warning: assuming signed overflow does not occur when assuming that .* is always (true|false)"]),
'patterns': [r".*: warning: '_*packed_*' attribute ignored", medium('Suggest adding braces around empty body',
r".*: warning: attribute declaration must precede definition .+ignored-attributes"]}, [r".*: warning: suggest braces around empty body in an 'if' statement",
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wvisibility', r".*: warning: empty body in an if-statement",
'description': 'Visibility problem', r".*: warning: suggest braces around empty body in an 'else' statement",
'patterns': [r".*: warning: declaration of '.+' will not be visible outside of this function"]}, r".*: warning: empty body in an else-statement"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wattributes', medium('Suggest adding parentheses',
'description': 'Visibility mismatch', [r".*: warning: suggest explicit braces to avoid ambiguous 'else'",
'patterns': [r".*: warning: '.+' declared with greater visibility than the type of its field '.+'"]}, r".*: warning: suggest parentheses around arithmetic in operand of '.+'",
{'category': 'C/C++', 'severity': Severity.MEDIUM, r".*: warning: suggest parentheses around comparison in operand of '.+'",
'description': 'Shift count greater than width of type', r".*: warning: logical not is only applied to the left hand side of this comparison",
'patterns': [r".*: warning: (left|right) shift count >= width of type"]}, r".*: warning: using the result of an assignment as a condition without parentheses",
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wextern-initializer', r".*: warning: .+ has lower precedence than .+ be evaluated first .+Wparentheses",
'description': 'extern <foo> is initialized', r".*: warning: suggest parentheses around '.+?' .+ '.+?'",
'patterns': [r".*: warning: '.+' initialized and declared 'extern'", r".*: warning: suggest parentheses around assignment used as truth value"]),
r".*: warning: 'extern' variable has an initializer"]}, medium('Static variable used in non-static inline function',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wold-style-declaration', [r".*: warning: '.+' is static but used in inline function '.+' which is not static"]),
'description': 'Old style declaration', medium('No type or storage class (will default to int)',
'patterns': [r".*: warning: 'static' is not at beginning of declaration"]}, [r".*: warning: data definition has no type or storage class"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wreturn-type', skip('skip, parameter name (without types) in function declaration',
'description': 'Missing return value', [r".*: warning: parameter names \(without types\) in function declaration"]),
'patterns': [r".*: warning: control reaches end of non-void function"]}, medium('Dereferencing <foo> breaks strict aliasing rules',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit-int', [r".*: warning: dereferencing .* break strict-aliasing rules"]),
'description': 'Implicit int type', medium('Cast from pointer to integer of different size',
'patterns': [r".*: warning: type specifier missing, defaults to 'int'", [r".*: warning: cast from pointer to integer of different size",
r".*: warning: type defaults to 'int' in declaration of '.+'"]}, r".*: warning: initialization makes pointer from integer without a cast"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmain-return-type', medium('Cast to pointer from integer of different size',
'description': 'Main function should return int', [r".*: warning: cast to pointer from integer of different size"]),
'patterns': [r".*: warning: return type of 'main' is not 'int'"]}, medium('Macro redefined',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wuninitialized', [r".*: warning: '.+' macro redefined"]),
'description': 'Variable may be used uninitialized', skip('skip, ... location of the previous definition',
'patterns': [r".*: warning: '.+' may be used uninitialized in this function"]}, [r".*: warning: this is the location of the previous definition"]),
{'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wuninitialized', medium('ld: type and size of dynamic symbol are not defined',
'description': 'Variable is used uninitialized', [r".*: warning: type and size of dynamic symbol `.+' are not defined"]),
'patterns': [r".*: warning: '.+' is used uninitialized in this function", medium('Pointer from integer without cast',
r".*: warning: variable '.+' is uninitialized when used here"]}, [r".*: warning: assignment makes pointer from integer without a cast"]),
{'category': 'ld', 'severity': Severity.MEDIUM, 'option': '-fshort-enums', medium('Pointer from integer without cast',
'description': 'ld: possible enum size mismatch', [r".*: warning: passing argument [0-9]+ of '.+' makes pointer from integer without a cast"]),
'patterns': [r".*: warning: .* uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail"]}, medium('Integer from pointer without cast',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-sign', [r".*: warning: assignment makes integer from pointer without a cast"]),
'description': 'Pointer targets differ in signedness', medium('Integer from pointer without cast',
'patterns': [r".*: warning: pointer targets in initialization differ in signedness", [r".*: warning: passing argument [0-9]+ of '.+' makes integer from pointer without a cast"]),
r".*: warning: pointer targets in assignment differ in signedness", medium('Integer from pointer without cast',
r".*: warning: pointer targets in return differ in signedness", [r".*: warning: return makes integer from pointer without a cast"]),
r".*: warning: pointer targets in passing argument [0-9]+ of '.+' differ in signedness"]}, medium('Ignoring pragma',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-overflow', [r".*: warning: ignoring #pragma .+"]),
'description': 'Assuming overflow does not occur', medium('Pragma warning messages',
'patterns': [r".*: warning: assuming signed overflow does not occur when assuming that .* is always (true|false)"]}, [r".*: warning: .+W#pragma-messages"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wempty-body', medium('Variable might be clobbered by longjmp or vfork',
'description': 'Suggest adding braces around empty body', [r".*: warning: variable '.+' might be clobbered by 'longjmp' or 'vfork'"]),
'patterns': [r".*: warning: suggest braces around empty body in an 'if' statement", medium('Argument might be clobbered by longjmp or vfork',
r".*: warning: empty body in an if-statement", [r".*: warning: argument '.+' might be clobbered by 'longjmp' or 'vfork'"]),
r".*: warning: suggest braces around empty body in an 'else' statement", medium('Redundant declaration',
r".*: warning: empty body in an else-statement"]}, [r".*: warning: redundant redeclaration of '.+'"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wparentheses', skip('skip, previous declaration ... was here',
'description': 'Suggest adding parentheses', [r".*: warning: previous declaration of '.+' was here"]),
'patterns': [r".*: warning: suggest explicit braces to avoid ambiguous 'else'", high('Enum value not handled in switch',
r".*: warning: suggest parentheses around arithmetic in operand of '.+'", [r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"]),
r".*: warning: suggest parentheses around comparison in operand of '.+'", medium('User defined warnings',
r".*: warning: logical not is only applied to the left hand side of this comparison", [r".*: warning: .* \[-Wuser-defined-warnings\]$"]),
r".*: warning: using the result of an assignment as a condition without parentheses", medium('Taking address of temporary',
r".*: warning: .+ has lower precedence than .+ be evaluated first .+Wparentheses", [r".*: warning: taking address of temporary"]),
r".*: warning: suggest parentheses around '.+?' .+ '.+?'", medium('Taking address of packed member',
r".*: warning: suggest parentheses around assignment used as truth value"]}, [r".*: warning: taking address of packed member"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, medium('Possible broken line continuation',
'description': 'Static variable used in non-static inline function', [r".*: warning: backslash and newline separated by space"]),
'patterns': [r".*: warning: '.+' is static but used in inline function '.+' which is not static"]}, medium('Undefined variable template',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit int', [r".*: warning: instantiation of variable .* no definition is available"]),
'description': 'No type or storage class (will default to int)', medium('Inline function is not defined',
'patterns': [r".*: warning: data definition has no type or storage class"]}, [r".*: warning: inline function '.*' is not defined"]),
{'category': 'cont.', 'severity': Severity.SKIP, medium('Excess elements in initializer',
'description': 'skip, parameter name (without types) in function declaration', [r".*: warning: excess elements in .+ initializer"]),
'patterns': [r".*: warning: parameter names \(without types\) in function declaration"]}, medium('Decimal constant is unsigned only in ISO C90',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-aliasing', [r".*: warning: this decimal constant is unsigned only in ISO C90"]),
'description': 'Dereferencing <foo> breaks strict aliasing rules', medium('main is usually a function',
'patterns': [r".*: warning: dereferencing .* break strict-aliasing rules"]}, [r".*: warning: 'main' is usually a function"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-to-int-cast', medium('Typedef ignored',
'description': 'Cast from pointer to integer of different size', [r".*: warning: 'typedef' was ignored in this declaration"]),
'patterns': [r".*: warning: cast from pointer to integer of different size", high('Address always evaluates to true',
r".*: warning: initialization makes pointer from integer without a cast"]}, [r".*: warning: the address of '.+' will always evaluate as 'true'"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wint-to-pointer-cast', fixmenow('Freeing a non-heap object',
'description': 'Cast to pointer from integer of different size', [r".*: warning: attempt to free a non-heap object '.+'"]),
'patterns': [r".*: warning: cast to pointer from integer of different size"]}, medium('Array subscript has type char',
{'category': 'C/C++', 'severity': Severity.MEDIUM, [r".*: warning: array subscript .+ type 'char'.+Wchar-subscripts"]),
'description': 'Macro redefined', medium('Constant too large for type',
'patterns': [r".*: warning: '.+' macro redefined"]}, [r".*: warning: integer constant is too large for '.+' type"]),
{'category': 'cont.', 'severity': Severity.SKIP, medium('Constant too large for type, truncated',
'description': 'skip, ... location of the previous definition', [r".*: warning: large integer implicitly truncated to unsigned type"]),
'patterns': [r".*: warning: this is the location of the previous definition"]}, medium('Overflow in expression',
{'category': 'ld', 'severity': Severity.MEDIUM, [r".*: warning: overflow in expression; .*Winteger-overflow"]),
'description': 'ld: type and size of dynamic symbol are not defined', medium('Overflow in implicit constant conversion',
'patterns': [r".*: warning: type and size of dynamic symbol `.+' are not defined"]}, [r".*: warning: overflow in implicit constant conversion"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, medium('Declaration does not declare anything',
'description': 'Pointer from integer without cast', [r".*: warning: declaration 'class .+' does not declare anything"]),
'patterns': [r".*: warning: assignment makes pointer from integer without a cast"]}, medium('Initialization order will be different',
{'category': 'C/C++', 'severity': Severity.MEDIUM, [r".*: warning: '.+' will be initialized after",
'description': 'Pointer from integer without cast', r".*: warning: field .+ will be initialized after .+Wreorder"]),
'patterns': [r".*: warning: passing argument [0-9]+ of '.+' makes pointer from integer without a cast"]}, skip('skip, ....',
{'category': 'C/C++', 'severity': Severity.MEDIUM, [r".*: warning: '.+'"]),
'description': 'Integer from pointer without cast', skip('skip, base ...',
'patterns': [r".*: warning: assignment makes integer from pointer without a cast"]}, [r".*: warning: base '.+'"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, skip('skip, when initialized here',
'description': 'Integer from pointer without cast', [r".*: warning: when initialized here"]),
'patterns': [r".*: warning: passing argument [0-9]+ of '.+' makes integer from pointer without a cast"]}, medium('Parameter type not specified',
{'category': 'C/C++', 'severity': Severity.MEDIUM, [r".*: warning: type of '.+' defaults to 'int'"]),
'description': 'Integer from pointer without cast', medium('Missing declarations',
'patterns': [r".*: warning: return makes integer from pointer without a cast"]}, [r".*: warning: declaration does not declare anything"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunknown-pragmas', medium('Missing noreturn',
'description': 'Ignoring pragma', [r".*: warning: function '.*' could be declared with attribute 'noreturn'"]),
'patterns': [r".*: warning: ignoring #pragma .+"]}, medium('User warning',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-W#pragma-messages', [r".*: warning: #warning "".+"""]),
'description': 'Pragma warning messages', medium('Vexing parsing problem',
'patterns': [r".*: warning: .+W#pragma-messages"]}, [r".*: warning: empty parentheses interpreted as a function declaration"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wclobbered', medium('Dereferencing void*',
'description': 'Variable might be clobbered by longjmp or vfork', [r".*: warning: dereferencing 'void \*' pointer"]),
'patterns': [r".*: warning: variable '.+' might be clobbered by 'longjmp' or 'vfork'"]}, medium('Comparison of pointer and integer',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wclobbered', [r".*: warning: ordered comparison of pointer with integer zero",
'description': 'Argument might be clobbered by longjmp or vfork', r".*: warning: .*comparison between pointer and integer"]),
'patterns': [r".*: warning: argument '.+' might be clobbered by 'longjmp' or 'vfork'"]}, medium('Use of error-prone unary operator',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wredundant-decls', [r".*: warning: use of unary operator that may be intended as compound assignment"]),
'description': 'Redundant declaration', medium('Conversion of string constant to non-const char*',
'patterns': [r".*: warning: redundant redeclaration of '.+'"]}, [r".*: warning: deprecated conversion from string constant to '.+'"]),
{'category': 'cont.', 'severity': Severity.SKIP, medium('Function declaration isn''t a prototype',
'description': 'skip, previous declaration ... was here', [r".*: warning: function declaration isn't a prototype"]),
'patterns': [r".*: warning: previous declaration of '.+' was here"]}, medium('Type qualifiers ignored on function return value',
{'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wswitch-enum', [r".*: warning: type qualifiers ignored on function return type",
'description': 'Enum value not handled in switch', r".*: warning: .+ type qualifier .+ has no effect .+Wignored-qualifiers"]),
'patterns': [r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"]}, medium('<foo> declared inside parameter list, scope limited to this definition',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wuser-defined-warnings', [r".*: warning: '.+' declared inside parameter list"]),
'description': 'User defined warnings', skip('skip, its scope is only this ...',
'patterns': [r".*: warning: .* \[-Wuser-defined-warnings\]$"]}, [r".*: warning: its scope is only this definition or declaration, which is probably not what you want"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, low('Line continuation inside comment',
'description': 'Taking address of temporary', [r".*: warning: multi-line comment"]),
'patterns': [r".*: warning: taking address of temporary"]}, low('Comment inside comment',
{'category': 'C/C++', 'severity': Severity.MEDIUM, [r".*: warning: '.+' within block comment .*-Wcomment"]),
'description': 'Taking address of packed member', low('Deprecated declarations',
'patterns': [r".*: warning: taking address of packed member"]}, [r".*: warning: .+ is deprecated.+deprecated-declarations"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, low('Deprecated register',
'description': 'Possible broken line continuation', [r".*: warning: 'register' storage class specifier is deprecated"]),
'patterns': [r".*: warning: backslash and newline separated by space"]}, low('Converts between pointers to integer types with different sign',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wundefined-var-template', [r".*: warning: .+ converts between pointers to integer types with different sign"]),
'description': 'Undefined variable template', harmless('Extra tokens after #endif',
'patterns': [r".*: warning: instantiation of variable .* no definition is available"]}, [r".*: warning: extra tokens at end of #endif directive"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wundefined-inline', medium('Comparison between different enums',
'description': 'Inline function is not defined', [r".*: warning: comparison between '.+' and '.+'.+Wenum-compare",
'patterns': [r".*: warning: inline function '.*' is not defined"]}, r".*: warning: comparison of .* enumeration types .*-Wenum-compare-switch"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, medium('Conversion may change value',
'description': 'Excess elements in initializer', [r".*: warning: converting negative value '.+' to '.+'",
'patterns': [r".*: warning: excess elements in .+ initializer"]}, r".*: warning: conversion to '.+' .+ may (alter|change)"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, medium('Converting to non-pointer type from NULL',
'description': 'Decimal constant is unsigned only in ISO C90', [r".*: warning: converting to non-pointer type '.+' from NULL"]),
'patterns': [r".*: warning: this decimal constant is unsigned only in ISO C90"]}, medium('Implicit sign conversion',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmain', [r".*: warning: implicit conversion changes signedness"]),
'description': 'main is usually a function', medium('Converting NULL to non-pointer type',
'patterns': [r".*: warning: 'main' is usually a function"]}, [r".*: warning: implicit conversion of NULL constant to '.+'"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, medium('Zero used as null pointer',
'description': 'Typedef ignored', [r".*: warning: expression .* zero treated as a null pointer constant"]),
'patterns': [r".*: warning: 'typedef' was ignored in this declaration"]}, medium('Compare pointer to null character',
{'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Waddress', [r".*: warning: comparing a pointer to a null character constant"]),
'description': 'Address always evaluates to true', medium('Implicit conversion changes value or loses precision',
'patterns': [r".*: warning: the address of '.+' will always evaluate as 'true'"]}, [r".*: warning: implicit conversion .* changes value from .* to .*-conversion",
{'category': 'C/C++', 'severity': Severity.FIXMENOW, r".*: warning: implicit conversion loses integer precision:"]),
'description': 'Freeing a non-heap object', medium('Passing NULL as non-pointer argument',
'patterns': [r".*: warning: attempt to free a non-heap object '.+'"]}, [r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wchar-subscripts', medium('Class seems unusable because of private ctor/dtor',
'description': 'Array subscript has type char', [r".*: warning: all member functions in class '.+' are private"]),
'patterns': [r".*: warning: array subscript .+ type 'char'.+Wchar-subscripts"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Constant too large for type',
'patterns': [r".*: warning: integer constant is too large for '.+' type"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Woverflow',
'description': 'Constant too large for type, truncated',
'patterns': [r".*: warning: large integer implicitly truncated to unsigned type"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Winteger-overflow',
'description': 'Overflow in expression',
'patterns': [r".*: warning: overflow in expression; .*Winteger-overflow"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Woverflow',
'description': 'Overflow in implicit constant conversion',
'patterns': [r".*: warning: overflow in implicit constant conversion"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Declaration does not declare anything',
'patterns': [r".*: warning: declaration 'class .+' does not declare anything"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wreorder',
'description': 'Initialization order will be different',
'patterns': [r".*: warning: '.+' will be initialized after",
r".*: warning: field .+ will be initialized after .+Wreorder"]},
{'category': 'cont.', 'severity': Severity.SKIP,
'description': 'skip, ....',
'patterns': [r".*: warning: '.+'"]},
{'category': 'cont.', 'severity': Severity.SKIP,
'description': 'skip, base ...',
'patterns': [r".*: warning: base '.+'"]},
{'category': 'cont.', 'severity': Severity.SKIP,
'description': 'skip, when initialized here',
'patterns': [r".*: warning: when initialized here"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-parameter-type',
'description': 'Parameter type not specified',
'patterns': [r".*: warning: type of '.+' defaults to 'int'"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-declarations',
'description': 'Missing declarations',
'patterns': [r".*: warning: declaration does not declare anything"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-noreturn',
'description': 'Missing noreturn',
'patterns': [r".*: warning: function '.*' could be declared with attribute 'noreturn'"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'User warning',
'patterns': [r".*: warning: #warning "".+"""]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wvexing-parse',
'description': 'Vexing parsing problem',
'patterns': [r".*: warning: empty parentheses interpreted as a function declaration"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wextra',
'description': 'Dereferencing void*',
'patterns': [r".*: warning: dereferencing 'void \*' pointer"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Comparison of pointer and integer',
'patterns': [r".*: warning: ordered comparison of pointer with integer zero",
r".*: warning: .*comparison between pointer and integer"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Use of error-prone unary operator',
'patterns': [r".*: warning: use of unary operator that may be intended as compound assignment"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wwrite-strings',
'description': 'Conversion of string constant to non-const char*',
'patterns': [r".*: warning: deprecated conversion from string constant to '.+'"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-prototypes',
'description': 'Function declaration isn''t a prototype',
'patterns': [r".*: warning: function declaration isn't a prototype"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wignored-qualifiers',
'description': 'Type qualifiers ignored on function return value',
'patterns': [r".*: warning: type qualifiers ignored on function return type",
r".*: warning: .+ type qualifier .+ has no effect .+Wignored-qualifiers"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': '<foo> declared inside parameter list, scope limited to this definition',
'patterns': [r".*: warning: '.+' declared inside parameter list"]},
{'category': 'cont.', 'severity': Severity.SKIP,
'description': 'skip, its scope is only this ...',
'patterns': [r".*: warning: its scope is only this definition or declaration, which is probably not what you want"]},
{'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcomment',
'description': 'Line continuation inside comment',
'patterns': [r".*: warning: multi-line comment"]},
{'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcomment',
'description': 'Comment inside comment',
'patterns': [r".*: warning: '.+' within block comment .*-Wcomment"]},
{'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wdeprecated-declarations',
'description': 'Deprecated declarations',
'patterns': [r".*: warning: .+ is deprecated.+deprecated-declarations"]},
{'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wdeprecated-register',
'description': 'Deprecated register',
'patterns': [r".*: warning: 'register' storage class specifier is deprecated"]},
{'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wpointer-sign',
'description': 'Converts between pointers to integer types with different sign',
'patterns': [r".*: warning: .+ converts between pointers to integer types with different sign"]},
{'category': 'C/C++', 'severity': Severity.HARMLESS,
'description': 'Extra tokens after #endif',
'patterns': [r".*: warning: extra tokens at end of #endif directive"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wenum-compare',
'description': 'Comparison between different enums',
'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',
'description': 'Conversion may change value',
'patterns': [r".*: warning: converting negative value '.+' to '.+'",
r".*: warning: conversion to '.+' .+ may (alter|change)"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wconversion-null',
'description': 'Converting to non-pointer type from NULL',
'patterns': [r".*: warning: converting to non-pointer type '.+' from NULL"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-conversion',
'description': 'Implicit sign conversion',
'patterns': [r".*: warning: implicit conversion changes signedness"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnull-conversion',
'description': 'Converting NULL to non-pointer type',
'patterns': [r".*: warning: implicit conversion of NULL constant to '.+'"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnon-literal-null-conversion',
'description': 'Zero used as null pointer',
'patterns': [r".*: warning: expression .* zero treated as a null pointer constant"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-compare',
'description': 'Compare pointer to null character',
'patterns': [r".*: warning: comparing a pointer to a null character constant"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Implicit conversion changes value or loses precision',
'patterns': [r".*: warning: implicit conversion .* changes value from .* to .*-conversion",
r".*: warning: implicit conversion loses integer precision:"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Passing NULL as non-pointer argument',
'patterns': [r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wctor-dtor-privacy',
'description': 'Class seems unusable because of private ctor/dtor',
'patterns': [r".*: warning: all member functions in class '.+' are private"]},
# skip this next one, because it only points out some RefBase-based classes # skip this next one, because it only points out some RefBase-based classes
# where having a private destructor is perfectly fine # where having a private destructor is perfectly fine
{'category': 'C/C++', 'severity': Severity.SKIP, 'option': '-Wctor-dtor-privacy', skip('Class seems unusable because of private ctor/dtor',
'description': 'Class seems unusable because of private ctor/dtor', [r".*: warning: 'class .+' only defines a private destructor and has no friends"]),
'patterns': [r".*: warning: 'class .+' only defines a private destructor and has no friends"]}, medium('Class seems unusable because of private ctor/dtor',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wctor-dtor-privacy', [r".*: warning: 'class .+' only defines private constructors and has no friends"]),
'description': 'Class seems unusable because of private ctor/dtor', medium('In-class initializer for static const float/double',
'patterns': [r".*: warning: 'class .+' only defines private constructors and has no friends"]}, [r".*: warning: in-class initializer for static data member of .+const (float|double)"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wgnu-static-float-init', medium('void* used in arithmetic',
'description': 'In-class initializer for static const float/double', [r".*: warning: pointer of type 'void \*' used in (arithmetic|subtraction)",
'patterns': [r".*: warning: in-class initializer for static data member of .+const (float|double)"]}, r".*: warning: arithmetic on .+ to void is a GNU extension.*Wpointer-arith",
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-arith', r".*: warning: wrong type argument to increment"]),
'description': 'void* used in arithmetic', medium('Overload resolution chose to promote from unsigned or enum to signed type',
'patterns': [r".*: warning: pointer of type 'void \*' used in (arithmetic|subtraction)", [r".*: warning: passing '.+' chooses '.+' over '.+'.*Wsign-promo"]),
r".*: warning: arithmetic on .+ to void is a GNU extension.*Wpointer-arith", skip('skip, in call to ...',
r".*: warning: wrong type argument to increment"]}, [r".*: warning: in call to '.+'"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-promo', high('Base should be explicitly initialized in copy constructor',
'description': 'Overload resolution chose to promote from unsigned or enum to signed type', [r".*: warning: base class '.+' should be explicitly initialized in the copy constructor"]),
'patterns': [r".*: warning: passing '.+' chooses '.+' over '.+'.*Wsign-promo"]}, medium('Return value from void function',
{'category': 'cont.', 'severity': Severity.SKIP, [r".*: warning: 'return' with a value, in function returning void"]),
'description': 'skip, in call to ...', medium('Multi-character character constant',
'patterns': [r".*: warning: in call to '.+'"]}, [r".*: warning: multi-character character constant"]),
{'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wextra', medium('Conversion from string literal to char*',
'description': 'Base should be explicitly initialized in copy constructor', [r".*: warning: .+ does not allow conversion from string literal to 'char \*'"]),
'patterns': [r".*: warning: base class '.+' should be explicitly initialized in the copy constructor"]}, low('Extra \';\'',
{'category': 'C/C++', 'severity': Severity.MEDIUM, [r".*: warning: extra ';' .+extra-semi"]),
'description': 'Return value from void function', low('Useless specifier',
'patterns': [r".*: warning: 'return' with a value, in function returning void"]}, [r".*: warning: useless storage class specifier in empty declaration"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'multichar', low('Duplicate declaration specifier',
'description': 'Multi-character character constant', [r".*: warning: duplicate '.+' declaration specifier"]),
'patterns': [r".*: warning: multi-character character constant"]}, low('Comparison of self is always false',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'writable-strings', [r".*: self-comparison always evaluates to false"]),
'description': 'Conversion from string literal to char*', low('Logical op with constant operand',
'patterns': [r".*: warning: .+ does not allow conversion from string literal to 'char \*'"]}, [r".*: use of logical '.+' with constant operand"]),
{'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wextra-semi', low('Needs a space between literal and string macro',
'description': 'Extra \';\'', [r".*: warning: invalid suffix on literal.+ requires a space .+Wliteral-suffix"]),
'patterns': [r".*: warning: extra ';' .+extra-semi"]}, low('Warnings from #warning',
{'category': 'C/C++', 'severity': Severity.LOW, [r".*: warning: .+-W#warnings"]),
'description': 'Useless specifier', low('Using float/int absolute value function with int/float argument',
'patterns': [r".*: warning: useless storage class specifier in empty declaration"]}, [r".*: warning: using .+ absolute value function .+ when argument is .+ type .+Wabsolute-value",
{'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wduplicate-decl-specifier', r".*: warning: absolute value function '.+' given .+ which may cause truncation .+Wabsolute-value"]),
'description': 'Duplicate declaration specifier', low('Using C++11 extensions',
'patterns': [r".*: warning: duplicate '.+' declaration specifier"]}, [r".*: warning: 'auto' type specifier is a C\+\+11 extension"]),
{'category': 'C/C++', 'severity': Severity.LOW, 'option': 'tautological-compare', low('Refers to implicitly defined namespace',
'description': 'Comparison of self is always false', [r".*: warning: using directive refers to implicitly-defined namespace .+"]),
'patterns': [r".*: self-comparison always evaluates to false"]}, low('Invalid pp token',
{'category': 'C/C++', 'severity': Severity.LOW, 'option': 'constant-logical-operand', [r".*: warning: missing .+Winvalid-pp-token"]),
'description': 'Logical op with constant operand', low('need glibc to link',
'patterns': [r".*: use of logical '.+' with constant operand"]}, [r".*: warning: .* requires at runtime .* glibc .* for linking"]),
{'category': 'C/C++', 'severity': Severity.LOW, 'option': 'literal-suffix', medium('Operator new returns NULL',
'description': 'Needs a space between literal and string macro', [r".*: warning: 'operator new' must not return NULL unless it is declared 'throw\(\)' .+"]),
'patterns': [r".*: warning: invalid suffix on literal.+ requires a space .+Wliteral-suffix"]}, medium('NULL used in arithmetic',
{'category': 'C/C++', 'severity': Severity.LOW, 'option': '#warnings', [r".*: warning: NULL used in arithmetic",
'description': 'Warnings from #warning', r".*: warning: comparison between NULL and non-pointer"]),
'patterns': [r".*: warning: .+-W#warnings"]}, medium('Misspelled header guard',
{'category': 'C/C++', 'severity': Severity.LOW, 'option': 'absolute-value', [r".*: warning: '.+' is used as a header guard .+ followed by .+ different macro"]),
'description': 'Using float/int absolute value function with int/float argument', medium('Empty loop body',
'patterns': [r".*: warning: using .+ absolute value function .+ when argument is .+ type .+Wabsolute-value", [r".*: warning: .+ loop has empty body"]),
r".*: warning: absolute value function '.+' given .+ which may cause truncation .+Wabsolute-value"]}, medium('Implicit conversion from enumeration type',
{'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wc++11-extensions', [r".*: warning: implicit conversion from enumeration type '.+'"]),
'description': 'Using C++11 extensions', medium('case value not in enumerated type',
'patterns': [r".*: warning: 'auto' type specifier is a C\+\+11 extension"]}, [r".*: warning: case value not in enumerated type '.+'"]),
{'category': 'C/C++', 'severity': Severity.LOW, medium('Use of deprecated method',
'description': 'Refers to implicitly defined namespace', [r".*: warning: '.+' is deprecated .+"]),
'patterns': [r".*: warning: using directive refers to implicitly-defined namespace .+"]}, medium('Use of garbage or uninitialized value',
{'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Winvalid-pp-token', [r".*: warning: .+ uninitialized .+\[-Wsometimes-uninitialized\]"]),
'description': 'Invalid pp token', medium('Sizeof on array argument',
'patterns': [r".*: warning: missing .+Winvalid-pp-token"]}, [r".*: warning: sizeof on array function parameter will return"]),
{'category': 'link', 'severity': Severity.LOW, medium('Bad argument size of memory access functions',
'description': 'need glibc to link', [r".*: warning: .+\[-Wsizeof-pointer-memaccess\]"]),
'patterns': [r".*: warning: .* requires at runtime .* glibc .* for linking"]}, medium('Return value not checked',
[r".*: warning: The return value from .+ is not checked"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, medium('Possible heap pollution',
'description': 'Operator new returns NULL', [r".*: warning: .*Possible heap pollution from .+ type .+"]),
'patterns': [r".*: warning: 'operator new' must not return NULL unless it is declared 'throw\(\)' .+"]}, medium('Variable used in loop condition not modified in loop body',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnull-arithmetic', [r".*: warning: variable '.+' used in loop condition.*Wfor-loop-analysis"]),
'description': 'NULL used in arithmetic', medium('Closing a previously closed file',
'patterns': [r".*: warning: NULL used in arithmetic", [r".*: warning: Closing a previously closed file"]),
r".*: warning: comparison between NULL and non-pointer"]}, medium('Unnamed template type argument',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'header-guard', [r".*: warning: template argument.+Wunnamed-type-template-args"]),
'description': 'Misspelled header guard', medium('Unannotated fall-through between switch labels',
'patterns': [r".*: warning: '.+' is used as a header guard .+ followed by .+ different macro"]}, [r".*: warning: unannotated fall-through between switch labels.+Wimplicit-fallthrough"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'empty-body', harmless('Discarded qualifier from pointer target type',
'description': 'Empty loop body', [r".*: warning: .+ discards '.+' qualifier from pointer target type"]),
'patterns': [r".*: warning: .+ loop has empty body"]}, harmless('Use snprintf instead of sprintf',
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'enum-conversion', [r".*: warning: .*sprintf is often misused; please use snprintf"]),
'description': 'Implicit conversion from enumeration type', harmless('Unsupported optimizaton flag',
'patterns': [r".*: warning: implicit conversion from enumeration type '.+'"]}, [r".*: warning: optimization flag '.+' is not supported"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'switch', harmless('Extra or missing parentheses',
'description': 'case value not in enumerated type', [r".*: warning: equality comparison with extraneous parentheses",
'patterns': [r".*: warning: case value not in enumerated type '.+'"]}, r".*: warning: .+ within .+Wlogical-op-parentheses"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM, harmless('Mismatched class vs struct tags',
'description': 'Use of deprecated method', [r".*: warning: '.+' defined as a .+ here but previously declared as a .+mismatched-tags",
'patterns': [r".*: warning: '.+' is deprecated .+"]}, r".*: warning: .+ was previously declared as a .+mismatched-tags"]),
{'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Use of garbage or uninitialized value',
'patterns': [r".*: warning: .+ uninitialized .+\[-Wsometimes-uninitialized\]"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsizeof-array-argument',
'description': 'Sizeof on array argument',
'patterns': [r".*: warning: sizeof on array function parameter will return"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsizeof-pointer-memacces',
'description': 'Bad argument size of memory access functions',
'patterns': [r".*: warning: .+\[-Wsizeof-pointer-memaccess\]"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Return value not checked',
'patterns': [r".*: warning: The return value from .+ is not checked"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Possible heap pollution',
'patterns': [r".*: warning: .*Possible heap pollution from .+ type .+"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wfor-loop-analysis',
'description': 'Variable used in loop condition not modified in loop body',
'patterns': [r".*: warning: variable '.+' used in loop condition.*Wfor-loop-analysis"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM,
'description': 'Closing a previously closed file',
'patterns': [r".*: warning: Closing a previously closed file"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunnamed-type-template-args',
'description': 'Unnamed template type argument',
'patterns': [r".*: warning: template argument.+Wunnamed-type-template-args"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit-fallthrough',
'description': 'Unannotated fall-through between switch labels',
'patterns': [r".*: warning: unannotated fall-through between switch labels.+Wimplicit-fallthrough"]},
{'category': 'C/C++', 'severity': Severity.HARMLESS,
'description': 'Discarded qualifier from pointer target type',
'patterns': [r".*: warning: .+ discards '.+' qualifier from pointer target type"]},
{'category': 'C/C++', 'severity': Severity.HARMLESS,
'description': 'Use snprintf instead of sprintf',
'patterns': [r".*: warning: .*sprintf is often misused; please use snprintf"]},
{'category': 'C/C++', 'severity': Severity.HARMLESS,
'description': 'Unsupported optimizaton flag',
'patterns': [r".*: warning: optimization flag '.+' is not supported"]},
{'category': 'C/C++', 'severity': Severity.HARMLESS,
'description': 'Extra or missing parentheses',
'patterns': [r".*: warning: equality comparison with extraneous parentheses",
r".*: warning: .+ within .+Wlogical-op-parentheses"]},
{'category': 'C/C++', 'severity': Severity.HARMLESS, 'option': 'mismatched-tags',
'description': 'Mismatched class vs struct tags',
'patterns': [r".*: warning: '.+' defined as a .+ here but previously declared as a .+mismatched-tags",
r".*: warning: .+ was previously declared as a .+mismatched-tags"]},
] ]

View File

@ -28,7 +28,6 @@ Use option --gencsv to output warning counts in CSV format.
# warn_patterns[w]['category'] tool that issued the warning, not used now # warn_patterns[w]['category'] tool that issued the warning, not used now
# warn_patterns[w]['description'] table heading # warn_patterns[w]['description'] table heading
# warn_patterns[w]['members'] matched warnings from input # warn_patterns[w]['members'] matched warnings from input
# warn_patterns[w]['option'] compiler flag to control the warning
# warn_patterns[w]['patterns'] regular expressions to match warnings # warn_patterns[w]['patterns'] regular expressions to match warnings
# warn_patterns[w]['projects'][p] number of warnings of pattern w in p # warn_patterns[w]['projects'][p] number of warnings of pattern w in p
# warn_patterns[w]['severity'] severity tuple # warn_patterns[w]['severity'] severity tuple
@ -70,7 +69,6 @@ Use option --gencsv to output warning counts in CSV format.
# ProjectNames: project_names, or project_list[*][0] # ProjectNames: project_names, or project_list[*][0]
# WarnPatternsSeverity: warn_patterns[*]['severity'] # WarnPatternsSeverity: warn_patterns[*]['severity']
# WarnPatternsDescription: warn_patterns[*]['description'] # WarnPatternsDescription: warn_patterns[*]['description']
# WarnPatternsOption: warn_patterns[*]['option']
# WarningMessages: warning_messages # WarningMessages: warning_messages
# Warnings: warning_records # Warnings: warning_records
# StatsHeader: warning count table header row # StatsHeader: warning count table header row
@ -148,8 +146,6 @@ def initialize_arrays():
project_patterns = [re.compile(p[1]) for p in project_list] project_patterns = [re.compile(p[1]) for p in project_list]
for w in warn_patterns: for w in warn_patterns:
w['members'] = [] w['members'] = []
if 'option' not in w:
w['option'] = ''
# Each warning pattern has a 'projects' dictionary, that # Each warning pattern has a 'projects' dictionary, that
# maps a project name to number of warnings in that project. # maps a project name to number of warnings in that project.
w['projects'] = {} w['projects'] = {}
@ -357,8 +353,6 @@ def dump_fixed():
if not i['members']: if not i['members']:
fixed_patterns.append(i['description'] + ' (' + fixed_patterns.append(i['description'] + ' (' +
all_patterns(i) + ')') all_patterns(i) + ')')
if i['option']:
fixed_patterns.append(' ' + i['option'])
fixed_patterns = sorted(fixed_patterns) fixed_patterns = sorted(fixed_patterns)
print('<div id="' + anchor + '" style="display:none;"><table>') print('<div id="' + anchor + '" style="display:none;"><table>')
cur_row_class = 0 cur_row_class = 0
@ -789,8 +783,6 @@ def emit_js_data():
# pytype: enable=attribute-error # pytype: enable=attribute-error
emit_const_html_string_array('WarnPatternsDescription', emit_const_html_string_array('WarnPatternsDescription',
[w['description'] for w in warn_patterns]) [w['description'] for w in warn_patterns])
emit_const_html_string_array('WarnPatternsOption',
[w['option'] for w in warn_patterns])
emit_const_html_string_array('WarningMessages', warning_messages) emit_const_html_string_array('WarningMessages', warning_messages)
emit_const_object_array('Warnings', warning_records) emit_const_object_array('Warnings', warning_records)