diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2024-02-13 11:40:12 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2024-02-13 11:40:12 +0200 |
commit | 8a23835baa00f0079dbcd259c04ffeb87a764568 (patch) | |
tree | e74ccb9c5f68c9bc24ccbb21d63372de833b0ef6 | |
parent | fc1fb583de222caecdb956c623765b6a1a047937 (diff) |
Make target_type non-copyable
-rw-r--r-- | libbuild2/scope.cxx | 28 | ||||
-rw-r--r-- | libbuild2/target-type.hxx | 3 |
2 files changed, 25 insertions, 6 deletions
diff --git a/libbuild2/scope.cxx b/libbuild2/scope.cxx index 2b47dd0..6ed7bab 100644 --- a/libbuild2/scope.cxx +++ b/libbuild2/scope.cxx @@ -985,10 +985,17 @@ namespace build2 // Note: copies flags. // - unique_ptr<target_type> dt (new target_type (base)); - dt->base = &base; - dt->factory = &derived_tt_factory; - dt->flags |= flags; + unique_ptr<target_type> dt ( + new target_type { + nullptr, // Will be patched in by insert() below. + &base, + &derived_tt_factory, + base.fixed_extension, + base.default_extension, + base.pattern, + base.print, + base.search, + base.flags | flags}); #if 0 // @@ We should probably inherit the fixed extension unless overriden with @@ -1067,8 +1074,17 @@ namespace build2 derive_target_type (const target_type& et) { assert (root_scope () == this); - unique_ptr<target_type> dt (new target_type (et)); - dt->factory = &derived_tt_factory; + unique_ptr<target_type> dt ( + new target_type { + nullptr, // Will be patched in by insert() below. + et.base, + &derived_tt_factory, + et.fixed_extension, + et.default_extension, + et.pattern, + et.print, + et.search, + et.flags}); return root_extra->target_types.insert (et.name, move (dt)).first; } diff --git a/libbuild2/target-type.hxx b/libbuild2/target-type.hxx index fcf867a..93c5744 100644 --- a/libbuild2/target-type.hxx +++ b/libbuild2/target-type.hxx @@ -141,6 +141,9 @@ namespace build2 bool is_a (const char*) const; // Defined in target.cxx + + target_type& operator= (target_type&&) = delete; + target_type& operator= (const target_type&) = delete; }; inline bool |