Skip to content

Commit

Permalink
Renames; Exception flags depend on debugging/safe_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Epixu committed Sep 13, 2023
1 parent 194ddd0 commit b58a4dd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<IF:$<BOOL:${LANGULUS_SAFE_MODE}>,/EHar,/EHscr>)
endif()
else()
if(MSVC)
target_compile_options(LangulusCore INTERFACE $<IF:$<BOOL:${LANGULUS_SAFE_MODE}>,/EHscr,/EHsc>)
endif()
endif()

if(LANGULUS_TESTING)
Expand Down
3 changes: 2 additions & 1 deletion source/Core/Common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 4 additions & 10 deletions source/Core/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b58a4dd

Please sign in to comment.