aboutsummaryrefslogtreecommitdiff
path: root/build2/cxx/utility.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-02-29 10:57:40 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-02-29 10:57:40 +0200
commit3cf3b73ffc6881d5428a735736a347f6e143b366 (patch)
tree3559fa9d2d44cc11e07987752027f7c2a9e3e23e /build2/cxx/utility.txx
parent2a4f52c46f2081aaeb2664e8026d3d067142e3d5 (diff)
Implement auxiliary dependency database (.d files), use in cxx.compile
This is part of the "High Fidelity Build" work.
Diffstat (limited to 'build2/cxx/utility.txx')
-rw-r--r--build2/cxx/utility.txx29
1 files changed, 24 insertions, 5 deletions
diff --git a/build2/cxx/utility.txx b/build2/cxx/utility.txx
index 8324107..ed35fdb 100644
--- a/build2/cxx/utility.txx
+++ b/build2/cxx/utility.txx
@@ -9,15 +9,15 @@ namespace build2
namespace cxx
{
template <typename T>
- void
- append_std (cstrings& args, T& t, string& s)
+ bool
+ translate_std (T& t, string& s)
{
if (auto l = t["cxx.std"])
{
const string& v (as<string> (*l));
- // Translate 11 to 0x and 14 to 1y for compatibility with
- // older versions of the compiler.
+ // Translate 11 to 0x and 14 to 1y for compatibility with older
+ // versions of the compiler.
//
s = "-std=c++";
@@ -28,8 +28,27 @@ namespace build2
else
s += v;
- args.push_back (s.c_str ());
+ return true;
}
+
+ return false;
+ }
+
+ template <typename T>
+ inline void
+ append_std (cstrings& args, T& t, string& s)
+ {
+ if (translate_std (t, s))
+ args.push_back (s.c_str ());
+ }
+
+ template <typename T>
+ inline void
+ hash_std (sha256& csum, T& t)
+ {
+ string s;
+ if (translate_std (t, s))
+ csum.append (s);
}
}
}