aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-09-02 15:40:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-09-02 15:40:11 +0200
commit70d2386990f3d7d4241f7ab0e5fac3b20c9bbd1f (patch)
treef8b3b779993e835adc360bf7b175bea3a01f31a8
parent724616693d9aec2e3b9a1c150896d8bdc0bfbfd1 (diff)
Don't warn if we pre-guessed gcc but it ended up being clang-apple
This handles the gcc/g++ Mac OS "aliases".
-rw-r--r--build2/cc/guess.cxx18
1 files changed, 15 insertions, 3 deletions
diff --git a/build2/cc/guess.cxx b/build2/cc/guess.cxx
index c2b552a..cb4b584 100644
--- a/build2/cc/guess.cxx
+++ b/build2/cc/guess.cxx
@@ -115,8 +115,10 @@ namespace build2
empty () const {return id.empty ();}
};
+ // Allowed to change pre if succeeds.
+ //
static guess_result
- guess (lang, const path& xc, const string& pre)
+ guess (lang, const path& xc, string& pre)
{
tracer trace ("cc::guess");
@@ -139,7 +141,7 @@ namespace build2
// In fact, if someone renames icpc to g++, there will be no way for
// us to detect this. Oh, well, their problem.
//
- if (r.id.empty () && (pre.empty () || pre == "gcc" || pre == "clang"))
+ if (r.empty () && (pre.empty () || pre == "gcc" || pre == "clang"))
{
auto f = [] (string& l) -> guess_result
{
@@ -226,7 +228,15 @@ namespace build2
r = run<guess_result> (pp, "-v", f, false, false, &cs);
if (!r.empty ())
+ {
+ // If this is clang-apple and pre-guess was gcc then change it so
+ // that we don't issue any warnings.
+ //
+ if (r.id.type == "clang" && r.id.variant == "apple" && pre == "gcc")
+ pre = "clang";
+
r.checksum = cs.string ();
+ }
}
// Next try --version to detect icc.
@@ -1053,10 +1063,12 @@ namespace build2
if (gr.empty ())
warn << xc << " name looks like " << pre << " but it is not";
+
+ pre.clear ();
}
if (gr.empty ())
- gr = guess (xl, xc, "");
+ gr = guess (xl, xc, pre);
if (gr.empty ())
fail << "unable to guess " << xl << " compiler type of " << xc;