From 1bf439f7918f2c6f8fa07db3abb53722156945c7 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 31 Aug 2018 19:28:20 +0200 Subject: Add ability to print cc compiler_id value --- build2/cc/guess.cxx | 13 +++++++++++++ build2/cc/guess.hxx | 11 +++++++++++ 2 files changed, 24 insertions(+) diff --git a/build2/cc/guess.cxx b/build2/cc/guess.cxx index e9b102f..0a60ffd 100644 --- a/build2/cc/guess.cxx +++ b/build2/cc/guess.cxx @@ -15,6 +15,19 @@ namespace build2 { namespace cc { + compiler_id:: + compiler_id (value_type v) + { + switch (v) + { + case clang_apple: type = "clang"; variant = "apple"; break; + case clang: type = "clang"; break; + case gcc: type = "gcc"; break; + case msvc: type = "msvc"; break; + case icc: type = "icc"; break; + } + } + auto compiler_id:: value () const -> value_type { diff --git a/build2/cc/guess.hxx b/build2/cc/guess.hxx index a762e79..599c56d 100644 --- a/build2/cc/guess.hxx +++ b/build2/cc/guess.hxx @@ -48,6 +48,11 @@ namespace build2 value_type value () const; + + compiler_id () = default; + compiler_id (value_type); + compiler_id (std::string t, std::string v) + : type (move (t)), variant (move (v)) {} }; inline ostream& @@ -56,6 +61,12 @@ namespace build2 return os << id.string (); } + inline ostream& + operator<< (ostream& os, const compiler_id::value_type& v) + { + return os << compiler_id (v); + } + // 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 -- cgit v1.1