aboutsummaryrefslogtreecommitdiffstats
path: root/cc/cc.go
diff options
context:
space:
mode:
Diffstat (limited to 'cc/cc.go')
-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, " "))