From b79d8efce69ec409e51b43736979d5afa95db233 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 25 May 2023 14:11:51 +0200 Subject: [PATCH] Don't use RTTI features when building with `-fno-rtti` This should make it possible to use `-fno-rtti` in a C++ application even when Panda has been compiled with RTTI enabled. --- panda/src/express/nodeReferenceCount.I | 2 +- panda/src/express/referenceCount.I | 2 +- panda/src/putil/copyOnWriteObject.I | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/panda/src/express/nodeReferenceCount.I b/panda/src/express/nodeReferenceCount.I index d87bc982d8..66a8be1cea 100644 --- a/panda/src/express/nodeReferenceCount.I +++ b/panda/src/express/nodeReferenceCount.I @@ -213,7 +213,7 @@ NodeRefCountObj(const Base ©) : Base(copy) { template void NodeRefCountObj:: init_type() { -#if defined(HAVE_RTTI) && !defined(__EDG__) +#if defined(HAVE_RTTI) && !defined(__EDG__) && (!defined(__GNUC__) || defined(__GXX_RTTI)) // If we have RTTI, we can determine the name of the base type. std::string base_name = typeid(Base).name(); #else diff --git a/panda/src/express/referenceCount.I b/panda/src/express/referenceCount.I index f4d71b1117..870362ff14 100644 --- a/panda/src/express/referenceCount.I +++ b/panda/src/express/referenceCount.I @@ -424,7 +424,7 @@ RefCountObj(const Base ©) : Base(copy) { template void RefCountObj:: init_type() { -#if defined(HAVE_RTTI) && !defined(__EDG__) +#if defined(HAVE_RTTI) && !defined(__EDG__) && (!defined(__GNUC__) || defined(__GXX_RTTI)) // If we have RTTI, we can determine the name of the base type. std::string base_name = typeid(Base).name(); #else diff --git a/panda/src/putil/copyOnWriteObject.I b/panda/src/putil/copyOnWriteObject.I index bcf326d87c..a6afee7163 100644 --- a/panda/src/putil/copyOnWriteObject.I +++ b/panda/src/putil/copyOnWriteObject.I @@ -128,7 +128,7 @@ make_cow_copy() { template void CopyOnWriteObj:: init_type() { -#if defined(HAVE_RTTI) && !defined(__EDG__) +#if defined(HAVE_RTTI) && !defined(__EDG__) && (!defined(__GNUC__) || defined(__GXX_RTTI)) // If we have RTTI, we can determine the name of the base type. std::string base_name = typeid(Base).name(); #else @@ -188,7 +188,7 @@ make_cow_copy() { template void CopyOnWriteObj1:: init_type() { -#if defined(HAVE_RTTI) && !defined(__EDG__) +#if defined(HAVE_RTTI) && !defined(__EDG__) && (!defined(__GNUC__) || defined(__GXX_RTTI)) // If we have RTTI, we can determine the name of the base type. std::string base_name = typeid(Base).name(); #else