aboutsummaryrefslogtreecommitdiff
path: root/build2/cc/guess.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-11-27 11:42:35 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-11-27 11:42:35 +0200
commit0d34b2f7692aba066213c038b810623c216b6980 (patch)
tree9c2d5db91cf075b84307957a8d9d3d10b1773a90 /build2/cc/guess.cxx
parent6324239cf260f82312143a83855eb53bdc890a70 (diff)
Add {c,cxx}.class variables
Compiler class describes a set of compilers that follow more or less the same command line interface. Compilers that don't belong to any of the existing classes are in classes of their own (say, Sun CC would be on its own if we were to support it). Currently defined compiler classes: gcc gcc, clang, clang-apple, icc (on non-Windows) msvc msvc, clang-cl, icc (Windows)
Diffstat (limited to 'build2/cc/guess.cxx')
-rw-r--r--build2/cc/guess.cxx18
1 files changed, 17 insertions, 1 deletions
diff --git a/build2/cc/guess.cxx b/build2/cc/guess.cxx
index da5be97..627283f 100644
--- a/build2/cc/guess.cxx
+++ b/build2/cc/guess.cxx
@@ -18,7 +18,7 @@ namespace build2
value () const -> value_type
{
if (type == "gcc") return gcc;
- if (type == "clang") return clang;
+ if (type == "clang") return variant.empty () ? clang : clang_apple;
if (type == "msvc") return msvc;
if (type == "icc") return icc;
@@ -26,6 +26,17 @@ namespace build2
return gcc;
}
+ string
+ to_string (compiler_class cl)
+ {
+ switch (cl)
+ {
+ case compiler_class::gcc: return "gcc";
+ case compiler_class::msvc: return "msvc";
+ }
+ return string (); // Never reached.
+ }
+
// Pre-guess the compiler type based on the compiler executable name.
// Return empty string if can't make a guess (for example, because the
// compiler name is a generic 'c++'). Note that it only guesses the type,
@@ -501,6 +512,7 @@ namespace build2
return compiler_info {
move (gr.path),
move (gr.id),
+ compiler_class::gcc,
move (v),
move (gr.signature),
move (gr.checksum), // Calculated on whole -v output.
@@ -617,6 +629,7 @@ namespace build2
return compiler_info {
move (gr.path),
move (gr.id),
+ compiler_class::gcc,
move (v),
move (gr.signature),
move (gr.checksum), // Calculated on whole -v output.
@@ -836,6 +849,7 @@ namespace build2
return compiler_info {
move (gr.path),
move (gr.id),
+ compiler_class::gcc, //@@ TODO: msvc on Windows?
move (v),
move (gr.signature),
cs.string (),
@@ -1059,6 +1073,7 @@ namespace build2
return compiler_info {
move (gr.path),
move (gr.id),
+ compiler_class::msvc,
move (v),
move (gr.signature),
cs.string (),
@@ -1107,6 +1122,7 @@ namespace build2
break;
}
case compiler_id::clang:
+ case compiler_id::clang_apple:
{
assert (id.variant.empty () || id.variant == "apple");
r = guess_clang (xl, xc, c_coptions, x_coptions, move (gr));