AuROXTL/Include/auROXTL/AU_Z.hpp

104 lines
3.4 KiB
C++
Raw Permalink Normal View History

2022-04-01 04:06:53 +00:00
/***
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
////////////////////////////////////////////////////////////////////////////////////////////////
2024-03-01 22:33:50 +00:00
#if !defined(AUROXTL_NO_TRY) && !defined(AURORA_ROXTL_NO_TRY)
2022-04-01 04:06:53 +00:00
#define AUROXTL_COMMODITY_TRY try
#define AUROXTL_COMMODITY_CATCH catch (...)
#else
#define AUROXTL_COMMODITY_TRY
#define AUROXTL_COMMODITY_CATCH while (0)
#endif
2024-03-01 22:33:50 +00:00
#if !defined(AUROXTL_NO_CONSTEXPR) && !defined(AURORA_ROXTL_NO_CONSTEXPR)
#define AUROXTL_CONSTEXPR constexpr
#else
#define AUROXTL_CONSTEXPR
#endif
2022-04-01 04:06:53 +00:00
////////////////////////////////////////////////////////////////////////////////////////////////
// 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
2022-04-01 04:06:53 +00:00
#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
#if !defined(AURORA_ROXTL_HAS_RUNTIME)
// AURORA_ENGINE_KERNEL - static or local translation unit
// _AUHAS_AURORARUNTIME - standard pipeline macro for including a product by the name AuroraRuntime
#if defined(AURORA_ENGINE_KERNEL) || (defined(_AUHAS_AURORARUNTIME) && _AUHAS_AURORARUNTIME == 1)
#define AURORA_ROXTL_HAS_RUNTIME 1
#else
#define AURORA_ROXTL_HAS_RUNTIME 0
#endif
#endif