aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/libsupc++/typeinfo
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/libsupc++/typeinfo')
-rw-r--r--libstdc++-v3/libsupc++/typeinfo57
1 files changed, 25 insertions, 32 deletions
diff --git a/libstdc++-v3/libsupc++/typeinfo b/libstdc++-v3/libsupc++/typeinfo
index 949c6d81e2f..6cabf7508eb 100644
--- a/libstdc++-v3/libsupc++/typeinfo
+++ b/libstdc++-v3/libsupc++/typeinfo
@@ -1,6 +1,6 @@
// RTTI support for -*- C++ -*-
-// Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000 Free Software Foundation
-
+// Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001 Free Software Foundation
+//
// This file is part of GNU CC.
//
// GNU CC is free software; you can redistribute it and/or modify
@@ -27,53 +27,46 @@
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
-// __GXX_ABI_VERSION distinguishes the ABI that is being used. Values <100
-// indicate the `old' abi, which grew as C++ was defined. Values >=100
-// indicate the `new' abi, which is a cross vendor C++ abi, documented at
-// `http://reality.sgi.com/dehnert_engr/cxx/'.
+/** @file typeinfo
+ * This header provides RTTI support.
+ */
#ifndef __TYPEINFO__
#define __TYPEINFO__
-#pragma interface "typeinfo"
-
#include <exception>
extern "C++" {
-#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
namespace __cxxabiv1
{
class __class_type_info;
} // namespace __cxxabiv1
-#endif
-
-#if !defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100
- // In the old ABI, typeinfo name strings were not merged.
- #define __GXX_MERGED_TYPEINFO_NAMES 0
-#elif !__GXX_WEAK__
- // If weak symbols are not supported, they are still not merged.
+#if !__GXX_WEAK__
+ // If weak symbols are not supported, typeinfo names are not merged.
#define __GXX_MERGED_TYPEINFO_NAMES 0
#else
- // In the new ABI, on platforms that support weak symbols, they are
- // merged.
+ // On platforms that support weak symbols, typeinfo names are merged.
#define __GXX_MERGED_TYPEINFO_NAMES 1
#endif
namespace std
{
+ /** The @c type_info class describes type information generated by
+ * an implementation.
+ * @brief Used in RTTI. */
class type_info
{
public:
- // Destructor. Being the first non-inline virtual function, this
- // controls in which translation unit the vtable is emitted. The
- // compiler makes use of that information to know where to emit
- // the runtime-mandated type_info structures in the new-abi.
+ /** Destructor. Being the first non-inline virtual function, this
+ * controls in which translation unit the vtable is emitted. The
+ * compiler makes use of that information to know where to emit
+ * the runtime-mandated type_info structures in the new-abi. */
virtual ~type_info();
private:
- // Assigning type_info is not supported. made private.
+ /// Assigning type_info is not supported. Made private.
type_info& operator=(const type_info&);
type_info(const type_info&);
@@ -85,13 +78,10 @@ namespace std
public:
// the public interface
-#if !defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100
+ /** Returns an \e implementation-defined byte string; this is not
+ * portable between compilers! */
const char* name() const
{ return __name; }
-#else
- const char* name() const
- { return __name; }
-#endif
#if !__GXX_MERGED_TYPEINFO_NAMES
bool before(const type_info& arg) const;
@@ -100,6 +90,8 @@ namespace std
// type. Uniqueness must use the _name value, not object address.
bool operator==(const type_info& __arg) const;
#else
+ /** Returns true if @c *this preceeds @c __arg in the implementation's
+ * collation order. */
// In new abi we can rely on type_info's NTBS being unique,
// and therefore address comparisons are sufficient.
bool before(const type_info& __arg) const
@@ -111,7 +103,6 @@ namespace std
{ return !operator==(__arg); }
// the internal interface
-#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
public:
// return true if this is a pointer type of some kind
virtual bool __is_pointer_p() const;
@@ -130,21 +121,23 @@ namespace std
// internally used during catch matching
virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target,
void **__obj_ptr) const;
-#endif
};
+ /** If you attempt an invalid @c dynamic_cast expression, an instance of
+ * this class (or something derived from this class) is thrown. */
class bad_cast : public exception
{
public:
bad_cast() throw() { }
- virtual ~bad_cast() throw() { }
+ virtual ~bad_cast() throw();
};
+ /** If you use a NULL pointer in a @c typeid expression, this is thrown. */
class bad_typeid : public exception
{
public:
bad_typeid () throw() { }
- virtual ~bad_typeid () throw() { }
+ virtual ~bad_typeid () throw();
};
} // namespace std