You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2005/12/02 21:28:57 UTC

svn commit: r351833 - in /incubator/stdcxx/trunk: include/typeinfo src/typeinfo.cpp

Author: sebor
Date: Fri Dec  2 12:28:51 2005
New Revision: 351833

URL: http://svn.apache.org/viewcvs?rev=351833&view=rev
Log:
2005-12-02  Martin Sebor  <se...@roguewave.com>

	STDCXX-73
	* typeinfo: Used guard macros appropriate for each class instead
	of fudging it based on what appears to work in most cases (except
	for MSVC 8).
	* typeinfo.cpp: Same. Also indented preprocessor conditionals for
	readability.

Modified:
    incubator/stdcxx/trunk/include/typeinfo
    incubator/stdcxx/trunk/src/typeinfo.cpp

Modified: incubator/stdcxx/trunk/include/typeinfo
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/include/typeinfo?rev=351833&r1=351832&r2=351833&view=diff
==============================================================================
--- incubator/stdcxx/trunk/include/typeinfo (original)
+++ incubator/stdcxx/trunk/include/typeinfo Fri Dec  2 12:28:51 2005
@@ -27,9 +27,7 @@
 #include <rw/_defs.h>
 
 
-#if    !defined (_RWSTD_NO_STD_BAD_TYPEID)   \
-    || !defined (_RWSTD_NO_RUNTIME_IN_STD)   \
-    ||  2 == __GNUG__ && !defined (_RWSTD_NO_HONOR_STD)
+#ifndef _RWSTD_NO_STD_TYPE_INFO
 
 // define type_info et al in namespace std iff they are found to be
 // defined in namespace std in the compiler's language support library
@@ -38,7 +36,7 @@
 
 _RWSTD_NAMESPACE (std) {
 
-#endif   // !NO_BAD_TYPEID || !RUNTIME_IN_STD ...
+#endif   // _RWSTD_NO_STD_TYPE_INFO
 
 
 #ifndef _RWSTD_NO_NAMESPACE
@@ -128,13 +126,11 @@
 };
 
 
-#if    !defined (_RWSTD_NO_STD_BAD_TYPEID)   \
-    || !defined (_RWSTD_NO_RUNTIME_IN_STD)   \
-    ||  2 == __GNUG__ && !defined (_RWSTD_NO_HONOR_STD)
+#ifndef _RWSTD_NO_STD_TYPE_INFO
 
 }   // namespace std
 
-#else
+#else   // if defined (_RWSTD_NO_STD_TYPE_INFO)
 #  ifndef _RWSTD_NO_NAMESPACE
 
 namespace std {
@@ -144,14 +140,14 @@
 }   // namespace std
 
 #  endif   // _RWSTD_NO_NAMESPACE
-#endif   // !NO_BAD_TYPEID || !RUNTIME_IN_STD ...
+#endif   // _RWSTD_NO_STD_TYPE_INFO
 
 
-#if !defined (_RWSTD_NO_STD_BAD_CAST) || !defined (_RWSTD_NO_RUNTIME_IN_STD)
+#ifndef _RWSTD_NO_STD_BAD_CAST
 
 _RWSTD_NAMESPACE (std) { 
 
-#endif   // !NO_BAD_CAST || !RUNTIME_IN_STD
+#endif   // _RWSTD_NO_STD_BAD_CAST
 
 
 // 18.5.2
@@ -173,11 +169,11 @@
     virtual const char* what () const _THROWS (());
 };
 
-#if !defined (_RWSTD_NO_STD_BAD_CAST) || !defined (_RWSTD_NO_RUNTIME_IN_STD)
+#ifndef _RWSTD_NO_STD_BAD_CAST
 
 }   // namespace std
 
-#else
+#else   // if defined (_RWSTD_NO_STD_BAD_CAST)
 #  ifndef _RWSTD_NO_NAMESPACE
 
 namespace std {
@@ -187,15 +183,14 @@
 }   // namespace std
 
 #  endif   // _RWSTD_NO_NAMESPACE
