aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2016-01-12 16:22:40 -0800
committerDan Willemsen <dwillemsen@google.com>2016-01-13 13:32:26 -0800
commitac5e1cb30fd05bfb10caee517521fd512fc6bd49 (patch)
tree3d02b3e1935b2f60ade8bcf1bc7a319c76a39377
parenta60cfde3f1da1015ba66bb0965079ded6913069d (diff)
downloadbuild_soong-ac5e1cb30fd05bfb10caee517521fd512fc6bd49.tar.gz
build_soong-ac5e1cb30fd05bfb10caee517521fd512fc6bd49.tar.bz2
build_soong-ac5e1cb30fd05bfb10caee517521fd512fc6bd49.zip
Change clang extra flags behavior
Move the clang extra flags into the *ClangGlobal*flags variables, instead of adding them to every clang-based module. This means that they're only applied when !no_default_compiler_flags, like make. Change-Id: I43b1378d1d932d9aecfd8724a492d0d7716f7631
-rw-r--r--cc/cc.go14
-rw-r--r--cc/clang.go10
2 files changed, 11 insertions, 13 deletions
diff --git a/cc/cc.go b/cc/cc.go
index ce3a464c..c8341d4c 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -115,13 +115,13 @@ func init() {
pctx.StaticVariable("commonGlobalCppflags", strings.Join(commonGlobalCppflags, " "))
pctx.StaticVariable("commonClangGlobalCflags",
- strings.Join(clangFilterUnknownCflags(commonGlobalCflags), " "))
+ strings.Join(append(clangFilterUnknownCflags(commonGlobalCflags), "${clangExtraCflags}"), " "))
pctx.StaticVariable("deviceClangGlobalCflags",
- strings.Join(clangFilterUnknownCflags(deviceGlobalCflags), " "))
+ strings.Join(append(clangFilterUnknownCflags(deviceGlobalCflags), "${clangExtraTargetCflags}"), " "))
pctx.StaticVariable("hostClangGlobalCflags",
strings.Join(clangFilterUnknownCflags(hostGlobalCflags), " "))
pctx.StaticVariable("commonClangGlobalCppflags",
- strings.Join(clangFilterUnknownCflags(commonGlobalCppflags), " "))
+ strings.Join(append(clangFilterUnknownCflags(commonGlobalCppflags), "${clangExtraCppflags}"), " "))
// Everything in this list is a crime against abstraction and dependency tracking.
// Do not add anything to this list.
@@ -550,12 +550,6 @@ func (c *CCBase) collectFlags(ctx common.AndroidModuleContext, toolchain Toolcha
flags.ConlyFlags = clangFilterUnknownCflags(flags.ConlyFlags)
flags.LdFlags = clangFilterUnknownCflags(flags.LdFlags)
- flags.CFlags = append(flags.CFlags, "${clangExtraCflags}")
- flags.ConlyFlags = append(flags.ConlyFlags, "${clangExtraConlyflags}")
- if ctx.Device() {
- flags.CFlags = append(flags.CFlags, "${clangExtraTargetCflags}")
- }
-
target := "-target " + toolchain.ClangTriple()
gccPrefix := "-B" + filepath.Join(toolchain.GccRoot(), toolchain.GccTriple(), "bin")
@@ -577,6 +571,8 @@ func (c *CCBase) collectFlags(ctx common.AndroidModuleContext, toolchain Toolcha
toolchain.ClangCflags(),
"${commonClangGlobalCflags}",
fmt.Sprintf("${%sClangGlobalCflags}", ctx.HostOrDevice()))
+
+ flags.ConlyFlags = append(flags.ConlyFlags, "${clangExtraConlyflags}")
} else {
flags.CppFlags = append(flags.CppFlags, "${commonGlobalCppflags}")
flags.GlobalFlags = append(flags.GlobalFlags,
diff --git a/cc/clang.go b/cc/clang.go
index 6a01010d..5e0302a5 100644
--- a/cc/clang.go
+++ b/cc/clang.go
@@ -84,10 +84,6 @@ func init() {
// See http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html.
"-Wno-unused-command-line-argument",
- // Disable -Winconsistent-missing-override until we can clean up the existing
- // codebase for it.
- "-Wno-inconsistent-missing-override",
-
// Force clang to always output color diagnostics. Ninja will strip the ANSI
// color codes if it is not running in a terminal.
"-fcolor-diagnostics",
@@ -97,6 +93,12 @@ func init() {
"-std=gnu99",
}, " "))
+ pctx.StaticVariable("clangExtraCppflags", strings.Join([]string{
+ // Disable -Winconsistent-missing-override until we can clean up the existing
+ // codebase for it.
+ "-Wno-inconsistent-missing-override",
+ }, " "))
+
pctx.StaticVariable("clangExtraTargetCflags", strings.Join([]string{
"-nostdlibinc",
}, " "))