From d0d14ac774977d0060a351f66e35cb57ba0bf59c Mon Sep 17 00:00:00 2001 From: tetzank Date: Fri, 3 Sep 2021 14:52:26 +0200 Subject: [Bug] Fixed compile-time issue with ASMJIT_NONCOPYABLE/NONCONSTRUCTIBLE for GCC 11 in C++20 mode (#343) * fixed GCC 11 compilation in C++20 mode (don't use template parameters in constructors/operator assignment) * refactored ASMJIT_NONCOPYABLE/NONCONSTRUCTIBLE (variadic macros not needed) --- src/asmjit/core/api-config.h | 20 ++++++++------------ src/asmjit/core/compiler.cpp | 1 + src/asmjit/core/raassignment_p.h | 2 +- src/asmjit/core/radefs_p.h | 2 +- src/asmjit/core/string.h | 2 +- src/asmjit/core/zone.h | 2 +- src/asmjit/core/zonehash.h | 2 +- src/asmjit/core/zonestack.h | 2 +- src/asmjit/core/zonevector.h | 2 +- 9 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/asmjit/core/api-config.h b/src/asmjit/core/api-config.h index 0456e3d..c3f1080 100644 --- a/src/asmjit/core/api-config.h +++ b/src/asmjit/core/api-config.h @@ -514,18 +514,14 @@ namespace asmjit { // [asmjit::Build - Globals - Utilities] // ============================================================================ -#define ASMJIT_NONCOPYABLE(...) \ - private: \ - __VA_ARGS__(const __VA_ARGS__& other) = delete; \ - __VA_ARGS__& operator=(const __VA_ARGS__& other) = delete; \ - public: - -#define ASMJIT_NONCONSTRUCTIBLE(...) \ - private: \ - __VA_ARGS__() = delete; \ - __VA_ARGS__(const __VA_ARGS__& other) = delete; \ - __VA_ARGS__& operator=(const __VA_ARGS__& other) = delete; \ - public: +#define ASMJIT_NONCOPYABLE(Type) \ + Type(const Type& other) = delete; \ + Type& operator=(const Type& other) = delete; + +#define ASMJIT_NONCONSTRUCTIBLE(Type) \ + Type() = delete; \ + Type(const Type& other) = delete; \ + Type& operator=(const Type& other) = delete; // ============================================================================ // [asmjit::Build - Globals - Cleanup] diff --git a/src/asmjit/core/compiler.cpp b/src/asmjit/core/compiler.cpp index 4d7baab..6bd889f 100644 --- a/src/asmjit/core/compiler.cpp +++ b/src/asmjit/core/compiler.cpp @@ -41,6 +41,7 @@ ASMJIT_BEGIN_NAMESPACE class GlobalConstPoolPass : public Pass { typedef Pass Base; +public: ASMJIT_NONCOPYABLE(GlobalConstPoolPass) GlobalConstPoolPass() noexcept : Pass("GlobalConstPoolPass") {} diff --git a/src/asmjit/core/raassignment_p.h b/src/asmjit/core/raassignment_p.h index bcdf1a9..6b5df54 100644 --- a/src/asmjit/core/raassignment_p.h +++ b/src/asmjit/core/raassignment_p.h @@ -40,9 +40,9 @@ ASMJIT_BEGIN_NAMESPACE // ============================================================================ class RAAssignment { +public: ASMJIT_NONCOPYABLE(RAAssignment) -public: enum Ids : uint32_t { kPhysNone = 0xFF, kWorkNone = RAWorkReg::kIdNone diff --git a/src/asmjit/core/radefs_p.h b/src/asmjit/core/radefs_p.h index 5395542..53d2c71 100644 --- a/src/asmjit/core/radefs_p.h +++ b/src/asmjit/core/radefs_p.h @@ -496,7 +496,7 @@ public: template class RALiveSpans { public: - ASMJIT_NONCOPYABLE(RALiveSpans) + ASMJIT_NONCOPYABLE(RALiveSpans) typedef typename T::DataType DataType; ZoneVector _data; diff --git a/src/asmjit/core/string.h b/src/asmjit/core/string.h index 4c490d8..b58725e 100644 --- a/src/asmjit/core/string.h +++ b/src/asmjit/core/string.h @@ -371,7 +371,7 @@ public: template class StringTmp : public String { public: - ASMJIT_NONCOPYABLE(StringTmp) + ASMJIT_NONCOPYABLE(StringTmp) //! Embedded data. char _embeddedData[Support::alignUp(N + 1, sizeof(size_t))]; diff --git a/src/asmjit/core/zone.h b/src/asmjit/core/zone.h index 52e9f12..8947519 100644 --- a/src/asmjit/core/zone.h +++ b/src/asmjit/core/zone.h @@ -391,7 +391,7 @@ public: template class ZoneTmp : public Zone { public: - ASMJIT_NONCOPYABLE(ZoneTmp) + ASMJIT_NONCOPYABLE(ZoneTmp) //! Temporary storage, embedded after \ref Zone. struct Storage { diff --git a/src/asmjit/core/zonehash.h b/src/asmjit/core/zonehash.h index 0f1f21f..dbad427 100644 --- a/src/asmjit/core/zonehash.h +++ b/src/asmjit/core/zonehash.h @@ -175,7 +175,7 @@ public: template class ZoneHash : public ZoneHashBase { public: - ASMJIT_NONCOPYABLE(ZoneHash) + ASMJIT_NONCOPYABLE(ZoneHash) typedef NodeT Node; diff --git a/src/asmjit/core/zonestack.h b/src/asmjit/core/zonestack.h index 2de6cdc..e2aaa6f 100644 --- a/src/asmjit/core/zonestack.h +++ b/src/asmjit/core/zonestack.h @@ -133,7 +133,7 @@ public: template class ZoneStack : public ZoneStackBase { public: - ASMJIT_NONCOPYABLE(ZoneStack) + ASMJIT_NONCOPYABLE(ZoneStack) enum : uint32_t { kNumBlockItems = uint32_t((kBlockSize - sizeof(Block)) / sizeof(T)), diff --git a/src/asmjit/core/zonevector.h b/src/asmjit/core/zonevector.h index e95422a..1340bf8 100644 --- a/src/asmjit/core/zonevector.h +++ b/src/asmjit/core/zonevector.h @@ -143,7 +143,7 @@ public: template class ZoneVector : public ZoneVectorBase { public: - ASMJIT_NONCOPYABLE(ZoneVector) + ASMJIT_NONCOPYABLE(ZoneVector) // STL compatibility; typedef T value_type; -- cgit v1.2.3