diff options
author | Dan Willemsen <dwillemsen@google.com> | 2016-03-03 17:21:04 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2016-03-03 17:21:04 -0800 |
commit | be03f346b35e1e5ce5c74f57614dc26bf5f2dc4e (patch) | |
tree | d1ed421919c526ee2a46e9e2bd57fe907f58df21 | |
parent | f778e12c57b9d13a65930eb656da8e456fc05ad5 (diff) | |
download | build_soong-be03f346b35e1e5ce5c74f57614dc26bf5f2dc4e.tar.gz build_soong-be03f346b35e1e5ce5c74f57614dc26bf5f2dc4e.tar.bz2 build_soong-be03f346b35e1e5ce5c74f57614dc26bf5f2dc4e.zip |
Port GLOBAL[_CLANG]_CFLAGS_NO_OVERRIDE from make
Change-Id: I4f0f8ec7620e4477f60bf9cf1ae0c005470c89d4
-rw-r--r-- | cc/builder.go | 8 | ||||
-rw-r--r-- | cc/cc.go | 9 | ||||
-rw-r--r-- | cc/clang.go | 6 |
3 files changed, 23 insertions, 0 deletions
diff --git a/cc/builder.go b/cc/builder.go index 98f66d9f..bcfbb6ee 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -149,6 +149,14 @@ func TransformSourceToObj(ctx common.AndroidModuleContext, subdir string, srcFil cppflags := flags.globalFlags + " " + flags.cFlags + " " + flags.cppFlags asflags := flags.globalFlags + " " + flags.asFlags + if flags.clang { + cflags += " ${noOverrideClangGlobalCflags}" + cppflags += " ${noOverrideClangGlobalCflags}" + } else { + cflags += " ${noOverrideGlobalCflags}" + cppflags += " ${noOverrideGlobalCflags}" + } + for i, srcFile := range srcFiles { objFile := common.ObjPathWithExt(ctx, srcFile, subdir, "o") @@ -103,6 +103,11 @@ var ( "-Wsign-promo", } + noOverrideGlobalCflags = []string{ + "-Werror=int-to-pointer-cast", + "-Werror=pointer-to-int-cast", + } + illegalFlags = []string{ "-w", } @@ -112,6 +117,7 @@ func init() { pctx.StaticVariable("commonGlobalCflags", strings.Join(commonGlobalCflags, " ")) pctx.StaticVariable("deviceGlobalCflags", strings.Join(deviceGlobalCflags, " ")) pctx.StaticVariable("hostGlobalCflags", strings.Join(hostGlobalCflags, " ")) + pctx.StaticVariable("noOverrideGlobalCflags", strings.Join(noOverrideGlobalCflags, " ")) pctx.StaticVariable("commonGlobalCppflags", strings.Join(commonGlobalCppflags, " ")) @@ -121,6 +127,9 @@ func init() { strings.Join(append(clangFilterUnknownCflags(deviceGlobalCflags), "${clangExtraTargetCflags}"), " ")) pctx.StaticVariable("hostClangGlobalCflags", strings.Join(clangFilterUnknownCflags(hostGlobalCflags), " ")) + pctx.StaticVariable("noOverrideClangGlobalCflags", + strings.Join(append(clangFilterUnknownCflags(noOverrideGlobalCflags), "${clangExtraNoOverrideCflags}"), " ")) + pctx.StaticVariable("commonClangGlobalCppflags", strings.Join(append(clangFilterUnknownCflags(commonGlobalCppflags), "${clangExtraCppflags}"), " ")) diff --git a/cc/clang.go b/cc/clang.go index df7ec01c..f4c29f01 100644 --- a/cc/clang.go +++ b/cc/clang.go @@ -101,6 +101,12 @@ func init() { pctx.StaticVariable("clangExtraTargetCflags", strings.Join([]string{ "-nostdlibinc", }, " ")) + + pctx.StaticVariable("clangExtraNoOverrideCflags", strings.Join([]string{ + "-Werror=address-of-temporary", + "-Werror=null-dereference", + "-Werror=return-type", + }, " ")) } func clangFilterUnknownCflags(cflags []string) []string { |