Disable/allow some clang-tidy and clang warnings

* Disable bugprone-unchecked-optional-access because it
  crashed with some Android files.
* Allow misc-const-correctness and bugprone-assignment-in-if-condition
  as warnings, not to stop build as errors.
  Disable them in the global default check list.
* Allow/show clang deprecated* and array-parameter warnings for the NEXT version.

Bug: 241125373
Bug: 241819232
Bug: 241941550
Bug: 241601211
Bug: 241997913
Test: presubmit
Change-Id: Ifdc7a63c4e349b1ace4880bd002d14dc41054dcf
This commit is contained in:
Chih-Hung Hsieh 2022-08-08 22:40:50 -07:00
parent 8c9a3f2596
commit 3b93ac6784
2 changed files with 15 additions and 3 deletions

View file

@ -290,7 +290,11 @@ var (
"-Wno-deprecated-non-prototype",
}
llvmNextExtraCommonGlobalCflags = []string{}
llvmNextExtraCommonGlobalCflags = []string{
"-Wno-error=array-parameter", // http://b/241941550
"-Wno-error=deprecated-builtins", // http://b/241601211
"-Wno-error=deprecated", // in external/googletest/googletest
}
IllegalFlags = []string{
"-w",

View file

@ -37,16 +37,22 @@ var (
// http://b/216364337 - TODO: Follow-up after compiler update to
// disable or fix individual instances.
"-cert-err33-c",
// http://b/241125373
"-bugprone-unchecked-optional-access",
}
// Some clang-tidy checks are included in some tidy_checks_as_errors lists,
// but not all warnings are fixed/suppressed yet. These checks are not
// disabled in the TidyGlobalNoChecks list, so we can see them and fix/suppress them.
globalNoErrorCheckList = []string{
// http://b/155034563
"-bugprone-signed-char-misuse",
// http://b/241997913
"-bugprone-assignment-in-if-condition",
// http://b/155034972
"-bugprone-branch-clone",
// http://b/155034563
"-bugprone-signed-char-misuse",
// http://b/241819232
"-misc-const-correctness",
}
)
@ -80,8 +86,10 @@ func init() {
"misc-*",
"performance-*",
"portability-*",
"-bugprone-assignment-in-if-condition",
"-bugprone-easily-swappable-parameters",
"-bugprone-narrowing-conversions",
"-misc-const-correctness",
"-misc-no-recursion",
"-misc-non-private-member-variables-in-classes",
"-misc-unused-parameters",