From b58a4dd2f317579d68fb1afed0cc573b338cc5f4 Mon Sep 17 00:00:00 2001 From: Epixu Date: Wed, 13 Sep 2023 20:32:13 +0300 Subject: [PATCH] Renames; Exception flags depend on debugging/safe_mode --- CMakeLists.txt | 7 +++++++ source/Core/Common.hpp | 3 ++- source/Core/Config.hpp | 14 ++++---------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 65b3b62..a5cda60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,13 @@ if(LANGULUS_DEBUGGING OR CMAKE_BUILD_TYPE STREQUAL "Debug") set(LANGULUS_DEBUGGING ON CACHE BOOL "Debug mode detected" FORCE) set(LANGULUS_FEATURE_MEMORY_STATISTICS ON CACHE BOOL "Debug mode detected" FORCE) target_compile_definitions(LangulusCore INTERFACE LANGULUS_ASSERTION_LEVEL=1000) + if(MSVC) + target_compile_options(LangulusCore INTERFACE $,/EHar,/EHscr>) + endif() +else() + if(MSVC) + target_compile_options(LangulusCore INTERFACE $,/EHscr,/EHsc>) + endif() endif() if(LANGULUS_TESTING) diff --git a/source/Core/Common.hpp b/source/Core/Common.hpp index a471b7f..8092317 100644 --- a/source/Core/Common.hpp +++ b/source/Core/Common.hpp @@ -182,9 +182,10 @@ namespace Langulus #ifndef LANGULUS_ALIGNMENT #define LANGULUS_ALIGNMENT 16 #endif - + /// The default alignment, depends on configuration and enabled SIMD constexpr Size Alignment = LANGULUS_ALIGNMENT; + #define LANGULUS_ALIGNED() alignas(::Langulus::Alignment) /// The bitness constexpr Size Bitness = LANGULUS(BITNESS); diff --git a/source/Core/Config.hpp b/source/Core/Config.hpp index f1a1983..ee18713 100644 --- a/source/Core/Config.hpp +++ b/source/Core/Config.hpp @@ -27,17 +27,11 @@ #endif #if LANGULUS_SAFE() - #define SAFETY(a) a - // Some functions throw only in safe mode - #define SAFETY_NOEXCEPT() - // Some functions are constexpr only when safe mode is disabled - #define SAFETY_CONSTEXPR() + #define IF_SAFE(a) a + #define IF_UNSAFE(a) #else - #define SAFETY(a) - // Some functions throw only in safe mode - #define SAFETY_NOEXCEPT() noexcept - // Some functions are constexpr only when safe mode is disabled - #define SAFETY_CONSTEXPR() constexpr + #define IF_SAFE(a) + #define IF_UNSAFE(a) a #endif /// Testing mode exposes some otherwise private functions