aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2016-03-01 13:36:34 -0800
committerDan Willemsen <dwillemsen@google.com>2016-03-02 03:08:37 +0000
commit52b1cd25446743f0e366d7ce5d6fe7ec8f29a962 (patch)
tree05464202cf570482165d2a30fed1c37281881b5a
parent4fef64b320863a176ba33ee2f28b221341922f27 (diff)
downloadbuild_soong-52b1cd25446743f0e366d7ce5d6fe7ec8f29a962.tar.gz
build_soong-52b1cd25446743f0e366d7ce5d6fe7ec8f29a962.tar.bz2
build_soong-52b1cd25446743f0e366d7ce5d6fe7ec8f29a962.zip
Add a global define for non-external code.
Soong port of https://android-review.googlesource.com/204887 Change-Id: I15faf62cec1932dd859a082f66942b2606d0ff45
-rw-r--r--cc/cc.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/cc/cc.go b/cc/cc.go
index a5c14e1b..cf4bae3e 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -634,6 +634,22 @@ func (c *CCBase) collectFlags(ctx common.AndroidModuleContext, toolchain Toolcha
flags.CppFlags, _ = filterList(flags.CppFlags, illegalFlags)
flags.ConlyFlags, _ = filterList(flags.ConlyFlags, illegalFlags)
+ // We can enforce some rules more strictly in the code we own. strict
+ // indicates if this is code that we can be stricter with. If we have
+ // rules that we want to apply to *our* code (but maybe can't for
+ // vendor/device specific things), we could extend this to be a ternary
+ // value.
+ strict := true
+ if strings.HasPrefix(common.PathForModuleSrc(ctx).String(), "external/") {
+ strict = false
+ }
+
+ // Can be used to make some annotations stricter for code we can fix
+ // (such as when we mark functions as deprecated).
+ if strict {
+ flags.CFlags = append(flags.CFlags, "-DANDROID_STRICT")
+ }
+
// Optimization to reduce size of build.ninja
// Replace the long list of flags for each file with a module-local variable
ctx.Variable(pctx, "cflags", strings.Join(flags.CFlags, " "))