From: Jason Merrill Date: Sun, 25 Oct 1998 16:52:48 +0000 (+0000) Subject: tinfo2.cc (fast_compare): Remove. X-Git-Tag: prereleases/egcs-1.1.1-pre~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bdb43221de4adc7f484aa168554c11ff003cacf7;p=thirdparty%2Fgcc.git tinfo2.cc (fast_compare): Remove. * tinfo2.cc (fast_compare): Remove. (before): Just use strcmp. * tinfo.cc (operator==): Just use strcmp. * inc/typeinfo: Add #pragma interface. (operator!=): Just call operator==. * tinfo.cc: Add #pragma implementation. (operator==): Move from inc/typeinfo and tinfo2.cc. From-SVN: r23320 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3cc2f8b81186..bb915a73168c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -7,6 +7,23 @@ * spew.c (yylex): Clear looking_for_typename if we got 'enum { ... };'. +1998-10-13 Jason Merrill + + * tinfo2.cc (fast_compare): Remove. + (before): Just use strcmp. + * tinfo.cc (operator==): Just use strcmp. + +1998-10-12 Jason Merrill + + * tinfo.cc (operator==): Always compare names. + +1998-10-12 Jason Merrill + + * inc/typeinfo: Add #pragma interface. + (operator!=): Just call operator==. + * tinfo.cc: Add #pragma implementation. + (operator==): Move from inc/typeinfo and tinfo2.cc. + Fri Oct 2 02:07:26 1998 Mumit Khan * parse.y (nomods_initdcl0): Set up the parser stack correctly. diff --git a/gcc/cp/inc/typeinfo b/gcc/cp/inc/typeinfo index 64b2a819a1e2..e46acb95df39 100644 --- a/gcc/cp/inc/typeinfo +++ b/gcc/cp/inc/typeinfo @@ -4,6 +4,8 @@ #ifndef __TYPEINFO__ #define __TYPEINFO__ +#pragma interface "typeinfo" + #include extern "C++" { @@ -34,22 +36,11 @@ public: bool operator!= (const type_info& arg) const; }; -// We can't rely on common symbols being shared between translation units -// under Windows. Sigh. - -#ifndef _WIN32 -inline bool type_info:: -operator== (const type_info& arg) const -{ - return &arg == this; -} - inline bool type_info:: operator!= (const type_info& arg) const { - return &arg != this; + return !operator== (arg); } -#endif class bad_cast : public exception { public: diff --git a/gcc/cp/tinfo.cc b/gcc/cp/tinfo.cc index 4b68fd1b3fb2..d8380da29a4c 100644 --- a/gcc/cp/tinfo.cc +++ b/gcc/cp/tinfo.cc @@ -25,6 +25,8 @@ // This exception does not however invalidate any other reasons why // the executable file might be covered by the GNU General Public License. +#pragma implementation "typeinfo" + #include #include "tinfo.h" #include "new" // for placement new @@ -37,6 +39,13 @@ std::type_info:: ~type_info () { } +// We can't rely on common symbols being shared between shared objects. +bool type_info:: +operator== (const type_info& arg) const +{ + return (&arg == this) || (strcmp (name (), arg.name ()) == 0); +} + extern "C" void __rtti_class (void *addr, const char *name, const __class_type_info::base_info *bl, size_t bn) diff --git a/gcc/cp/tinfo2.cc b/gcc/cp/tinfo2.cc index b797cc3e1dbb..3e63354a2c5e 100644 --- a/gcc/cp/tinfo2.cc +++ b/gcc/cp/tinfo2.cc @@ -30,39 +30,13 @@ #include "new" // for placement new using std::type_info; -// service function for comparing types by name. - -static inline int -fast_compare (const char *n1, const char *n2) { - int c; - if (n1 == n2) return 0; - if (n1 == 0) return *n2; - else if (n2 == 0) return *n1; - - c = (int)*n1++ - (int)*n2++; - return c == 0 ? strcmp (n1, n2) : c; -}; bool type_info::before (const type_info &arg) const { - return fast_compare (name (), arg.name ()) < 0; -} - -#ifdef _WIN32 -bool type_info:: -operator== (const type_info& arg) const -{ - return fast_compare (name (), arg.name ()) == 0; + return strcmp (name (), arg.name ()) < 0; } -bool type_info:: -operator!= (const type_info& arg) const -{ - return fast_compare (name (), arg.name ()) != 0; -} -#endif - // type info for pointer type. struct __pointer_type_info : public type_info {