cc: Enable select syntax for cppflags

Bug: 325444956
Test: m
Test: m [custom build target with select in cppflags]
Change-Id: I7d27096526ce5b37afe447f900613a6fbb639986
This commit is contained in:
Aleks Todorov 2024-07-26 13:41:13 +01:00 committed by Bartłomiej Rudecki
parent a79bbf3bdb
commit 24a3d377d8
Signed by: przekichane
GPG key ID: 751F23C6F014EF76
2 changed files with 6 additions and 5 deletions

View file

@ -53,7 +53,7 @@ type BaseCompilerProperties struct {
Cflags proptools.Configurable[[]string] `android:"arch_variant"` Cflags proptools.Configurable[[]string] `android:"arch_variant"`
// list of module-specific flags that will be used for C++ compiles // list of module-specific flags that will be used for C++ compiles
Cppflags []string `android:"arch_variant"` Cppflags proptools.Configurable[[]string] `android:"arch_variant"`
// list of module-specific flags that will be used for C compiles // list of module-specific flags that will be used for C compiles
Conlyflags []string `android:"arch_variant"` Conlyflags []string `android:"arch_variant"`
@ -377,8 +377,9 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
compiler.srcsBeforeGen = append(compiler.srcsBeforeGen, deps.GeneratedSources...) compiler.srcsBeforeGen = append(compiler.srcsBeforeGen, deps.GeneratedSources...)
cflags := compiler.Properties.Cflags.GetOrDefault(ctx, nil) cflags := compiler.Properties.Cflags.GetOrDefault(ctx, nil)
cppflags := compiler.Properties.Cppflags.GetOrDefault(ctx, nil)
CheckBadCompilerFlags(ctx, "cflags", cflags) CheckBadCompilerFlags(ctx, "cflags", cflags)
CheckBadCompilerFlags(ctx, "cppflags", compiler.Properties.Cppflags) CheckBadCompilerFlags(ctx, "cppflags", cppflags)
CheckBadCompilerFlags(ctx, "conlyflags", compiler.Properties.Conlyflags) CheckBadCompilerFlags(ctx, "conlyflags", compiler.Properties.Conlyflags)
CheckBadCompilerFlags(ctx, "asflags", compiler.Properties.Asflags) CheckBadCompilerFlags(ctx, "asflags", compiler.Properties.Asflags)
CheckBadCompilerFlags(ctx, "vendor.cflags", compiler.Properties.Target.Vendor.Cflags) CheckBadCompilerFlags(ctx, "vendor.cflags", compiler.Properties.Target.Vendor.Cflags)
@ -391,7 +392,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
esc := proptools.NinjaAndShellEscapeList esc := proptools.NinjaAndShellEscapeList
flags.Local.CFlags = append(flags.Local.CFlags, esc(cflags)...) flags.Local.CFlags = append(flags.Local.CFlags, esc(cflags)...)
flags.Local.CppFlags = append(flags.Local.CppFlags, esc(compiler.Properties.Cppflags)...) flags.Local.CppFlags = append(flags.Local.CppFlags, esc(cppflags)...)
flags.Local.ConlyFlags = append(flags.Local.ConlyFlags, esc(compiler.Properties.Conlyflags)...) flags.Local.ConlyFlags = append(flags.Local.ConlyFlags, esc(compiler.Properties.Conlyflags)...)
flags.Local.AsFlags = append(flags.Local.AsFlags, esc(compiler.Properties.Asflags)...) flags.Local.AsFlags = append(flags.Local.AsFlags, esc(compiler.Properties.Asflags)...)
flags.Local.YasmFlags = append(flags.Local.YasmFlags, esc(compiler.Properties.Asflags)...) flags.Local.YasmFlags = append(flags.Local.YasmFlags, esc(compiler.Properties.Asflags)...)
@ -823,7 +824,7 @@ type RustBindgenClangProperties struct {
// list of c++ specific clang flags required to correctly interpret the headers. // 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. // This is provided primarily to make sure cppflags defined in cc_defaults are pulled in.
Cppflags []string `android:"arch_variant"` Cppflags proptools.Configurable[[]string] `android:"arch_variant"`
// C standard version to use. Can be a specific version (such as "gnu11"), // C standard version to use. Can be a specific version (such as "gnu11"),
// "experimental" (which will use draft versions like C1x when available), // "experimental" (which will use draft versions like C1x when available),

View file

@ -285,7 +285,7 @@ func (b *bindgenDecorator) GenerateSource(ctx ModuleContext, deps PathDeps) andr
if isCpp { if isCpp {
cflags = append(cflags, "-x c++") cflags = append(cflags, "-x c++")
// Add any C++ only flags. // Add any C++ only flags.
cflags = append(cflags, esc(b.ClangProperties.Cppflags)...) cflags = append(cflags, esc(b.ClangProperties.Cppflags.GetOrDefault(ctx, nil))...)
} else { } else {
cflags = append(cflags, "-x c") cflags = append(cflags, "-x c")
} }