summaryrefslogtreecommitdiff
path: root/cc/compiler.go
diff options
context:
space:
mode:
Diffstat (limited to 'cc/compiler.go')
-rw-r--r--cc/compiler.go26
1 files changed, 8 insertions, 18 deletions
diff --git a/cc/compiler.go b/cc/compiler.go
index ede6a5d0a..d8446fb84 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -50,7 +50,7 @@ type BaseCompilerProperties struct {
Exclude_srcs []string `android:"path,arch_variant"`
// list of module-specific flags that will be used for C and C++ compiles.
- Cflags []string `android:"arch_variant"`
+ Cflags proptools.Configurable[[]string] `android:"arch_variant"`
// list of module-specific flags that will be used for C++ compiles
Cppflags []string `android:"arch_variant"`
@@ -98,7 +98,7 @@ type BaseCompilerProperties struct {
// list of generated headers to add to the include path. These are the names
// of genrule modules.
- Generated_headers []string `android:"arch_variant,variant_prepend"`
+ Generated_headers proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"`
// pass -frtti instead of -fno-rtti
Rtti *bool `android:"arch_variant"`
@@ -172,12 +172,6 @@ type BaseCompilerProperties struct {
Target_api *string
}
- Debug, Release struct {
- // list of module-specific flags that will be used for C and C++ compiles in debug or
- // release builds
- Cflags []string `android:"arch_variant"`
- } `android:"arch_variant"`
-
Target struct {
Vendor, Product struct {
// list of source files that should only be used in vendor or
@@ -274,7 +268,7 @@ func (compiler *baseCompiler) Srcs() android.Paths {
}
func (compiler *baseCompiler) appendCflags(flags []string) {
- compiler.Properties.Cflags = append(compiler.Properties.Cflags, flags...)
+ compiler.Properties.Cflags.AppendSimpleValue(flags)
}
func (compiler *baseCompiler) appendAsflags(flags []string) {
@@ -302,7 +296,7 @@ func (compiler *baseCompiler) compilerInit(ctx BaseModuleContext) {}
func (compiler *baseCompiler) compilerDeps(ctx DepsContext, deps Deps) Deps {
deps.GeneratedSources = append(deps.GeneratedSources, compiler.Properties.Generated_sources...)
deps.GeneratedSources = removeListFromList(deps.GeneratedSources, compiler.Properties.Exclude_generated_sources)
- deps.GeneratedHeaders = append(deps.GeneratedHeaders, compiler.Properties.Generated_headers...)
+ deps.GeneratedHeaders = append(deps.GeneratedHeaders, compiler.Properties.Generated_headers.GetOrDefault(ctx, nil)...)
deps.AidlLibs = append(deps.AidlLibs, compiler.Properties.Aidl.Libs...)
android.ProtoDeps(ctx, &compiler.Proto)
@@ -372,7 +366,8 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
compiler.srcsBeforeGen = android.PathsForModuleSrcExcludes(ctx, compiler.Properties.Srcs, compiler.Properties.Exclude_srcs)
compiler.srcsBeforeGen = append(compiler.srcsBeforeGen, deps.GeneratedSources...)
- CheckBadCompilerFlags(ctx, "cflags", compiler.Properties.Cflags)
+ cflags := compiler.Properties.Cflags.GetOrDefault(ctx, nil)
+ CheckBadCompilerFlags(ctx, "cflags", cflags)
CheckBadCompilerFlags(ctx, "cppflags", compiler.Properties.Cppflags)
CheckBadCompilerFlags(ctx, "conlyflags", compiler.Properties.Conlyflags)
CheckBadCompilerFlags(ctx, "asflags", compiler.Properties.Asflags)
@@ -385,7 +380,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
esc := proptools.NinjaAndShellEscapeList
- flags.Local.CFlags = append(flags.Local.CFlags, esc(compiler.Properties.Cflags)...)
+ flags.Local.CFlags = append(flags.Local.CFlags, esc(cflags)...)
flags.Local.CppFlags = append(flags.Local.CppFlags, esc(compiler.Properties.Cppflags)...)
flags.Local.ConlyFlags = append(flags.Local.ConlyFlags, esc(compiler.Properties.Conlyflags)...)
flags.Local.AsFlags = append(flags.Local.AsFlags, esc(compiler.Properties.Asflags)...)
@@ -478,11 +473,6 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
ctx.ModuleErrorf("%s", err)
}
- CheckBadCompilerFlags(ctx, "release.cflags", compiler.Properties.Release.Cflags)
-
- // TODO: debug
- flags.Local.CFlags = append(flags.Local.CFlags, esc(compiler.Properties.Release.Cflags)...)
-
if !ctx.DeviceConfig().BuildBrokenClangCFlags() && len(compiler.Properties.Clang_cflags) != 0 {
ctx.PropertyErrorf("clang_cflags", "property is deprecated, see Changes.md file")
} else {
@@ -819,7 +809,7 @@ type RustBindgenClangProperties struct {
Header_libs []string `android:"arch_variant,variant_prepend"`
// list of clang flags required to correctly interpret the headers.
- Cflags []string `android:"arch_variant"`
+ Cflags proptools.Configurable[[]string] `android:"arch_variant"`
// list of c++ specific clang flags required to correctly interpret the headers.
// This is provided primarily to make sure cppflags defined in cc_defaults are pulled in.