aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-08-31 19:28:20 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-08-31 19:28:20 +0200
commit1bf439f7918f2c6f8fa07db3abb53722156945c7 (patch)
tree8463d61d3fc6424fb8d323a106106a7f9a3a787a
parent12a1044b81e39b8ca03faca641dacf76dda6c506 (diff)
Add ability to print cc compiler_id value
-rw-r--r--build2/cc/guess.cxx13
-rw-r--r--build2/cc/guess.hxx11
2 files changed, 24 insertions, 0 deletions
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