Split local and global cflags

Native compiler flags are currently applied in approximately:
global cflags
local cflags
local include dirs
global include dirs
global conlyflags
local conlyflags
global cppflags
local cppflags

This means that a flag that is enabled in the global cppflags
cannot be disabled in the local cflags, and an Android.bp author
must know to disable it in the local cppflags.  A better order
would be:
global cflags
global conlyflags
global cppflags
local cflags
local conlyflags
local cppflags
local include dirs
global include dirs

We are mixing both the global and local cflags into a single
variable, and similar for conlyflags and cppflags, which
prevents reordering them.  This CL prepares to reorder them
by splitting the global and local cflags into separate variables.

Bug: 143713277
Test: m native
Change-Id: Ic55a8c3516c331dc5f2af9d00e59ceca9d3e6c15
This commit is contained in:
Colin Cross
2019-11-04 09:37:55 -08:00
parent 1f056cd69d
commit 4af21ed26f
26 changed files with 286 additions and 259 deletions

View File

@@ -152,12 +152,16 @@ func getArguments(src android.Path, ctx android.SingletonContext, ccModule *Modu
clangPath = ccPath
}
args = append(args, clangPath)
args = append(args, expandAllVars(ctx, ccModule.flags.GlobalFlags)...)
args = append(args, expandAllVars(ctx, ccModule.flags.CFlags)...)
args = append(args, expandAllVars(ctx, ccModule.flags.Global.CommonFlags)...)
args = append(args, expandAllVars(ctx, ccModule.flags.Local.CommonFlags)...)
args = append(args, expandAllVars(ctx, ccModule.flags.Global.CFlags)...)
args = append(args, expandAllVars(ctx, ccModule.flags.Local.CFlags)...)
if isCpp {
args = append(args, expandAllVars(ctx, ccModule.flags.CppFlags)...)
args = append(args, expandAllVars(ctx, ccModule.flags.Global.CppFlags)...)
args = append(args, expandAllVars(ctx, ccModule.flags.Local.CppFlags)...)
} else if !isAsm {
args = append(args, expandAllVars(ctx, ccModule.flags.ConlyFlags)...)
args = append(args, expandAllVars(ctx, ccModule.flags.Global.ConlyFlags)...)
args = append(args, expandAllVars(ctx, ccModule.flags.Local.ConlyFlags)...)
}
args = append(args, expandAllVars(ctx, ccModule.flags.SystemIncludeFlags)...)
args = append(args, src.String())