Browse Source

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.
rdb 2 years ago
parent
commit
b79d8efce6

+ 1 - 1
panda/src/express/nodeReferenceCount.I

@@ -213,7 +213,7 @@ NodeRefCountObj(const Base &copy) : Base(copy) {
 template<class Base>
 template<class Base>
 void NodeRefCountObj<Base>::
 void NodeRefCountObj<Base>::
 init_type() {
 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.
   // If we have RTTI, we can determine the name of the base type.
   std::string base_name = typeid(Base).name();
   std::string base_name = typeid(Base).name();
 #else
 #else

+ 1 - 1
panda/src/express/referenceCount.I

@@ -424,7 +424,7 @@ RefCountObj(const Base &copy) : Base(copy) {
 template<class Base>
 template<class Base>
 void RefCountObj<Base>::
 void RefCountObj<Base>::
 init_type() {
 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.
   // If we have RTTI, we can determine the name of the base type.
   std::string base_name = typeid(Base).name();
   std::string base_name = typeid(Base).name();
 #else
 #else

+ 2 - 2
panda/src/putil/copyOnWriteObject.I

@@ -128,7 +128,7 @@ make_cow_copy() {
 template<class Base>
 template<class Base>
 void CopyOnWriteObj<Base>::
 void CopyOnWriteObj<Base>::
 init_type() {
 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.
   // If we have RTTI, we can determine the name of the base type.
   std::string base_name = typeid(Base).name();
   std::string base_name = typeid(Base).name();
 #else
 #else
@@ -188,7 +188,7 @@ make_cow_copy() {
 template<class Base, class Param1>
 template<class Base, class Param1>
 void CopyOnWriteObj1<Base, Param1>::
 void CopyOnWriteObj1<Base, Param1>::
 init_type() {
 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.
   // If we have RTTI, we can determine the name of the base type.
   std::string base_name = typeid(Base).name();
   std::string base_name = typeid(Base).name();
 #else
 #else