From 6375b6d7306e4804c31cab05e63ac28e17ef2e36 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Fri, 15 Dec 2017 15:41:14 -0800 Subject: [PATCH] Call clang-tidy with -quiet unless WITH_TIDY is set. * Default builds calls clang-tidy only if enabled locally. In this case, clang-tidy should be quiet. * If WITH_TIDY is 1 or true, let clang-tidy emit default messages. * Even with -quiet and all warnings are suppressed, clang-tidy emits one line message of the number of suppressed messages. This one-liner could be suppressed in future changes. Bug: 69051430 Test: default build and build with WITH_TIDY=1 Change-Id: I3138ef45fc4372f904787bd1a391e8d88050f0b3 --- core/binary.mk | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/core/binary.mk b/core/binary.mk index c4680799b..c09a32e04 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -1736,16 +1736,15 @@ ifneq (,$(filter 1 true,$(my_tidy_enabled))) ifneq ($(LOCAL_TIDY_CHECKS),) my_tidy_checks := $(my_tidy_checks),$(LOCAL_TIDY_CHECKS) endif - # Set up global default clang-tidy flags, which is none. - my_tidy_flags := $(WITH_TIDY_FLAGS) - # Use local clang-tidy flags if specified. - ifneq ($(LOCAL_TIDY_FLAGS),) - my_tidy_flags := $(LOCAL_TIDY_FLAGS) - endif + my_tidy_flags += $(WITH_TIDY_FLAGS) $(LOCAL_TIDY_FLAGS) # If tidy flags are not specified, default to check all header files. ifeq ($(my_tidy_flags),) my_tidy_flags := $(call default_tidy_header_filter,$(LOCAL_PATH)) endif + # If clang-tidy is not enabled globally, add the -quiet flag. + ifeq (,$(filter 1 true,$(WITH_TIDY))) + my_tidy_flags += -quiet + endif # We might be using the static analyzer through clang-tidy. # https://bugs.llvm.org/show_bug.cgi?id=32914