From 52b1cd25446743f0e366d7ce5d6fe7ec8f29a962 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 1 Mar 2016 13:36:34 -0800 Subject: Add a global define for non-external code. Soong port of https://android-review.googlesource.com/204887 Change-Id: I15faf62cec1932dd859a082f66942b2606d0ff45 --- cc/cc.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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, " ")) -- cgit v1.2.3