Recognize new clang and clang-tidy warnings.

* Count new clang-tidy warnings:
    google-runtime-references
    google-runtime-operator
* Count new clang warnings:
    -Wconst-conversion similar to -Wliteral-conversion
    -Wundefined-var-template
* Modified static analyzer warning message about
    "Null passed to a callee that requires a non-null ..."
* Disable google-runtime-references by default and
  disable misc-macro-parentheses in vendor projects;
  too many old C/C++ code have this warning.

Change-Id: Ib35e0af85875aada17c92b0237b76cd5ae3bfcc8
Test: build with clang-tidy.
This commit is contained in:
Chih-Hung Hsieh 2016-07-20 10:08:51 -07:00
parent 14df2ef4d0
commit c21ddbdcce
2 changed files with 24 additions and 9 deletions

View File

@ -16,9 +16,9 @@
# Most Android source files are not clang-tidy clean yet.
# Global tidy checks include only google* and misc-macro-parentheses,
# but not google-readability*.
# but not google-readability* or google-runtime-references.
DEFAULT_GLOBAL_TIDY_CHECKS := \
-*,google*,-google-readability*,misc-macro-parentheses
-*,google*,-google-readability*,-google-runtime-references,misc-macro-parentheses
# Disable style rules usually not followed by external projects.
# Every word in DEFAULT_LOCAL_TIDY_CHECKS list has the following format:
@ -37,9 +37,9 @@ DEFAULT_LOCAL_TIDY_CHECKS := \
external/webrtc/:,google-runtime-int \
hardware/qcom:,-google-build-using-namespace \
hardware/qcom:,-google-explicit-constructor,-google-runtime-int \
vendor/lge:,-google-build-using-namespace \
vendor/lge:,-google-build-using-namespace,-misc-macro-parentheses \
vendor/lge:,-google-explicit-constructor,-google-runtime-int \
vendor/widevine:,-google-build-using-namespace \
vendor/widevine:,-google-build-using-namespace,-misc-macro-parentheses \
vendor/widevine:,-google-explicit-constructor,-google-runtime-int \
# Returns 2nd word of $(1) if $(2) has prefix of the 1st word of $(1).

View File

@ -119,7 +119,7 @@ warnpatterns = [
'patterns':[r".*: warning: incompatible implicit declaration of built-in function .+"] },
{ 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'',
'description':'Null passed as non-null argument',
'patterns':[r".*: warning: Null passed to a callee that requires a non-null argument"] },
'patterns':[r".*: warning: Null passed to a callee that requires a non-null"] },
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused-parameter',
'description':'Unused parameter',
'patterns':[r".*: warning: unused parameter '.*'"] },
@ -1366,6 +1366,9 @@ warnpatterns = [
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
'description':'Possible broken line continuation',
'patterns':[r".*: warning: backslash and newline separated by space"] },
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wundefined-var-template',
'description':'Undefined variable template',
'patterns':[r".*: warning: instantiation of variable .* no definition is available"] },
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wundefined-inline',
'description':'Inline function is not defined',
'patterns':[r".*: warning: inline function '.*' is not defined"] },
@ -1504,9 +1507,9 @@ warnpatterns = [
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], '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, 'members':[], 'option':'-Wliteral-conversion',
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
'description':'Implicit conversion changes value',
'patterns':[r".*: warning: implicit conversion .* changes value from .* to .*literal-conversion"] },
'patterns':[r".*: warning: implicit conversion .* changes value from .* to .*-conversion"] },
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
'description':'Passing NULL as non-pointer argument',
'patterns':[r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"] },
@ -1734,8 +1737,17 @@ warnpatterns = [
'description':'clang-tidy c++ core guidelines',
'patterns':[r".*: .+\[cppcoreguidelines-.+\]$"] },
{ 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
'description':'clang-tidy google-runtime',
'patterns':[r".*: .+\[google-runtime-.+\]$"] },
'description':'clang-tidy google-default-arguments',
'patterns':[r".*: .+\[google-default-arguments\]$"] },
{ 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
'description':'clang-tidy google-runtime-int',
'patterns':[r".*: .+\[google-runtime-int\]$"] },
{ 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
'description':'clang-tidy google-runtime-operator',
'patterns':[r".*: .+\[google-runtime-operator\]$"] },
{ 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
'description':'clang-tidy google-runtime-references',
'patterns':[r".*: .+\[google-runtime-references\]$"] },
{ 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
'description':'clang-tidy google-build',
'patterns':[r".*: .+\[google-build-.+\]$"] },
@ -1748,6 +1760,9 @@ warnpatterns = [
{ 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
'description':'clang-tidy google-global',
'patterns':[r".*: .+\[google-global-.+\]$"] },
{ 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
'description':'clang-tidy google- other',
'patterns':[r".*: .+\[google-.+\]$"] },
{ 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
'description':'clang-tidy modernize',
'patterns':[r".*: .+\[modernize-.+\]$"] },