Add new C++ and Java warning patterns

Test: warn.py --url=http://cs/android --separator='?l=' build.log > warnings.html
Test: warn.py --gencsv build.log > warnings.csv
Change-Id: I11457fdab7abd475e835367582c0b9aab11cfe6f
This commit is contained in:
Chih-Hung Hsieh 2020-01-29 11:01:36 -08:00
parent 5c3725510a
commit b09530bd65
2 changed files with 35 additions and 0 deletions

View File

@ -435,6 +435,30 @@ warn_patterns = [
[r".*: warning: template argument.+Wunnamed-type-template-args"]),
medium('Unannotated fall-through between switch labels',
[r".*: warning: unannotated fall-through between switch labels.+Wimplicit-fallthrough"]),
medium('Invalid partial specialization',
[r".*: warning: class template partial specialization.+Winvalid-partial-specialization"]),
medium('Overlapping compatisons',
[r".*: warning: overlapping comparisons.+Wtautological-overlap-compare"]),
medium('int in bool context',
[r".*: warning: converting.+to a boolean.+Wint-in-bool-context"]),
medium('bitwise conditional parentheses',
[r".*: warning: operator.+has lower precedence.+Wbitwise-conditional-parentheses"]),
medium('sizeof array div',
[r".*: warning: .+number of elements in.+array.+Wsizeof-array-div"]),
medium('bool operation',
[r".*: warning: .+boolean.+always.+Wbool-operation"]),
medium('Undefined bool conversion',
[r".*: warning: .+may be.+always.+true.+Wundefined-bool-conversion"]),
medium('Typedef requires a name',
[r".*: warning: typedef requires a name.+Wmissing-declaration"]),
medium('Unknown escape sequence',
[r".*: warning: unknown escape sequence.+Wunknown-escape-sequence"]),
medium('Unicode whitespace',
[r".*: warning: treating Unicode.+as whitespace.+Wunicode-whitespace"]),
medium('Unused local typedef',
[r".*: warning: unused typedef.+Wunused-local-typedef"]),
medium('varargs warnings',
[r".*: warning: .*argument to 'va_start'.+\[-Wvarargs\]"]),
harmless('Discarded qualifier from pointer target type',
[r".*: warning: .+ discards '.+' qualifier from pointer target type"]),
harmless('Use snprintf instead of sprintf',

View File

@ -38,6 +38,10 @@ def java_medium(description, pattern_list):
return java_warn(Severity.MEDIUM, description, pattern_list)
def java_medium_type(name):
return java_medium(name, [r'.*\.java:.*: warning: .+ \[' + name + r'\]$'])
def java_low(description, pattern_list):
return java_warn(Severity.LOW, description, pattern_list)
@ -457,6 +461,13 @@ warn_patterns = [
[r".*: warning: \[WaitNotInLoop\] .+"]),
java_medium('A wakelock acquired with a timeout may be released by the system before calling `release`, even after checking `isHeld()`. If so, it will throw a RuntimeException. Please wrap in a try/catch block.',
[r".*: warning: \[WakelockReleasedDangerously\] .+"]),
java_medium_type('CallbackName'),
java_medium_type('ExecutorRegistration'),
java_medium_type('ListenerLast'),
java_medium_type('MissingBuildMethod'),
java_medium_type('NoByteOrShort'),
java_medium_type('SetterReturnsThis'),
java_medium_type('UseIcu'),
java_high('AndroidInjection.inject() should always be invoked before calling super.lifecycleMethod()',
[r".*: warning: \[AndroidInjectionBeforeSuper\] .+"]),
java_high('Use of class, field, or method that is not compatible with legacy Android devices',