+#endif   // _RWSTD_NO_STD_BAD_CAST
 
-#endif   // !NO_BAD_CAST || !RUNTIME_IN_STD
 
-
-#if !defined (_RWSTD_NO_STD_BAD_TYPEID) || !defined (_RWSTD_NO_RUNTIME_IN_STD)
+#ifndef _RWSTD_NO_STD_BAD_TYPEID
 
 _RWSTD_NAMESPACE (std) {
 
-#endif   // !NO_TYPEID || !RUNTIME_IN_STD
+#endif   // _RWSTD_NO_BAD_NO_TYPEID
 
 
 // 18.5.3
@@ -218,11 +213,11 @@
 };
 
 
-#if !defined (_RWSTD_NO_STD_BAD_TYPEID) || !defined (_RWSTD_NO_RUNTIME_IN_STD)
+#ifndef _RWSTD_NO_STD_BAD_TYPEID
 
 }   // namespace std
 
-#else
+#else   // if defined (_RWSTD_NO_STD_BAD_TYPEID)
 #  ifndef _RWSTD_NO_NAMESPACE
 
 namespace std {
@@ -232,7 +227,7 @@
 }   // namespace std
 
 #  endif   // _RWSTD_NO_NAMESPACE
-#endif   // !NO_TYPEID || !RUNTIME_IN_STD
+#endif   // _RWSTD_NO_STD_BAD_TYPEID
 
 
 

Modified: incubator/stdcxx/trunk/src/typeinfo.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/src/typeinfo.cpp?rev=351833&r1=351832&r2=351833&view=diff
==============================================================================
--- incubator/stdcxx/trunk/src/typeinfo.cpp (original)
+++ incubator/stdcxx/trunk/src/typeinfo.cpp Fri Dec  2 12:28:51 2005
@@ -3,7 +3,7 @@
  * typeinfo.cpp - definitions of the Standard Library type_info
  *                and bad_cast class members
  *
- * $Id: //stdlib/dev/source/stdlib/typeinfo.cpp#11 $
+ * $Id$
  *
  ***************************************************************************
  *
@@ -50,9 +50,13 @@
 // (as opposed to the compiler's native) has been included
 // SunPro always #includes its own, regardless of options
 
-#  if    !defined (_RWSTD_NO_STD_BAD_TYPEID)   \
-      || !defined (_RWSTD_NO_RUNTIME_IN_STD)   \
-      ||  2 == __GNUG__ && !defined (_RWSTD_NO_HONOR_STD)
+#  if    !defined (_RWSTD_NO_STD_TYPE_INFO) \
+      || !defined (_RWSTD_NO_GLOBAL_TYPE_INFO)
+
+// at least one of the config tests above succeeded,
+// rely on config tests for each individual member
+
+#    ifndef _RWSTD_NO_STD_TYPE_INFO
 
 // define type_info et al in namespace std iff they are found to be
 // defined in namespace std in the compiler's language support library
@@ -61,32 +65,27 @@
 
 _RWSTD_NAMESPACE (std) {
 
-#endif   // !NO_BAD_TYPEID || !RUNTIME_IN_STD ...
+#    endif   // _RWSTD_NO_STD_TYPE_INFO
 
 
-#if !defined (_RWSTD_NO_STD_TYPEINFO) || !defined (_RWSTD_NO_GLOBAL_TYPEINFO)
-
-// at least one of the config tests above succeeded,
-// rely on config tests for each individual member
-
-#  ifdef _RWSTD_NO_TYPE_INFO_DTOR
+#    ifdef _RWSTD_NO_TYPE_INFO_DTOR
 
 type_info::~type_info () { }
 
-#  endif   // _RWSTD_NO_TYPE_INFO_DTOR
+#    endif   // _RWSTD_NO_TYPE_INFO_DTOR
 
 
-#  ifdef _RWSTD_NO_TYPE_INFO_BEFORE
+#    ifdef _RWSTD_NO_TYPE_INFO_BEFORE
 
 bool type_info::before (const type_info &rhs) const
 {
     return 0 > _RW::__rw_ticmp (*this, rhs);
 }
 
-#  endif   // _RWSTD_NO_TYPE_INFO_BEFORE
+#    endif   // _RWSTD_NO_TYPE_INFO_BEFORE
 
 
-#  ifdef _RWSTD_NO_TYPE_INFO_NAME
+#    ifdef _RWSTD_NO_TYPE_INFO_NAME
 
 // used in type_info::name() when the class has no member called _C_name
 static const char _C_name[] = "";
@@ -96,42 +95,54 @@
     return _C_name;
 }
 
