aboutsummaryrefslogtreecommitdiffstats
path: root/cc/compiler.go
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2017-02-03 16:13:38 -0800
committerDan Albert <danalbert@google.com>2017-02-03 16:45:38 -0800
commit043833ca8164c057162e7051b6a38442e9160628 (patch)
tree646903fbf4306db3b8164e1184c92de14085b79e /cc/compiler.go
parentcb3f89026382ba0b264c5440fab5e8c4593cd31b (diff)
downloadbuild_soong-043833ca8164c057162e7051b6a38442e9160628.tar.gz
build_soong-043833ca8164c057162e7051b6a38442e9160628.tar.bz2
build_soong-043833ca8164c057162e7051b6a38442e9160628.zip
Add c_std and cpp_std properties.
Test: Checked showcommands ouput for each setting. Bug: None Change-Id: Ibe02352f19ca2777b9a419136270e5c4390f1149
Diffstat (limited to 'cc/compiler.go')
-rw-r--r--cc/compiler.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/cc/compiler.go b/cc/compiler.go
index d53e799a..e962949b 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -86,6 +86,16 @@ type BaseCompilerProperties struct {
// pass -frtti instead of -fno-rtti
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++*
Gnu_extensions *bool
@@ -307,7 +317,18 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
if !ctx.sdk() {
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
+ if compiler.Properties.Cpp_std == "experimental" {
+ cppStd = config.ExperimentalCppStdVersion
+ } else if compiler.Properties.Cpp_std != "" {
+ cppStd = compiler.Properties.Cpp_std
+ }
if !flags.Clang {
// GCC uses an invalid C++14 ABI (emits calls to