Made the lib work with -fno-exceptions (at least for now).

This commit is contained in:
2025-03-02 14:35:37 +01:00
parent 21b3b2c03a
commit ba23cb0c70
5 changed files with 50 additions and 12 deletions

View File

@@ -4,19 +4,21 @@
#if !defined(MIJIN_INTERNAL_EXCEPTION_HPP_INCLUDED)
#define MIJIN_INTERNAL_EXCEPTION_HPP_INCLUDED 1
#if !defined(MIJIN_WITH_EXCEPTIONS)
#define MIJIN_WITH_EXCEPTIONS 0
#if !defined(MIJIN_ENABLE_EXCEPTIONS)
# define MIJIN_ENABLE_EXCEPTIONS (__cpp_exceptions)
#endif
#define MIJIN_CATCH_EXCEPTIONS (__cpp_exceptions)
#if !defined(MIJIN_THROWING_ASSERTS)
#define MIJIN_THROWING_ASSERTS 0
# define MIJIN_THROWING_ASSERTS 0
#endif
#if MIJIN_THROWING_ASSERTS && !defined(MIJIN_TEST_NO_NOEXCEPT)
#define MIJIN_TEST_NO_NOEXCEPT
#endif
#if MIJIN_WITH_EXCEPTIONS
#if 0 // TODO: what? MIJIN_WITH_EXCEPTIONS
#error "Maybe someday"
#else
#if defined(MIJIN_TEST_NO_NOEXCEPT) // only use for testing
@@ -30,4 +32,12 @@
#endif
#endif
#if MIJIN_CATCH_EXCEPTIONS
# define MIJIN_TRY try
# define MIJIN_CATCH catch
#else
# define MIJIN_TRY
# define MIJIN_CATCH(...) if constexpr(false)
#endif
#endif // !defined(MIJIN_INTERNAL_EXCEPTION_HPP_INCLUDED)