From 819a2bf6b0908ea1d8464d4d0a95cb37826c031e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Sat, 1 Oct 2022 08:29:31 -0700 Subject: [PATCH] Cleanup. --- include/bx/error.h | 5 +++-- include/bx/inline/bx.inl | 10 ++++++++++ include/bx/macros.h | 8 ++++---- include/bx/mpscqueue.h | 6 ++++-- include/bx/mutex.h | 4 ++-- include/bx/ringbuffer.h | 10 ++++++---- include/bx/semaphore.h | 2 +- include/bx/spscqueue.h | 12 ++++++++---- include/bx/thread.h | 2 +- src/thread.cpp | 2 +- 10 files changed, 40 insertions(+), 21 deletions(-) diff --git a/include/bx/error.h b/include/bx/error.h index 30d625b..eaa7eab 100644 --- a/include/bx/error.h +++ b/include/bx/error.h @@ -38,7 +38,7 @@ namespace bx { BX_CLASS(Error , NO_COPY - , NO_ASSIGNMENT + , NO_COPY_ASSIGNMENT ); public: @@ -105,8 +105,9 @@ namespace bx class ErrorScope { BX_CLASS(ErrorScope + , NO_DEFAULT_CTOR , NO_COPY - , NO_ASSIGNMENT + , NO_COPY_ASSIGNMENT ); public: diff --git a/include/bx/inline/bx.inl b/include/bx/inline/bx.inl index 3c65185..415ef8d 100644 --- a/include/bx/inline/bx.inl +++ b/include/bx/inline/bx.inl @@ -15,6 +15,14 @@ namespace bx template char (&CountOfRequireArrayArgumentT(const Ty (&)[NumT]) )[NumT]; + struct Ignore + { + template + constexpr void operator=(Ty&&) const + { + } + }; + template struct isEnabled { @@ -148,3 +156,5 @@ namespace bx } } // namespace bx + +constexpr bx::Ignore _; diff --git a/include/bx/macros.h b/include/bx/macros.h index 5bf5e5c..9f2be82 100644 --- a/include/bx/macros.h +++ b/include/bx/macros.h @@ -199,13 +199,13 @@ /// #define BX_CLASS_NO_DEFAULT_CTOR(_class) \ - private: _class() + _class() = delete #define BX_CLASS_NO_COPY(_class) \ - private: _class(const _class& _rhs) + _class(const _class& _rhs) = delete -#define BX_CLASS_NO_ASSIGNMENT(_class) \ - private: _class& operator=(const _class& _rhs) +#define BX_CLASS_NO_COPY_ASSIGNMENT(_class) \ + _class& operator=(const _class& _rhs) = delete #define BX_CLASS_ALLOCATOR(_class) \ public: void* operator new(size_t _size); \ diff --git a/include/bx/mpscqueue.h b/include/bx/mpscqueue.h index d9bdb23..857b56e 100644 --- a/include/bx/mpscqueue.h +++ b/include/bx/mpscqueue.h @@ -17,8 +17,9 @@ namespace bx class MpScUnboundedQueueT { BX_CLASS(MpScUnboundedQueueT + , NO_DEFAULT_CTOR , NO_COPY - , NO_ASSIGNMENT + , NO_COPY_ASSIGNMENT ); public: @@ -47,8 +48,9 @@ namespace bx class MpScUnboundedBlockingQueue { BX_CLASS(MpScUnboundedBlockingQueue + , NO_DEFAULT_CTOR , NO_COPY - , NO_ASSIGNMENT + , NO_COPY_ASSIGNMENT ); public: diff --git a/include/bx/mutex.h b/include/bx/mutex.h index 8eeba6c..0dd2994 100644 --- a/include/bx/mutex.h +++ b/include/bx/mutex.h @@ -15,7 +15,7 @@ namespace bx { BX_CLASS(Mutex , NO_COPY - , NO_ASSIGNMENT + , NO_COPY_ASSIGNMENT ); public: @@ -41,7 +41,7 @@ namespace bx BX_CLASS(MutexScope , NO_DEFAULT_CTOR , NO_COPY - , NO_ASSIGNMENT + , NO_COPY_ASSIGNMENT ); public: diff --git a/include/bx/ringbuffer.h b/include/bx/ringbuffer.h index 284cdd2..739c6ef 100644 --- a/include/bx/ringbuffer.h +++ b/include/bx/ringbuffer.h @@ -16,8 +16,9 @@ namespace bx class RingBufferControl { BX_CLASS(RingBufferControl + , NO_DEFAULT_CTOR , NO_COPY - , NO_ASSIGNMENT + , NO_COPY_ASSIGNMENT ); public: @@ -55,8 +56,9 @@ namespace bx class SpScRingBufferControl { BX_CLASS(SpScRingBufferControl + , NO_DEFAULT_CTOR , NO_COPY - , NO_ASSIGNMENT + , NO_COPY_ASSIGNMENT ); public: @@ -97,7 +99,7 @@ namespace bx BX_CLASS(ReadRingBufferT , NO_DEFAULT_CTOR , NO_COPY - , NO_ASSIGNMENT + , NO_COPY_ASSIGNMENT ); public: @@ -140,7 +142,7 @@ namespace bx BX_CLASS(WriteRingBufferT , NO_DEFAULT_CTOR , NO_COPY - , NO_ASSIGNMENT + , NO_COPY_ASSIGNMENT ); public: diff --git a/include/bx/semaphore.h b/include/bx/semaphore.h index 5998bd2..7a0db5c 100644 --- a/include/bx/semaphore.h +++ b/include/bx/semaphore.h @@ -15,7 +15,7 @@ namespace bx { BX_CLASS(Semaphore , NO_COPY - , NO_ASSIGNMENT + , NO_COPY_ASSIGNMENT ); public: diff --git a/include/bx/spscqueue.h b/include/bx/spscqueue.h index 3afbbea..64dd7c3 100644 --- a/include/bx/spscqueue.h +++ b/include/bx/spscqueue.h @@ -16,8 +16,9 @@ namespace bx class SpScUnboundedQueue { BX_CLASS(SpScUnboundedQueue + , NO_DEFAULT_CTOR , NO_COPY - , NO_ASSIGNMENT + , NO_COPY_ASSIGNMENT ); public: @@ -57,8 +58,9 @@ namespace bx class SpScUnboundedQueueT { BX_CLASS(SpScUnboundedQueueT + , NO_DEFAULT_CTOR , NO_COPY - , NO_ASSIGNMENT + , NO_COPY_ASSIGNMENT ); public: @@ -86,8 +88,9 @@ namespace bx class SpScBlockingUnboundedQueue { BX_CLASS(SpScBlockingUnboundedQueue + , NO_DEFAULT_CTOR , NO_COPY - , NO_ASSIGNMENT + , NO_COPY_ASSIGNMENT ); public: @@ -116,8 +119,9 @@ namespace bx class SpScBlockingUnboundedQueueT { BX_CLASS(SpScBlockingUnboundedQueueT + , NO_DEFAULT_CTOR , NO_COPY - , NO_ASSIGNMENT + , NO_COPY_ASSIGNMENT ); public: diff --git a/include/bx/thread.h b/include/bx/thread.h index 88ded7d..231ca1c 100644 --- a/include/bx/thread.h +++ b/include/bx/thread.h @@ -21,7 +21,7 @@ namespace bx { BX_CLASS(Thread , NO_COPY - , NO_ASSIGNMENT + , NO_COPY_ASSIGNMENT ); public: diff --git a/src/thread.cpp b/src/thread.cpp index 2a27c10..f5e5f81 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -21,7 +21,7 @@ || BX_PLATFORM_IOS \ || BX_PLATFORM_OSX \ || BX_PLATFORM_PS4 \ - || BX_PLATFORM_RPI \ + || BX_PLATFORM_RPI \ || BX_PLATFORM_NX # include # if BX_PLATFORM_BSD