From 62e75f507d7add6c5e0087ee3d4a5f51a2f95a65 Mon Sep 17 00:00:00 2001 From: Yi Kong Date: Wed, 18 Aug 2021 15:38:20 +0800 Subject: [PATCH] Re-enable unused-command-line-argument warning Turn on the warning by default, unless USE_CCACHE is set. Test: presubmit Bug: 197177755 Change-Id: I01e2b0f1be3f4bd3a8d78bb4ab053b4db227596d --- cc/config/global.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cc/config/global.go b/cc/config/global.go index 5f41f9e06..ba104916b 100644 --- a/cc/config/global.go +++ b/cc/config/global.go @@ -77,10 +77,6 @@ var ( // TODO: can we remove this now? "-Wno-reserved-id-macro", - // Workaround for ccache with clang. - // See http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html. - "-Wno-unused-command-line-argument", - // Force clang to always output color diagnostics. Ninja will strip the ANSI // color codes if it is not running in a terminal. "-fcolor-diagnostics", @@ -329,6 +325,12 @@ func init() { // Default to zero initialization. flags = append(flags, "-ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang") } + + // Workaround for ccache with clang. + // See http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html. + if ctx.Config().IsEnvTrue("USE_CCACHE") { + flags = append(flags, "-Wno-unused-command-line-argument") + } return strings.Join(flags, " ") })