aboutsummaryrefslogtreecommitdiff
path: root/build2/cc/guess.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-05-30 10:23:27 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-05-30 10:23:27 +0200
commit49fd34cb82d8edae683526a5d9fdd3c86136e646 (patch)
treee5e21a1d451e813ae18033066002019998ba5b76 /build2/cc/guess.cxx
parentac379d5c0a7d8a7382649f3988eb86474d5e4a13 (diff)
Rework C/C++ standard translation in preparation for experimental/modules
Also fix bug in clang-apple versioning.
Diffstat (limited to 'build2/cc/guess.cxx')
-rw-r--r--build2/cc/guess.cxx45
1 files changed, 25 insertions, 20 deletions
diff --git a/build2/cc/guess.cxx b/build2/cc/guess.cxx
index 9f14661..7dde013 100644
--- a/build2/cc/guess.cxx
+++ b/build2/cc/guess.cxx
@@ -1096,28 +1096,33 @@ namespace build2
compiler_info r;
const compiler_id& id (gr.id);
- if (id.type == "gcc")
+ switch (id.value ())
{
- assert (id.variant.empty ());
- r = guess_gcc (xl, xc, c_coptions, x_coptions, move (gr));
- }
- else if (id.type == "clang")
- {
- assert (id.variant.empty () || id.variant == "apple");
- r = guess_clang (xl, xc, c_coptions, x_coptions, move (gr));
- }
- else if (id.type == "icc")
- {
- assert (id.variant.empty ());
- r = guess_icc (xl, xc, c_coptions, x_coptions, move (gr));
- }
- else if (id.type == "msvc")
- {
- assert (id.variant.empty ());
- r = guess_msvc (xl, xc, c_coptions, x_coptions, move (gr));
+ case compiler_id::gcc:
+ {
+ assert (id.variant.empty ());
+ r = guess_gcc (xl, xc, c_coptions, x_coptions, move (gr));
+ break;
+ }
+ case compiler_id::clang:
+ {
+ assert (id.variant.empty () || id.variant == "apple");
+ r = guess_clang (xl, xc, c_coptions, x_coptions, move (gr));
+ break;
+ }
+ case compiler_id::msvc:
+ {
+ assert (id.variant.empty ());
+ r = guess_msvc (xl, xc, c_coptions, x_coptions, move (gr));
+ break;
+ }
+ case compiler_id::icc:
+ {
+ assert (id.variant.empty ());
+ r = guess_icc (xl, xc, c_coptions, x_coptions, move (gr));
+ break;
+ }
}
- else
- assert (false);
// Derive binutils pattern unless this has already been done by the
// compiler-specific code.