From 4275dcf866fecf083bb7dd88669bc7330fcdeee9 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Fri, 17 Aug 2018 12:59:05 -0700 Subject: [PATCH] Define CLANG_TIDY_UNKNOWN_CFLAGS in tidy.mk * Moved from build/soong because the list is used only in make rules. Bug: 111885396 Test: build with WITH_TIDY=1 Change-Id: I6ca7420e7ed1e342a5b92996724c6659a406d5ae --- core/clang/tidy.mk | 13 +++++++++++++ core/definitions.mk | 1 - 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/clang/tidy.mk b/core/clang/tidy.mk index 868f7bc885..36c6931b70 100644 --- a/core/clang/tidy.mk +++ b/core/clang/tidy.mk @@ -14,6 +14,19 @@ # limitations under the License. # +# clang-tidy doesn't recognize every flag that clang does. This is unlikely to +# be a complete list, but we can populate this with the ones we know to avoid +# issues with clang-diagnostic-unused-command-line-argument. +# b/111885396: -flto affected header include directory; +# -fsanitize and -fwhole-program-vtables need -flto. +CLANG_TIDY_UNKNOWN_CFLAGS := \ + -Wa,% \ + -flto \ + -flto=% \ + -fsanitize=% \ + -fsanitize-% \ + -fwhole-program-vtables \ + # Returns 2nd word of $(1) if $(2) has prefix of the 1st word of $(1). define find_default_local_tidy_check2 $(if $(filter $(word 1,$(1))%,$(2)/),$(word 2,$(1))) diff --git a/core/definitions.mk b/core/definitions.mk index d36e7f0d46..4d2f5e6986 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -105,7 +105,6 @@ ALL_VINTF_MANIFEST_FRAGMENTS_LIST:= # All tests that should be skipped in presubmit check. ALL_DISABLED_PRESUBMIT_TESTS := -# CLANG_TIDY_UNKNOWN_CFLAGS is generated by build/soong. sanitize_tidy_cflags = $(filter-out $(CLANG_TIDY_UNKNOWN_CFLAGS),$1) ###########################################################