aboutsummaryrefslogtreecommitdiff
path: root/build/cli/target
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-07-01 17:37:23 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-07-01 17:37:23 +0200
commit455ad2bf70eb0a6e29c8c7179e1c40c18bd8ee2f (patch)
tree98de78e1abf2180d7bc5c18ddf589d8edc30af41 /build/cli/target
parente4c4fec8c9097722ee5ee94f2ce5ad0313ed8d7b (diff)
Get rid of accessors/modifiers in cli.cxx target
Diffstat (limited to 'build/cli/target')
-rw-r--r--build/cli/target26
1 files changed, 17 insertions, 9 deletions
diff --git a/build/cli/target b/build/cli/target
index d733668..a32f718 100644
--- a/build/cli/target
+++ b/build/cli/target
@@ -28,15 +28,23 @@ namespace build
public:
using mtime_target::mtime_target;
- target* m[3] {nullptr, nullptr, nullptr};
-
- cxx::hxx* h () const {return static_cast<cxx::hxx*> (m[0]);}
- cxx::cxx* c () const {return static_cast<cxx::cxx*> (m[1]);}
- cxx::ixx* i () const {return static_cast<cxx::ixx*> (m[2]);}
-
- void h (cxx::hxx& t) {m[0] = &t;}
- void c (cxx::cxx& t) {m[1] = &t;}
- void i (cxx::ixx& t) {m[2] = &t;}
+ 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 pointer 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};
+ };
virtual group_view
group_members (action) const;