44 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
 | 
						|
#pragma once
 | 
						|
 | 
						|
#if !defined(MIJIN_INTERNAL_EXCEPTION_HPP_INCLUDED)
 | 
						|
#define MIJIN_INTERNAL_EXCEPTION_HPP_INCLUDED 1
 | 
						|
 | 
						|
#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
 | 
						|
#endif
 | 
						|
 | 
						|
#if MIJIN_THROWING_ASSERTS && !defined(MIJIN_TEST_NO_NOEXCEPT)
 | 
						|
#define MIJIN_TEST_NO_NOEXCEPT
 | 
						|
#endif
 | 
						|
 | 
						|
#if 0 // TODO: what? MIJIN_WITH_EXCEPTIONS
 | 
						|
#error "Maybe someday"
 | 
						|
#else
 | 
						|
#if defined(MIJIN_TEST_NO_NOEXCEPT) // only use for testing
 | 
						|
#define MIJIN_NOEXCEPT
 | 
						|
#define MIJIN_THROWS
 | 
						|
#define MIJIN_CONDITIONAL_NOEXCEPT(...)
 | 
						|
#else
 | 
						|
#define MIJIN_NOEXCEPT noexcept
 | 
						|
#define MIJIN_THROWS noexcept
 | 
						|
#define MIJIN_CONDITIONAL_NOEXCEPT(...) noexcept(__VA_ARGS__)
 | 
						|
#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)
 |