aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/clang_flags.go
diff options
context:
space:
mode:
Diffstat (limited to 'compiler_wrapper/clang_flags.go')
-rw-r--r--compiler_wrapper/clang_flags.go22
1 files changed, 17 insertions, 5 deletions
diff --git a/compiler_wrapper/clang_flags.go b/compiler_wrapper/clang_flags.go
index 1c45935e..a38e597a 100644
--- a/compiler_wrapper/clang_flags.go
+++ b/compiler_wrapper/clang_flags.go
@@ -36,18 +36,30 @@ func processClangFlags(builder *commandBuilder) error {
clangDir = filepath.Dir(clangDir)
}
+ var languageOverriden = false
+ for _, arg := range builder.args {
+ // Reading stdin with "-" requires either -E (which defaults to C) or -x
+ if arg.value == "-x" || arg.value == "-" {
+ languageOverriden = true
+ }
+ }
+
clangBasename := "clang"
if strings.HasSuffix(builder.target.compiler, "++") {
clangBasename = "clang++"
+ // If a package wants to specify the language then it can set the standard too.
+ if !languageOverriden {
+ builder.addPreUserArgs(builder.cfg.cppFlags...)
+ }
}
- // GCC flags to remove from the clang command line.
- // TODO: Once clang supports GCC compatibility mode, remove
- // these checks.
- //
+ // Unsupported flags to remove from the clang command line.
// Use of -Qunused-arguments allows this set to be small, just those
// that clang still warns about.
- unsupported := make(map[string]bool)
+ unsupported := map[string]bool{
+ "-Xcompiler": true,
+ "-avoid-version": true,
+ }
unsupportedPrefixes := []string{"-Wstrict-aliasing=", "-finline-limit="}