From 49fd34cb82d8edae683526a5d9fdd3c86136e646 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 30 May 2017 10:23:27 +0200 Subject: Rework C/C++ standard translation in preparation for experimental/modules Also fix bug in clang-apple versioning. --- build2/cc/guess.cxx | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) (limited to 'build2/cc/guess.cxx') 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. -- cgit v1.1