Allow disabling gnu extensions
Pass -std=c++14 instead of -std=gnu++14 (or whatever the current default is) when "gnu_extensions: false" is specified in the blueprints files. Bug: 32159540 Test: builds Change-Id: If206228a972129d9574bcf50ddff283b7e7d3fd7
This commit is contained in:
@@ -84,6 +84,9 @@ type BaseCompilerProperties struct {
|
||||
// pass -frtti instead of -fno-rtti
|
||||
Rtti *bool
|
||||
|
||||
// if set to false, use -std=c++* instead of -std=gnu++*
|
||||
Gnu_extensions *bool
|
||||
|
||||
Debug, Release struct {
|
||||
// list of module-specific flags that will be used for C and C++ compiles in debug or
|
||||
// release builds
|
||||
@@ -292,6 +295,11 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
|
||||
cppStd = config.GccCppStdVersion
|
||||
}
|
||||
|
||||
if compiler.Properties.Gnu_extensions != nil && *compiler.Properties.Gnu_extensions == false {
|
||||
cStd = gnuToCReplacer.Replace(cStd)
|
||||
cppStd = gnuToCReplacer.Replace(cppStd)
|
||||
}
|
||||
|
||||
flags.ConlyFlags = append([]string{"-std=" + cStd}, flags.ConlyFlags...)
|
||||
flags.CppFlags = append([]string{"-std=" + cppStd}, flags.CppFlags...)
|
||||
}
|
||||
@@ -315,6 +323,8 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
|
||||
return flags
|
||||
}
|
||||
|
||||
var gnuToCReplacer = strings.NewReplacer("gnu", "c")
|
||||
|
||||
func ndkPathDeps(ctx ModuleContext) android.Paths {
|
||||
if ctx.sdk() {
|
||||
// The NDK sysroot timestamp file depends on all the NDK sysroot files
|
||||
|
Reference in New Issue
Block a user