-#  endif   // _RWSTD_NO_TYPE_INFO_NAME
+#    endif   // _RWSTD_NO_TYPE_INFO_NAME
 
 
-#  ifdef _RWSTD_NO_TYPE_INFO_EQUALITY
+#    ifdef _RWSTD_NO_TYPE_INFO_EQUALITY
 
 bool type_info::operator== (const type_info &rhs) const
 {
     return !before (rhs) && !rhs.before (*this);
 }
 
-#  endif   // _RWSTD_NO_TYPE_INFO_EQUALITY
+#    endif   // _RWSTD_NO_TYPE_INFO_EQUALITY
 
 
-#  ifdef _RWSTD_NO_TYPE_INFO_INEQUALITY
+#    ifdef _RWSTD_NO_TYPE_INFO_INEQUALITY
 
 bool type_info::operator!= (const type_info &rhs) const
 {
     return !(*this == rhs);
 }
 
-#  endif   // _RWSTD_NO_TYPE_INFO_INEQUALITY
+#    endif   // _RWSTD_NO_TYPE_INFO_INEQUALITY
+
+#    ifndef _RWSTD_NO_STD_TYPE_INFO
 
-#else   // if _RWSTD_NO_STD_TYPEINFO && _RWSTD_NO_GLOBAL_TYPEINFO
+}   // namespace std
+
+#    endif   // _RWSTD_NO_STD_TYPE_INFO
+
+#  else   // if _RWSTD_NO_STD_TYPEINFO && _RWSTD_NO_GLOBAL_TYPEINFO
 
 // both config tests for class type_info failed so config test
 // results for each individual member are likely to be unreliable
-// rely on platform knowledge
+// rely on platform knowledge instead
 
-#  if defined (__HP_aCC)
+#    ifndef _RWSTD_NO_RUNTIME_IN_STD
+
+_RWSTD_NAMESPACE (std) {
+
+#    endif   // _RWSTD_NO_RUNTIME_IN_STD
+
+#    if defined (__HP_aCC)
 
 const char* type_info::name () const
 {
     return _C_name;
 }
 
-#    ifdef _HP_IA64ABI
+#      ifdef _HP_IA64ABI
 
 bool type_info::before (const type_info &rhs) const
 {
@@ -148,9 +159,9 @@
     return !(*this == rhs);
 }
 
-#    endif   // _HP_IA64ABI
+#      endif   // _HP_IA64ABI
 
-#  elif defined (__INTEL_COMPILER) && !defined (_MSC_VER)
+#    elif defined (__INTEL_COMPILER) && !defined (_MSC_VER)
 
 const char* type_info::name () const
 {
@@ -172,7 +183,7 @@
     return !(*this == rhs);
 }
 
-#  elif defined (__GNUG__) && !defined (_RWSTD_NO_HONOR_STD)
+#    elif defined (__GNUG__) && !defined (_RWSTD_NO_HONOR_STD)
 
 // define member functions inline in namespace std (they are defined
 // as members of ::type_info (as opposed to std::type_info) in libstdc++
@@ -193,7 +204,7 @@
     return !(*this == rhs);
 }
 
