[*] Config crinkle

This commit is contained in:
Reece Wilson 2022-03-27 12:11:59 +01:00
parent 526444882b
commit f7064b8643
2 changed files with 49 additions and 3 deletions

View File

@ -7,6 +7,10 @@
***/
#pragma once
////////////////////////////////////////////////////////////////////////////////////////////////
// Exception model
////////////////////////////////////////////////////////////////////////////////////////////////
#if !defined(AUROXTL_NO_TRY)
#define AUROXTL_COMMODITY_TRY try
#define AUROXTL_COMMODITY_CATCH catch (...)
@ -15,16 +19,53 @@
#define AUROXTL_COMMODITY_CATCH while (0)
#endif
////////////////////////////////////////////////////////////////////////////////////////////////
// Stinky container config (leave it alone)
////////////////////////////////////////////////////////////////////////////////////////////////
#if (!defined(AURORA_ENGINE_KERNEL) && \
!defined(_AUHAS_AURORARUNTIME))
// If we're in our ecosystem, assume global allocator override in all modules
// std::allocator __will__ be Aurora::memory backed no matter what
//
// Externally, however, the ABI of the type matters.
// > We want the differing ABI for std
// > We want customers' STLs' containers' move/copy semantics to apply
// > ...w/o copying between container types
//
// Therefore, `#if !defined(aurora)
// #define USE_STL //(for source compatibility)
// #endif `
#define AURORA_ROXTL_ALLOCATORS_USE_STD
#endif
#if defined(AURORA_ROXTL_ALLOCATORS_USE_STD)
// Crossing API boundaries will resort in an alloc + copy
// Don't enable unless you're in the ecosystem
// Default behaviour (omitted): use the exact std::string type
#define AURORA_ROXTL_CONTAINERS_USE_PURE
#endif
// Crossing API boundaries will resort in an alloc + copy
// Don't enable unless you're in the ecosystem
// Default behaviour (omitted): use the exact std::string type
////////////////////////////////////////////////////////////////////////////////////////////////
// Memory, AuSPtr, and Friends
////////////////////////////////////////////////////////////////////////////////////////////////
#if defined(AURORA_ROXTL_NULL_POINTER_CHECKS_DISABLED)
#define _AURORA_NULLEXPT_ENABLE_UB
#endif
#if defined(AURORA_ROXTL_NULL_POINTER_CHECKS_USE_COMPARE_OVER_INDIRECT_JMP)
#define _AURORA_NULLEXPT_BRANCH
#endif
#if defined(AURORA_ROXTL_NULL_POINTER_COMPARE_MODE_AGGRESSIVE)
#define _AURORA_NULLEXPT_BRANCH_BUG_CHECK
#endif
////////////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -355,11 +355,14 @@ namespace Aurora::Memory
}
}
#else
bool cached {};
auline void throwif() const
{
if (!cached) [[unlikely]]
{
#if defined(_AURORA_NULLEXPT_BRANCH_BUG_CHECK)
if (!Base_t::operator bool()) [[likely]]
#endif
{
AU_THROW_STRING("ExSharedPointer Null Access Violation");
}
@ -370,8 +373,10 @@ namespace Aurora::Memory
{
if (!cached) [[unlikely]]
{
#if defined(_AURORA_NULLEXPT_BRANCH_BUG_CHECK)
cached = Base_t::operator bool();
if (!cached) [[likely]]
#endif
{
AU_THROW_STRING("ExSharedPointer Null Access Violation");
}