mirror of
https://github.com/asmjit/asmjit.git
synced 2025-12-17 12:34:35 +03:00
[Bug] Fixed ASMJIT_NO_STDCXX option broken by previous commit
This commit is contained in:
@@ -14,9 +14,14 @@ ASMJIT_BEGIN_NAMESPACE
|
|||||||
//! \addtogroup asmjit_utilities
|
//! \addtogroup asmjit_utilities
|
||||||
//! \{
|
//! \{
|
||||||
namespace Support {
|
namespace Support {
|
||||||
//! Cast designed to cast between function and void* pointers.
|
|
||||||
template<typename Dst, typename Src>
|
//! Cast designed to cast between function and void* pointers.
|
||||||
static inline Dst ptr_cast_impl(Src p) noexcept { return (Dst)p; }
|
template<typename Dst, typename Src>
|
||||||
|
static inline Dst ptr_cast_impl(Src p) noexcept { return (Dst)p; }
|
||||||
|
|
||||||
|
//! Helper to implement placement new/delete without relying on `<new>` header.
|
||||||
|
struct PlacementNew { void* ptr; };
|
||||||
|
|
||||||
} // {Support}
|
} // {Support}
|
||||||
|
|
||||||
#if defined(ASMJIT_NO_STDCXX)
|
#if defined(ASMJIT_NO_STDCXX)
|
||||||
@@ -30,7 +35,10 @@ namespace Support {
|
|||||||
ASMJIT_FORCE_INLINE void operator delete(void* ptr) noexcept { Support::operatorDelete(ptr); } \
|
ASMJIT_FORCE_INLINE void operator delete(void* ptr) noexcept { Support::operatorDelete(ptr); } \
|
||||||
\
|
\
|
||||||
ASMJIT_FORCE_INLINE void* operator new(size_t, void* ptr) noexcept { return ptr; } \
|
ASMJIT_FORCE_INLINE void* operator new(size_t, void* ptr) noexcept { return ptr; } \
|
||||||
ASMJIT_FORCE_INLINE void operator delete(void*, void*) noexcept {}
|
ASMJIT_FORCE_INLINE void operator delete(void*, void*) noexcept {} \
|
||||||
|
\
|
||||||
|
ASMJIT_FORCE_INLINE void* operator new(size_t, Support::PlacementNew ptr) noexcept { return ptr.ptr; } \
|
||||||
|
ASMJIT_FORCE_INLINE void operator delete(void*, Support::PlacementNew) noexcept {}
|
||||||
#else
|
#else
|
||||||
#define ASMJIT_BASE_CLASS(TYPE)
|
#define ASMJIT_BASE_CLASS(TYPE)
|
||||||
#endif
|
#endif
|
||||||
@@ -393,4 +401,14 @@ ASMJIT_API void ASMJIT_NORETURN assertionFailed(const char* file, int line, cons
|
|||||||
|
|
||||||
ASMJIT_END_NAMESPACE
|
ASMJIT_END_NAMESPACE
|
||||||
|
|
||||||
|
//! Implementation of a placement new so we don't have to depend on `<new>`.
|
||||||
|
ASMJIT_INLINE_NODEBUG void* operator new(size_t, const asmjit::Support::PlacementNew& p) noexcept {
|
||||||
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
|
__assume(p.ptr != nullptr); // Otherwise MSVC would emit a nullptr check.
|
||||||
|
#endif
|
||||||
|
return p.ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASMJIT_INLINE_NODEBUG void operator delete(void*, const asmjit::Support::PlacementNew&) noexcept {}
|
||||||
|
|
||||||
#endif // ASMJIT_CORE_GLOBALS_H_INCLUDED
|
#endif // ASMJIT_CORE_GLOBALS_H_INCLUDED
|
||||||
|
|||||||
@@ -21,12 +21,6 @@ ASMJIT_BEGIN_NAMESPACE
|
|||||||
//! here is considered internal and should not be used outside of AsmJit and related projects like AsmTK.
|
//! here is considered internal and should not be used outside of AsmJit and related projects like AsmTK.
|
||||||
namespace Support {
|
namespace Support {
|
||||||
|
|
||||||
// Support - Placement New
|
|
||||||
// =======================
|
|
||||||
|
|
||||||
//! Helper to implement placement new/delete without relying on `<new>` header.
|
|
||||||
struct PlacementNew { void* ptr; };
|
|
||||||
|
|
||||||
// Support - Basic Traits
|
// Support - Basic Traits
|
||||||
// ======================
|
// ======================
|
||||||
|
|
||||||
@@ -1765,14 +1759,4 @@ struct Temporary {
|
|||||||
|
|
||||||
ASMJIT_END_NAMESPACE
|
ASMJIT_END_NAMESPACE
|
||||||
|
|
||||||
//! Implementation of a placement new so we don't have to depend on `<new>`.
|
|
||||||
ASMJIT_INLINE_NODEBUG void* operator new(size_t, const asmjit::Support::PlacementNew& p) noexcept {
|
|
||||||
#if defined(_MSC_VER) && !defined(__clang__)
|
|
||||||
__assume(p.ptr != nullptr); // Otherwise MSVC would emit a nullptr check.
|
|
||||||
#endif
|
|
||||||
return p.ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
ASMJIT_INLINE_NODEBUG void operator delete(void*, const asmjit::Support::PlacementNew&) noexcept {}
|
|
||||||
|
|
||||||
#endif // ASMJIT_CORE_SUPPORT_H_INCLUDED
|
#endif // ASMJIT_CORE_SUPPORT_H_INCLUDED
|
||||||
|
|||||||
Reference in New Issue
Block a user