Return-Path: Delivered-To: apmail-incubator-stdcxx-commits-archive@www.apache.org Received: (qmail 73168 invoked from network); 2 Dec 2005 23:32:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Dec 2005 23:32:13 -0000 Received: (qmail 81891 invoked by uid 500); 2 Dec 2005 23:30:51 -0000 Delivered-To: apmail-incubator-stdcxx-commits-archive@incubator.apache.org Received: (qmail 74749 invoked by uid 500); 2 Dec 2005 23:30:12 -0000 Mailing-List: contact stdcxx-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-commits@incubator.apache.org Received: (qmail 58374 invoked by uid 500); 2 Dec 2005 23:28:17 -0000 Delivered-To: apmail-incubator-stdcxx-cvs@incubator.apache.org Received: (qmail 50836 invoked by uid 99); 2 Dec 2005 23:26:38 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Dec 2005 15:26:38 -0800 Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 02 Dec 2005 14:42:34 -0800 Received: (qmail 74672 invoked by uid 65534); 2 Dec 2005 20:28:59 -0000 Message-ID: <20051202202859.74661.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r351833 - in /incubator/stdcxx/trunk: include/typeinfo src/typeinfo.cpp Date: Fri, 02 Dec 2005 20:28:57 -0000 To: stdcxx-cvs@incubator.apache.org From: sebor@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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 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 -#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