AuROXTL/Include/auROXTL/AU_Z.hpp

94 lines
3.0 KiB
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AU_Z.hpp
Date: 2022-3-26
Author: Reece
***/
#pragma once
////////////////////////////////////////////////////////////////////////////////////////////////
// Exception model
////////////////////////////////////////////////////////////////////////////////////////////////
#if !defined(AUROXTL_NO_TRY) && !defined(AURORA_ROXTL_NO_TRY)
#define AUROXTL_COMMODITY_TRY try
#define AUROXTL_COMMODITY_CATCH catch (...)
#else
#define AUROXTL_COMMODITY_TRY
#define AUROXTL_COMMODITY_CATCH while (0)
#endif
#if !defined(AUROXTL_NO_CONSTEXPR) && !defined(AURORA_ROXTL_NO_CONSTEXPR)
#define AUROXTL_CONSTEXPR constexpr
#else
#define AUROXTL_CONSTEXPR
#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
////////////////////////////////////////////////////////////////////////////////////////////////
// Memory, AuSPtr, and Friends
////////////////////////////////////////////////////////////////////////////////////////////////
#if defined(AU_CFG_ID_SHIP)
#define AURORA_ROXTL_NULL_POINTER_CHECKS_DISABLED
#endif
#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
////////////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////////////
//#define _AURORA_NULLEXPT_USE_TRY_EMPLACE_AFTER_FIND
//#define _AURORA_MISSING_STD_EXCEPTION
//#define _AURORA_AVOID_DUMB_STL_TYPES
#define _AURORA_AVOID_EXTREMLY_DUMB_STL_TYPES
// TODO:
#if !defined(_AURORA_NULLEXPT_BRANCH)
#define _AURORA_NULLEXPT_BRANCH
#endif