Merge "Add new C++ and Java warning patterns"

am: 502828aaa6

Change-Id: I11cc5d5382add37b1bb1c11213820348b3c36d6e
This commit is contained in:
Chih-Hung Hsieh 2020-01-29 13:39:44 -08:00 committed by android-build-merger
commit fa07aced4a
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',