Tear out trivial_abi on unique_ptr

Turns out people are bad at not combining code compiled with GCC
and Clang, and the improvement from `trivial_abi` on `unique_ptr`
is not worth the maintenance cost of having this be an opt-in
change.

Closes #2344
This commit is contained in:
Martin Hořeňovský 2022-01-05 00:04:21 +01:00
parent 103cb16696
commit fff494c10a
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -13,25 +13,15 @@
#include <catch2/internal/catch_move_and_forward.hpp> #include <catch2/internal/catch_move_and_forward.hpp>
#if defined(__clang__) && defined(__has_attribute)
# if __has_attribute(trivial_abi)
# define TRIVIAL_ABI [[clang::trivial_abi]]
# endif
#endif
#if !defined(TRIVIAL_ABI)
# define TRIVIAL_ABI
#endif
namespace Catch { namespace Catch {
namespace Detail { namespace Detail {
/** /**
* A reimplementation of `std::unique_ptr` for improved compilation performance * A reimplementation of `std::unique_ptr` for improved compilation performance
* *
* Does not support arrays nor custom deleters, but has trivial ABI * Does not support arrays nor custom deleters.
* when supposed by the compiler.
*/ */
template <typename T> template <typename T>
class TRIVIAL_ABI unique_ptr { class unique_ptr {
T* m_ptr; T* m_ptr;
public: public:
constexpr unique_ptr(std::nullptr_t = nullptr): constexpr unique_ptr(std::nullptr_t = nullptr):