// Methods for type_info for -*- C++ -*- Run Time Type Identification.
-// Copyright (C) 1994, 1996 Free Software Foundation
+// Copyright (C) 1994, 96-97, 1998 Free Software Foundation
// This file is part of GNU CC.
#include "tinfo.h"
#include "new" // for placement new
-// 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;
-};
+using std::type_info;
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 {
variables and thrown objects. */
extern "C" void*
-__throw_type_match_rtti (void *catch_type_r, void *throw_type_r, void *objptr)
+__throw_type_match_rtti (const void *catch_type_r, const void *throw_type_r,
+ void *objptr)
{
const type_info &catch_type = *(const type_info *)catch_type_r;
const type_info &throw_type = *(const type_info *)throw_type_r;
BUILTIN (v); BUILTIN (x); BUILTIN (l); BUILTIN (i); BUILTIN (s); BUILTIN (b);
BUILTIN (c); BUILTIN (w); BUILTIN (r); BUILTIN (d); BUILTIN (f);
BUILTIN (Ui); BUILTIN (Ul); BUILTIN (Ux); BUILTIN (Us); BUILTIN (Uc);
+BUILTIN (Sc);