Merge "Add c_std and cpp_std properties."
am: 721197de2c
Change-Id: I9b5b4f14d6611f7a30435fcc2f17381b3fcb254c
This commit is contained in:
commit
d02c9ff9d8
|
@ -86,6 +86,16 @@ type BaseCompilerProperties struct {
|
||||||
// pass -frtti instead of -fno-rtti
|
// pass -frtti instead of -fno-rtti
|
||||||
Rtti *bool
|
Rtti *bool
|
||||||
|
|
||||||
|
// 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++ 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
|
||||||
|
|
||||||
// if set to false, use -std=c++* instead of -std=gnu++*
|
// if set to false, use -std=c++* instead of -std=gnu++*
|
||||||
Gnu_extensions *bool
|
Gnu_extensions *bool
|
||||||
|
|
||||||
|
@ -307,7 +317,18 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
|
||||||
|
|
||||||
if !ctx.sdk() {
|
if !ctx.sdk() {
|
||||||
cStd := config.CStdVersion
|
cStd := config.CStdVersion
|
||||||
|
if compiler.Properties.C_std == "experimental" {
|
||||||
|
cStd = config.ExperimentalCStdVersion
|
||||||
|
} else if compiler.Properties.C_std != "" {
|
||||||
|
cStd = compiler.Properties.C_std
|
||||||
|
}
|
||||||
|
|
||||||
cppStd := config.CppStdVersion
|
cppStd := config.CppStdVersion
|
||||||
|
if compiler.Properties.Cpp_std == "experimental" {
|
||||||
|
cppStd = config.ExperimentalCppStdVersion
|
||||||
|
} else if compiler.Properties.Cpp_std != "" {
|
||||||
|
cppStd = compiler.Properties.Cpp_std
|
||||||
|
}
|
||||||
|
|
||||||
if !flags.Clang {
|
if !flags.Clang {
|
||||||
// GCC uses an invalid C++14 ABI (emits calls to
|
// GCC uses an invalid C++14 ABI (emits calls to
|
||||||
|
|
|
@ -65,9 +65,11 @@ var (
|
||||||
"-w",
|
"-w",
|
||||||
}
|
}
|
||||||
|
|
||||||
CStdVersion = "gnu99"
|
CStdVersion = "gnu99"
|
||||||
CppStdVersion = "gnu++14"
|
CppStdVersion = "gnu++14"
|
||||||
GccCppStdVersion = "gnu++11"
|
GccCppStdVersion = "gnu++11"
|
||||||
|
ExperimentalCStdVersion = "gnu11"
|
||||||
|
ExperimentalCppStdVersion = "gnu++1z"
|
||||||
)
|
)
|
||||||
|
|
||||||
var pctx = android.NewPackageContext("android/soong/cc/config")
|
var pctx = android.NewPackageContext("android/soong/cc/config")
|
||||||
|
|
|
@ -60,6 +60,8 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
|
||||||
ctx.Strict("DEFAULT_C_STD_VERSION", config.CStdVersion)
|
ctx.Strict("DEFAULT_C_STD_VERSION", config.CStdVersion)
|
||||||
ctx.Strict("DEFAULT_CPP_STD_VERSION", config.CppStdVersion)
|
ctx.Strict("DEFAULT_CPP_STD_VERSION", config.CppStdVersion)
|
||||||
ctx.Strict("DEFAULT_GCC_CPP_STD_VERSION", config.GccCppStdVersion)
|
ctx.Strict("DEFAULT_GCC_CPP_STD_VERSION", config.GccCppStdVersion)
|
||||||
|
ctx.Strict("EXPERIMENTAL_C_STD_VERSION", config.ExperimentalCStdVersion)
|
||||||
|
ctx.Strict("EXPERIMENTAL_CPP_STD_VERSION", config.ExperimentalCppStdVersion)
|
||||||
|
|
||||||
ctx.Strict("DEFAULT_GLOBAL_TIDY_CHECKS", "${config.TidyDefaultGlobalChecks}")
|
ctx.Strict("DEFAULT_GLOBAL_TIDY_CHECKS", "${config.TidyDefaultGlobalChecks}")
|
||||||
ctx.Strict("DEFAULT_LOCAL_TIDY_CHECKS", joinLocalTidyChecks(config.DefaultLocalTidyChecks))
|
ctx.Strict("DEFAULT_LOCAL_TIDY_CHECKS", joinLocalTidyChecks(config.DefaultLocalTidyChecks))
|
||||||
|
|
Loading…
Reference in New Issue