diff options
Diffstat (limited to 'cc/compiler.go')
-rw-r--r-- | cc/compiler.go | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/cc/compiler.go b/cc/compiler.go index ffe8b2e36..2e62b0002 100644 --- a/cc/compiler.go +++ b/cc/compiler.go @@ -304,11 +304,24 @@ func parseCppStd(cppStdPtr *string) string { cppStd := String(cppStdPtr) switch cppStd { case "": - cppStd = config.CppStdVersion + return config.CppStdVersion case "experimental": - cppStd = config.ExperimentalCppStdVersion + return config.ExperimentalCppStdVersion + default: + return cppStd + } +} + +func parseCStd(cStdPtr *string) string { + cStd := String(cStdPtr) + switch cStd { + case "": + return config.CStdVersion + case "experimental": + return config.ExperimentalCStdVersion + default: + return cStd } - return cppStd } // Create a Flags struct that collects the compile flags from global values, @@ -479,13 +492,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps flags.Global.CommonFlags = append(flags.Global.CommonFlags, tc.ToolchainCflags()) - cStd := config.CStdVersion - if String(compiler.Properties.C_std) == "experimental" { - cStd = config.ExperimentalCStdVersion - } else if String(compiler.Properties.C_std) != "" { - cStd = String(compiler.Properties.C_std) - } - + cStd := parseCStd(compiler.Properties.C_std) cppStd := parseCppStd(compiler.Properties.Cpp_std) cStd, cppStd = maybeReplaceGnuToC(compiler.Properties.Gnu_extensions, cStd, cppStd) |