aboutsummaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2015-03-26 16:14:04 -0700
committerColin Cross <ccross@android.com>2015-03-27 17:54:50 -0700
commit28d76590f174fdc2787e0ae46926251cd62dde0a (patch)
treee669fd4f1a317f816d6a2eede3675f14e3713613 /cc
parentc9404350293d3a1f3bc97a38c93914931c0165d3 (diff)
downloadbuild_soong-28d76590f174fdc2787e0ae46926251cd62dde0a.tar.gz
build_soong-28d76590f174fdc2787e0ae46926251cd62dde0a.tar.bz2
build_soong-28d76590f174fdc2787e0ae46926251cd62dde0a.zip
Use ContainsProperty to support default values
Instead of setting a string property to magic default value and then checking for it later, call ctx.ContainsProperty to determine if it was set. Use the same method on the clang bool property, which couldn't be set to a magic value. blueprint's ModuleContext.ContainsProperty only works on a single property, not on all arch variant properties - ModuleContext.ContainsProperty("clang") will return false if clang was not set but arch.arm.clang was set - so track which properties were extended inside extendProperties, and override ModuleContext.ContainsProperty in AndroidModuleContext to also check the extended properties. Change-Id: I03cbe71dc69344972e23d6c794da9be05e720c45
Diffstat (limited to 'cc')
-rw-r--r--cc/cc.go14
1 files changed, 4 insertions, 10 deletions
diff --git a/cc/cc.go b/cc/cc.go
index e209faa0..d400df08 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -401,8 +401,7 @@ func (c *ccBase) collectFlags(ctx common.AndroidModuleContext, toolchain Toolcha
// TODO: debug
flags.CFlags = append(flags.CFlags, c.properties.Release.Cflags...)
- if ctx.Host() {
- // TODO: allow per-module clang disable for host
+ if ctx.Host() && !ctx.ContainsProperty("clang") {
flags.Clang = true
}
@@ -684,19 +683,15 @@ type ccLinked struct {
func newCCDynamic(dynamic *ccLinked, module CCModuleType, hod common.HostOrDeviceSupported,
multilib common.Multilib, props ...interface{}) (blueprint.Module, []interface{}) {
- dynamic.properties.System_shared_libs = []string{defaultSystemSharedLibraries}
-
props = append(props, &dynamic.dynamicProperties)
return newCCBase(&dynamic.ccBase, module, hod, multilib, props...)
}
-const defaultSystemSharedLibraries = "__default__"
-
func (c *ccLinked) systemSharedLibs(ctx common.AndroidBaseContext) []string {
- if len(c.properties.System_shared_libs) == 1 &&
- c.properties.System_shared_libs[0] == defaultSystemSharedLibraries {
-
+ if ctx.ContainsProperty("system_shared_libs") {
+ return c.properties.System_shared_libs
+ } else {
if ctx.Host() {
return []string{}
} else if c.properties.Sdk_version != "" {
@@ -714,7 +709,6 @@ func (c *ccLinked) systemSharedLibs(ctx common.AndroidBaseContext) []string {
return []string{"libc", "libm"}
}
}
- return c.properties.System_shared_libs
}
func (c *ccLinked) stl(ctx common.AndroidBaseContext) string {