-#  elif defined (__IBMCPP__)
+#    elif defined (__IBMCPP__)
 
 const char* type_info::name () const
 {
@@ -210,10 +221,10 @@
     return !(*this == rhs);
 }
 
-#  endif   // __IBMCPP__
+#    endif   // __IBMCPP__
 
 
-#  if defined (__GNUG__) && !defined (_RWSTD_NO_HONOR_STD)
+#    if defined (__GNUG__) && !defined (_RWSTD_NO_HONOR_STD)
 
 // define member function in namespace std (it is defined as a member
 // of ::type_info (as opposed to std::type_info) in libstdc++
@@ -223,17 +234,17 @@
     return 0 > _RW::__rw_ticmp (*this, rhs);
 }
 
-#  elif defined (__IBMCPP__)
+#    elif defined (__IBMCPP__)
 
 bool type_info::before (const type_info &rhs) const
 {
     return 0 > _RW::__rw_ticmp (*this, rhs);
 }
 
-#  endif   //  __GNUG__ && !_RWSTD_NO_HONOR_STD
+#    endif   //  __GNUG__ && !_RWSTD_NO_HONOR_STD
 
 
-#  ifdef _MSC_VER
+#    ifdef _MSC_VER
 
 const char* type_info::name () const
 {
@@ -259,23 +270,36 @@
     return !(*this == rhs);
 }
 
-#  endif   // _MSC_VER
-#endif   // !_RWSTD_NO_STD_TYPEINFO || !_RWSTD_NO_GLOBAL_TYPEINFO
+#    endif   // _MSC_VER
+
+#    ifndef _RWSTD_NO_RUNTIME_IN_STD
+
+}   // namespace std
+
+#    endif   // _RWSTD_NO_RUNTIME_IN_STD
+
+#  endif   // !_RWSTD_NO_STD_TYPEINFO || !_RWSTD_NO_GLOBAL_TYPEINFO
 
 
 //**************************************************************************
 // class bad_cast members
 
-#ifdef _RWSTD_NO_BAD_CAST_DEFAULT_CTOR
+#  ifndef _RWSTD_NO_STD_BAD_CAST
+
+_RWSTD_NAMESPACE (std) {
+
+#  endif   // _RWSTD_NO_STD_BAD_CAST
+
+#  ifdef _RWSTD_NO_BAD_CAST_DEFAULT_CTOR
 
 bad_cast::bad_cast () _THROWS (())
 {
     // empty
 }
 
-#endif   // _RWSTD_NO_BAD_CAST_DEFAULT_CTOR
+#  endif   // _RWSTD_NO_BAD_CAST_DEFAULT_CTOR
 
-#ifdef _RWSTD_NO_BAD_CAST_COPY_CTOR
+#  ifdef _RWSTD_NO_BAD_CAST_COPY_CTOR
 
 bad_cast::bad_cast (const bad_cast &rhs) _THROWS (())
     : exception (rhs)
@@ -283,18 +307,18 @@
     // empty
 }
 
-#endif   // _RWSTD_NO_BAD_CAST_COPY_CTOR
+#  endif   // _RWSTD_NO_BAD_CAST_COPY_CTOR
 
-#ifdef _RWSTD_NO_BAD_CAST_DTOR
+#  ifdef _RWSTD_NO_BAD_CAST_DTOR
 
 bad_cast::~bad_cast () _THROWS (())
 {
     // empty
 }
 
-#endif   // _RWSTD_NO_BAD_CAST_DTOR
+#  endif   // _RWSTD_NO_BAD_CAST_DTOR
 
-#ifdef _RWSTD_NO_BAD_CAST_ASSIGNMENT
+#  ifdef _RWSTD_NO_BAD_CAST_ASSIGNMENT
 
 bad_cast&
 bad_cast::operator= (const bad_cast &rhs) _THROWS (())
@@ -304,31 +328,43 @@
     return *this;
 }
 
-#endif   // _RWSTD_NO_BAD_CAST_ASSIGNMENT
+#  endif   // _RWSTD_NO_BAD_CAST_ASSIGNMENT
 
