Where GCC says "unrecognized command line option", clang says "unknown
argument". This distinction usually doesn't matter because the
compiler will also exit with a non-zero status, but clang 3.4
reportedly exits with a zero status after reporting an unknown argument.
Change-Id: Ieb69ea352a8de0cd4171a1c26708dfe523421cfa
Reviewed-on: https://go-review.googlesource.com/72151
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
cmd.Dir = b.WorkDir
cmd.Env = base.MergeEnvLists([]string{"LC_ALL=C"}, base.EnvForDir(cmd.Dir, os.Environ()))
out, err := cmd.CombinedOutput()
- supported := err == nil && !bytes.Contains(out, []byte("unrecognized"))
+ // GCC says "unrecognized command line option".
+ // clang says "unknown argument".
+ supported := err == nil && !bytes.Contains(out, []byte("unrecognized")) && !bytes.Contains(out, []byte("unknown"))
b.flagCache[key] = supported
return supported
}