From b44d6feb9765a54251ed31d19f165619e1911b7e Mon Sep 17 00:00:00 2001
From: Patrick Wuttke
Date: Sat, 30 Aug 2025 00:28:19 +0200
Subject: [PATCH] Added MIJIN_RTTI macro for detecting if RTTI is available.
---
source/mijin/detect.hpp | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/source/mijin/detect.hpp b/source/mijin/detect.hpp
index cc38e80..a856f97 100644
--- a/source/mijin/detect.hpp
+++ b/source/mijin/detect.hpp
@@ -61,6 +61,26 @@ namespace mijin
#endif
#endif
+#if !defined(MIJIN_RTTI)
+ #if MIJIN_COMPILER == MIJIN_COMPILER_GCC
+ #if defined(__GXX_RTTI)
+ #define MIJIN_RTTI 1
+ #else
+ #define MIJIN_RTTI 0
+ #endif
+ #elif MIJIN_COMPILER == MIJIN_COMPILER_CLANG
+ #define MIJIN_RTTI (__has_feature(cxx_rtti))
+ #elif MIJIN_COMPILER == MIJIN_COMPILER_MSVC
+ #if defined(_CPPRTTI)
+ #define MIJIN_RTTI 1
+ #else
+ #define MIJIN_RTTI 0
+ #endif
+ #else
+ #define MIJIN_RTTI 0
+ #endif
+#endif
+
//
// public constants
//