(C++) patch to type_info::operator==
Jason Merrill
jason@cygnus.com
Mon Oct 12 02:26:00 GMT 1998
Applied. It seems wise to hide this implementation detail in libgcc
instead of making it part of the interface.
Mon Oct 12 02:03:25 1998 Jason Merrill <jason@yorick.cygnus.com>
* i386/t-cygwin32 (TARGET_LIBGCC2_CFLAGS): Define.
1998-10-12 Jason Merrill <jason@yorick.cygnus.com>
* inc/typeinfo: Add #pragma interface.
(operator!=): Just call operator==.
* tinfo.cc: Add #pragma implementation.
(operator==): Move from inc/typeinfo and tinfo2.cc.
Check __COMMON_UNRELIABLE instead of _WIN32.
Index: cp/tinfo.cc
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/tinfo.cc,v
retrieving revision 1.3
diff -c -p -r1.3 tinfo.cc
*** cp/tinfo.cc 1998/05/13 10:00:45 1.3
--- cp/tinfo.cc 1998/10/12 09:11:16
***************
*** 25,30 ****
--- 25,32 ----
// 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 <stddef.h>
#include "tinfo.h"
#include "new" // for placement new
***************
*** 36,41 ****
--- 38,60 ----
std::type_info::
~type_info ()
{ }
+
+ #ifndef __COMMON_UNRELIABLE
+ bool type_info::
+ operator== (const type_info& arg) const
+ {
+ return &arg == this;
+ }
+ #else
+ // We can't rely on common symbols being shared between translation units
+ // under Windows. Sigh.
+
+ bool type_info::
+ operator== (const type_info& arg) const
+ {
+ return fast_compare (name (), arg.name ()) == 0;
+ }
+ #endif
extern "C" void
__rtti_class (void *addr, const char *name,
Index: cp/tinfo2.cc
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/tinfo2.cc,v
retrieving revision 1.5
diff -c -p -r1.5 tinfo2.cc
*** cp/tinfo2.cc 1998/05/08 02:06:19 1.5
--- cp/tinfo2.cc 1998/10/12 09:11:16
*************** type_info::before (const type_info &arg)
*** 49,68 ****
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;
- }
-
- 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 {
--- 49,54 ----
Index: cp/inc/typeinfo
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/inc/typeinfo,v
retrieving revision 1.4
diff -c -p -r1.4 typeinfo
*** cp/inc/typeinfo 1998/09/04 16:35:12 1.4
--- cp/inc/typeinfo 1998/10/12 09:11:16
***************
*** 4,9 ****
--- 4,11 ----
#ifndef __TYPEINFO__
#define __TYPEINFO__
+ #pragma interface "typeinfo"
+
#include <exception>
extern "C++" {
*************** public:
*** 32,53 ****
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;
}
- #endif
class bad_cast : public exception {
public:
--- 34,44 ----
bool operator!= (const type_info& arg) const;
};
inline bool type_info::
operator!= (const type_info& arg) const
{
! return !operator== (arg);
}
class bad_cast : public exception {
public:
Index: config/i386/t-cygwin32
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/i386/t-cygwin32,v
retrieving revision 1.2
diff -c -p -r1.2 t-cygwin32
*** config/i386/t-cygwin32 1998/01/28 19:04:40 1.2
--- config/i386/t-cygwin32 1998/10/12 09:11:16
*************** CROSS_LIBGCC1 = libgcc1-asm.a
*** 3,8 ****
--- 3,12 ----
LIB1ASMSRC = i386/cygwin32.asm
LIB1ASMFUNCS = _chkstk
+ # We can't rely on common symbols being shared between translation units
+ # under Windows.
+ TARGET_LIBGCC2_CFLAGS = -D__COMMON_UNRELIABLE
+
# cygwin32 always has a limits.h, but, depending upon how we are doing
# the build, it may not be installed yet.
LIMITS_H_TEST = true
More information about the Gcc-patches
mailing list