aboutsummaryrefslogtreecommitdiff
path: root/build2/target
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-08-09 11:31:53 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-08-12 17:04:22 +0200
commit9fa5f73d00905568e8979d0c93ec4a8f645c81d5 (patch)
treef2bf937fa256c0ef2c9bbe05d3655d1985719405 /build2/target
parenta1b2319ff2ddc8a6f139ee364cabe236ca62e23e (diff)
Implement support for C compilation
We now have two new modules: cc (c-common) and c.
Diffstat (limited to 'build2/target')
-rw-r--r--build2/target23
1 files changed, 20 insertions, 3 deletions
diff --git a/build2/target b/build2/target
index 7a50a19..103b719 100644
--- a/build2/target
+++ b/build2/target
@@ -68,6 +68,11 @@ namespace build2
// this case the returned by the recipe value is still used as the resulting
// target state so it should match the group's state.
//
+ // Note that max size for the "small capture optimization" in std::function
+ // ranges (in pointer sizes) from 0 (GCC prior to 5) to 2 (GCC 5) to 6 (VC
+ // 14u2). With the size ranging (in bytes for 64-bit target) from 32 (GCC)
+ // to 64 (VC).
+ //
using recipe_function = target_state (action, target&);
using recipe = function<recipe_function>;
@@ -471,6 +476,9 @@ namespace build2
const T*
is_a () const {return dynamic_cast<const T*> (this);}
+ bool
+ is_a (const target_type& tt) const {return type ().is_a (tt);}
+
// Dynamic derivation to support define.
//
const target_type* derived_type = nullptr;
@@ -622,8 +630,9 @@ namespace build2
//
struct prerequisite_member
{
- typedef build2::target target_type;
- typedef build2::prerequisite prerequisite_type;
+ using target_type = build2::target;
+ using prerequisite_type = build2::prerequisite;
+ using target_type_type = build2::target_type;
prerequisite_ref& prerequisite;
target_type* target;
@@ -637,6 +646,14 @@ namespace build2
: prerequisite.get ().is_a<T> ();
}
+ bool
+ is_a (const target_type_type& tt) const
+ {
+ return target != nullptr
+ ? target->is_a (tt)
+ : prerequisite.get ().is_a (tt);
+ }
+
prerequisite_key
key () const
{
@@ -645,7 +662,7 @@ namespace build2
: prerequisite.get ().key ();
}
- const build2::target_type&
+ const target_type_type&
type () const
{
return target != nullptr ? target->type () : prerequisite.get ().type;