-#ifdef _RWSTD_NO_BAD_CAST_WHAT
+#  ifdef _RWSTD_NO_BAD_CAST_WHAT
 
 const char* bad_cast::what () const _THROWS (())
 {
     return "bad_cast";
 }
 
-#endif   // _RWSTD_NO_BAD_CAST_WHAT
+#  endif   // _RWSTD_NO_BAD_CAST_WHAT
+
+#  ifndef _RWSTD_NO_STD_BAD_CAST
+
+}   // namespace std
+
+#  endif   // _RWSTD_NO_STD_BAD_CAST
 
 
 //**************************************************************************
 // class bad_typeid members
 
-#ifdef _RWSTD_NO_BAD_TYPEID_DEFAULT_CTOR
+#  ifndef _RWSTD_NO_STD_BAD_CAST
+
+_RWSTD_NAMESPACE (std) {
+
+#  endif   // _RWSTD_NO_STD_BAD_CAST
+
+#  ifdef _RWSTD_NO_BAD_TYPEID_DEFAULT_CTOR
 
 bad_typeid::bad_typeid () _THROWS (())
 {
     // empty
 }
 
-#endif   // _RWSTD_NO_BAD_TYPEID_DEFAULT_CTOR
+#  endif   // _RWSTD_NO_BAD_TYPEID_DEFAULT_CTOR
 
-#ifdef _RWSTD_NO_BAD_TYPEID_COPY_CTOR
+#  ifdef _RWSTD_NO_BAD_TYPEID_COPY_CTOR
 
 bad_typeid::bad_typeid (const bad_typeid &rhs) _THROWS (())
     : exception (rhs)
@@ -336,18 +372,18 @@
     // empty
 }
 
-#endif   // _RWSTD_NO_BAD_TYPEID_COPY_CTOR
+#  endif   // _RWSTD_NO_BAD_TYPEID_COPY_CTOR
 
-#ifdef _RWSTD_NO_BAD_TYPEID_DTOR
+#  ifdef _RWSTD_NO_BAD_TYPEID_DTOR
 
 bad_typeid::~bad_typeid () _THROWS (())
 {
     // empty
 }
 
-#endif   // _RWSTD_NO_BAD_TYPEID_DTOR
+#  endif   // _RWSTD_NO_BAD_TYPEID_DTOR
 
-#ifdef _RWSTD_NO_BAD_TYPEID_ASSIGNMENT
+#  ifdef _RWSTD_NO_BAD_TYPEID_ASSIGNMENT
 
 bad_typeid&
 bad_typeid::operator= (const bad_typeid &rhs) _THROWS (())
@@ -357,23 +393,21 @@
     return *this;
 }
 
-#endif   // _RWSTD_NO_BAD_TYPEID_ASSIGNMENT
+#  endif   // _RWSTD_NO_BAD_TYPEID_ASSIGNMENT
 
-#ifdef _RWSTD_NO_BAD_TYPEID_WHAT
+#  ifdef _RWSTD_NO_BAD_TYPEID_WHAT
 
 const char* bad_typeid::what () const _THROWS (())
 {
     return "bad_typeid";
 }
 
-#endif   // _RWSTD_NO_BAD_TYPEID_WHAT
+#  endif   // _RWSTD_NO_BAD_TYPEID_WHAT
 
-
-#  if    !defined (_RWSTD_NO_STD_BAD_TYPEID)   \
-      || !defined (_RWSTD_NO_RUNTIME_IN_STD)   \
-      ||  2 == __GNUG__ && !defined (_RWSTD_NO_HONOR_STD)
+#  ifndef _RWSTD_NO_STD_BAD_CAST
 
 }   // namespace std
 
-#  endif   // !NO_BAD_TYPEID || !RUNTIME_IN_STD ...
+#  endif   // _RWSTD_NO_STD_BAD_CAST
+
 #endif   // _RWSTD_TYPEINFO_INCLUDED