diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-08 09:24:07 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-13 12:42:42 +0200 |
commit | 8aee78c8d0eb06334571e596f6fbdf7ed5756f0c (patch) | |
tree | 12899b0b09c8fcbaf3a1064b28db8f6161003cbe /build2/cli/target | |
parent | 5cefca444f7062c61cc9d118ffea5901e05186fd (diff) |
Tighten target constness further
Diffstat (limited to 'build2/cli/target')
-rw-r--r-- | build2/cli/target | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/build2/cli/target b/build2/cli/target index f4ab7e7..c10e4b8 100644 --- a/build2/cli/target +++ b/build2/cli/target @@ -26,37 +26,22 @@ namespace build2 virtual const target_type& dynamic_type () const {return static_type;} }; - class cli_cxx: public mtime_target + // Standard layout type compatible with target*[3]. + // + struct cli_cxx_members { - public: - union - { - // It is theoretically possible that the compiler will add - // padding between the members of this struct. This would - // mean that the optimal alignment for a pointer is greater - // than its size (and that an array of pointers is sub- - // optimally aligned). We will deal with such a beast of - // an architecture when we see it. - // - struct - { - cxx::hxx* h; - cxx::cxx* c; - cxx::ixx* i; - }; - target* m[3] /*= {nullptr, nullptr, nullptr}*/; // @@ GCC 4.8 - }; - - //using mtime_target::mtime_target; // @@ GCC 4.8 + const_ptr<cxx::hxx> h = nullptr; + const_ptr<cxx::cxx> c = nullptr; + const_ptr<cxx::ixx> i = nullptr; + }; - cli_cxx (dir_path d, dir_path o, string n) - : mtime_target (move (d), move (o), move (n)) - { - m[0] = m[1] = m[2] = nullptr; - } + class cli_cxx: public mtime_target, public cli_cxx_members + { + public: + using mtime_target::mtime_target; virtual group_view - group_members (action_type) const; + group_members (action_type); virtual timestamp load_mtime () const; |