Change bool, and string properties to *bool, and *string for cc
there's no use case for prepending/appending to bool, and string
properties within module struct. Declearing "*bool" and "*string" almost
cover everything user need.
I did see one case that user specify relative_install_path as
path prefix in cc_defaults, and concatenate with the one in real module
to get the final relative install path in Android.bp <bionic/tests/libs>.
Test: m -j checkbuild
Bug: b/68853585
Change-Id: If3a7a2689c3fc307aae136af6bc9c57f27a1e1a0
diff --git a/cc/compiler.go b/cc/compiler.go
index c40e179..268a663 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -89,12 +89,12 @@
// C standard version to use. Can be a specific version (such as "gnu11"),
// "experimental" (which will use draft versions like C1x when available),
// or the empty string (which will use the default).
- C_std string
+ C_std *string
// C++ standard version to use. Can be a specific version (such as
// "gnu++11"), "experimental" (which will use draft versions like C++1z when
// available), or the empty string (which will use the default).
- Cpp_std string
+ Cpp_std *string
// if set to false, use -std=c++* instead of -std=gnu++*
Gnu_extensions *bool
@@ -143,7 +143,7 @@
Proto struct {
// Link statically against the protobuf runtime
- Static bool `android:"arch_variant"`
+ Static *bool `android:"arch_variant"`
} `android:"arch_variant"`
// Stores the original list of source files before being cleared by library reuse
@@ -193,7 +193,7 @@
android.ExtractSourcesDeps(ctx, compiler.Properties.Srcs)
if compiler.hasSrcExt(".proto") {
- deps = protoDeps(ctx, deps, &compiler.Proto, compiler.Properties.Proto.Static)
+ deps = protoDeps(ctx, deps, &compiler.Proto, Bool(compiler.Properties.Proto.Static))
}
return deps
@@ -275,7 +275,7 @@
"-D__ANDROID_API__=__ANDROID_API_FUTURE__", "-D__ANDROID_VNDK__")
}
- instructionSet := proptools.String(compiler.Properties.Instruction_set)
+ instructionSet := String(compiler.Properties.Instruction_set)
if flags.RequiredInstructionSet != "" {
instructionSet = flags.RequiredInstructionSet
}
@@ -364,21 +364,21 @@
if !ctx.useSdk() {
cStd := config.CStdVersion
- if compiler.Properties.C_std == "experimental" {
+ if String(compiler.Properties.C_std) == "experimental" {
cStd = config.ExperimentalCStdVersion
- } else if compiler.Properties.C_std != "" {
- cStd = compiler.Properties.C_std
+ } else if String(compiler.Properties.C_std) != "" {
+ cStd = String(compiler.Properties.C_std)
}
- cppStd := compiler.Properties.Cpp_std
- switch compiler.Properties.Cpp_std {
+ cppStd := String(compiler.Properties.Cpp_std)
+ switch String(compiler.Properties.Cpp_std) {
case "":
cppStd = config.CppStdVersion
case "experimental":
cppStd = config.ExperimentalCppStdVersion
case "c++17", "gnu++17":
// Map c++17 and gnu++17 to their 1z equivalents, until 17 is finalized.
- cppStd = strings.Replace(compiler.Properties.Cpp_std, "17", "1z", 1)
+ cppStd = strings.Replace(String(compiler.Properties.Cpp_std), "17", "1z", 1)
}
if !flags.Clang {