Consolidate -std flags
am: 6f6a428760
Change-Id: I1ea0db990df17715a061a7644e8c9fb879698e49
This commit is contained in:
commit
7dc95692d4
|
@ -278,13 +278,22 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
|
|||
}
|
||||
|
||||
if !ctx.sdk() {
|
||||
if ctx.Host() && !flags.Clang {
|
||||
cStd := config.CStdVersion
|
||||
cppStd := config.CppStdVersion
|
||||
|
||||
if !flags.Clang {
|
||||
// GCC uses an invalid C++14 ABI (emits calls to
|
||||
// __cxa_throw_bad_array_length, which is not a valid C++ RT ABI).
|
||||
// http://b/25022512
|
||||
cppStd = config.GccCppStdVersion
|
||||
} else if ctx.Host() && !flags.Clang {
|
||||
// The host GCC doesn't support C++14 (and is deprecated, so likely
|
||||
// never will). Build these modules with C++11.
|
||||
flags.CppFlags = append(flags.CppFlags, "-std=gnu++11")
|
||||
} else {
|
||||
flags.CppFlags = append(flags.CppFlags, "-std=gnu++14")
|
||||
cppStd = config.GccCppStdVersion
|
||||
}
|
||||
|
||||
flags.ConlyFlags = append([]string{"-std=" + cStd}, flags.ConlyFlags...)
|
||||
flags.CppFlags = append([]string{"-std=" + cppStd}, flags.CppFlags...)
|
||||
}
|
||||
|
||||
// We can enforce some rules more strictly in the code we own. strict
|
||||
|
|
|
@ -37,9 +37,7 @@ var (
|
|||
"-UDEBUG",
|
||||
}
|
||||
|
||||
commonGlobalConlyflags = []string{
|
||||
"-std=gnu99",
|
||||
}
|
||||
commonGlobalConlyflags = []string{}
|
||||
|
||||
deviceGlobalCflags = []string{
|
||||
"-fdiagnostics-color",
|
||||
|
@ -66,6 +64,10 @@ var (
|
|||
IllegalFlags = []string{
|
||||
"-w",
|
||||
}
|
||||
|
||||
CStdVersion = "gnu99"
|
||||
CppStdVersion = "gnu++14"
|
||||
GccCppStdVersion = "gnu++11"
|
||||
)
|
||||
|
||||
var pctx = android.NewPackageContext("android/soong/cc/config")
|
||||
|
|
|
@ -48,6 +48,10 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
|
|||
ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS", asanLdflags)
|
||||
ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES", asanLibs)
|
||||
|
||||
ctx.Strict("DEFAULT_C_STD_VERSION", config.CStdVersion)
|
||||
ctx.Strict("DEFAULT_CPP_STD_VERSION", config.CppStdVersion)
|
||||
ctx.Strict("DEFAULT_GCC_CPP_STD_VERSION", config.GccCppStdVersion)
|
||||
|
||||
includeFlags, err := ctx.Eval("${config.CommonGlobalIncludes} ${config.CommonGlobalSystemIncludes}")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
|
Loading…
Reference in New Issue