2000-10-11 01:43:26 +02:00
|
|
|
// RTTI support for -*- C++ -*-
|
2002-01-09 21:39:27 +01:00
|
|
|
// Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002
|
|
|
|
// Free Software Foundation
|
2001-02-16 01:44:44 +01:00
|
|
|
//
|
Makefile.am, [...]: Replace "GNU CC" with "GCC".
2003-05-24 Nathanael Nerode <neroden@gcc.gnu.org>
* libsupc++/Makefile.am, libsupc++/cxxabi.h, libsupc++/del_op.cc,
libsupc++/del_opnt.cc, libsupc++/del_opv.cc, libsupc++/del_opvnt.cc,
libsupc++/eh_alloc.cc, libsupc++/eh_aux_runtime.cc,
libsupc++/eh_catch.cc, libsupc++/eh_exception.cc,
libsupc++/eh_globals.cc, libsupc++/eh_personality.cc,
libsupc++/eh_term_handler.cc, libsupc++/eh_terminate.cc,
libsupc++/eh_throw.cc, libsupc++/eh_type.cc,
libsupc++/eh_unex_handler.cc, libsupc++/exception,
libsupc++/new, libsupc++/new_handler.cc, libsupc++/new_op.cc,
libsupc++/new_opnt.cc, libsupc++/new_opv.cc, libsupc++/new_opvnt.cc,
libsupc++/pure.cc, libsupc++/tinfo.cc, libsupc++/tinfo2.cc,
libsupc++/typeinfo, libsupc++/unwind-cxx.h, libsupc++/vec.cc:
Replace "GNU CC" with "GCC".
From-SVN: r67155
2003-05-24 18:22:03 +02:00
|
|
|
// This file is part of GCC.
|
2000-10-11 01:43:26 +02:00
|
|
|
//
|
Makefile.am, [...]: Replace "GNU CC" with "GCC".
2003-05-24 Nathanael Nerode <neroden@gcc.gnu.org>
* libsupc++/Makefile.am, libsupc++/cxxabi.h, libsupc++/del_op.cc,
libsupc++/del_opnt.cc, libsupc++/del_opv.cc, libsupc++/del_opvnt.cc,
libsupc++/eh_alloc.cc, libsupc++/eh_aux_runtime.cc,
libsupc++/eh_catch.cc, libsupc++/eh_exception.cc,
libsupc++/eh_globals.cc, libsupc++/eh_personality.cc,
libsupc++/eh_term_handler.cc, libsupc++/eh_terminate.cc,
libsupc++/eh_throw.cc, libsupc++/eh_type.cc,
libsupc++/eh_unex_handler.cc, libsupc++/exception,
libsupc++/new, libsupc++/new_handler.cc, libsupc++/new_op.cc,
libsupc++/new_opnt.cc, libsupc++/new_opv.cc, libsupc++/new_opvnt.cc,
libsupc++/pure.cc, libsupc++/tinfo.cc, libsupc++/tinfo2.cc,
libsupc++/typeinfo, libsupc++/unwind-cxx.h, libsupc++/vec.cc:
Replace "GNU CC" with "GCC".
From-SVN: r67155
2003-05-24 18:22:03 +02:00
|
|
|
// GCC is free software; you can redistribute it and/or modify
|
2000-10-11 01:43:26 +02:00
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
// any later version.
|
|
|
|
//
|
Makefile.am, [...]: Replace "GNU CC" with "GCC".
2003-05-24 Nathanael Nerode <neroden@gcc.gnu.org>
* libsupc++/Makefile.am, libsupc++/cxxabi.h, libsupc++/del_op.cc,
libsupc++/del_opnt.cc, libsupc++/del_opv.cc, libsupc++/del_opvnt.cc,
libsupc++/eh_alloc.cc, libsupc++/eh_aux_runtime.cc,
libsupc++/eh_catch.cc, libsupc++/eh_exception.cc,
libsupc++/eh_globals.cc, libsupc++/eh_personality.cc,
libsupc++/eh_term_handler.cc, libsupc++/eh_terminate.cc,
libsupc++/eh_throw.cc, libsupc++/eh_type.cc,
libsupc++/eh_unex_handler.cc, libsupc++/exception,
libsupc++/new, libsupc++/new_handler.cc, libsupc++/new_op.cc,
libsupc++/new_opnt.cc, libsupc++/new_opv.cc, libsupc++/new_opvnt.cc,
libsupc++/pure.cc, libsupc++/tinfo.cc, libsupc++/tinfo2.cc,
libsupc++/typeinfo, libsupc++/unwind-cxx.h, libsupc++/vec.cc:
Replace "GNU CC" with "GCC".
From-SVN: r67155
2003-05-24 18:22:03 +02:00
|
|
|
// GCC is distributed in the hope that it will be useful,
|
2000-10-11 01:43:26 +02:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
Makefile.am, [...]: Replace "GNU CC" with "GCC".
2003-05-24 Nathanael Nerode <neroden@gcc.gnu.org>
* libsupc++/Makefile.am, libsupc++/cxxabi.h, libsupc++/del_op.cc,
libsupc++/del_opnt.cc, libsupc++/del_opv.cc, libsupc++/del_opvnt.cc,
libsupc++/eh_alloc.cc, libsupc++/eh_aux_runtime.cc,
libsupc++/eh_catch.cc, libsupc++/eh_exception.cc,
libsupc++/eh_globals.cc, libsupc++/eh_personality.cc,
libsupc++/eh_term_handler.cc, libsupc++/eh_terminate.cc,
libsupc++/eh_throw.cc, libsupc++/eh_type.cc,
libsupc++/eh_unex_handler.cc, libsupc++/exception,
libsupc++/new, libsupc++/new_handler.cc, libsupc++/new_op.cc,
libsupc++/new_opnt.cc, libsupc++/new_opv.cc, libsupc++/new_opvnt.cc,
libsupc++/pure.cc, libsupc++/tinfo.cc, libsupc++/tinfo2.cc,
libsupc++/typeinfo, libsupc++/unwind-cxx.h, libsupc++/vec.cc:
Replace "GNU CC" with "GCC".
From-SVN: r67155
2003-05-24 18:22:03 +02:00
|
|
|
// along with GCC; see the file COPYING. If not, write to
|
2000-10-11 01:43:26 +02:00
|
|
|
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
// Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
// As a special exception, you may use this file as part of a free software
|
|
|
|
// library without restriction. Specifically, if other files instantiate
|
|
|
|
// templates or use macros or inline functions from this file, or you compile
|
|
|
|
// this file and link it with other files to produce an executable, this
|
|
|
|
// file does not by itself cause the resulting executable to be covered by
|
|
|
|
// the GNU General Public License. This exception does not however
|
|
|
|
// invalidate any other reasons why the executable file might be covered by
|
|
|
|
// the GNU General Public License.
|
|
|
|
|
2001-07-11 21:35:49 +02:00
|
|
|
/** @file typeinfo
|
|
|
|
* This header provides RTTI support.
|
|
|
|
*/
|
|
|
|
|
2003-07-05 06:05:45 +02:00
|
|
|
#ifndef _TYPEINFO
|
|
|
|
#define _TYPEINFO
|
2000-10-11 01:43:26 +02:00
|
|
|
|
|
|
|
#include <exception>
|
|
|
|
|
2004-08-03 08:45:54 +02:00
|
|
|
#pragma GCC visibility push(default)
|
|
|
|
|
2000-10-11 01:43:26 +02:00
|
|
|
extern "C++" {
|
|
|
|
|
|
|
|
namespace __cxxabiv1
|
|
|
|
{
|
|
|
|
class __class_type_info;
|
|
|
|
} // namespace __cxxabiv1
|
|
|
|
|
2004-09-03 02:43:59 +02:00
|
|
|
#ifndef __GXX_MERGED_TYPEINFO_NAMES
|
|
|
|
#if !__GXX_WEAK__
|
|
|
|
// If weak symbols are not supported, typeinfo names are not merged.
|
|
|
|
#define __GXX_MERGED_TYPEINFO_NAMES 0
|
|
|
|
#else
|
|
|
|
// On platforms that support weak symbols, typeinfo names are merged.
|
|
|
|
#define __GXX_MERGED_TYPEINFO_NAMES 1
|
|
|
|
#endif
|
2001-02-04 09:37:50 +01:00
|
|
|
#endif
|
|
|
|
|
2001-01-17 08:44:57 +01:00
|
|
|
namespace std
|
|
|
|
{
|
abi.txt: New file.
2002-07-20 Phil Edwards <pme@gcc.gnu.org>
* docs/html/abi.txt: New file.
* docs/html/23_containers/howto.html: Tweak vector-overhead text.
* docs/html/ext/lwg-active.html, docs/html/ext/lwg-defects.html:
Import from upstream, R22.
* include/bits/char_traits.h, include/bits/stl_iterator.h,
include/bits/stl_iterator_base_types.h, libsupc++/exception,
libsupc++/new, libsupc++/typeinfo: Use @brief markup.
* include/bits/deque.tcc, include/bits/stl_alloc.h,
include/bits/stl_deque.h, include/bits/stl_list.h: Postpone removal
of deprecated functions until 3.4. (Same timeframe, different text.)
* include/bits/stl_vector.h: Ditto. Also do the same cleanups that
the other sequence classes received.
From-SVN: r55602
2002-07-20 08:26:27 +02:00
|
|
|
/**
|
|
|
|
* @brief Part of RTTI.
|
|
|
|
*
|
|
|
|
* The @c type_info class describes type information generated by
|
2001-07-11 21:35:49 +02:00
|
|
|
* an implementation.
|
abi.txt: New file.
2002-07-20 Phil Edwards <pme@gcc.gnu.org>
* docs/html/abi.txt: New file.
* docs/html/23_containers/howto.html: Tweak vector-overhead text.
* docs/html/ext/lwg-active.html, docs/html/ext/lwg-defects.html:
Import from upstream, R22.
* include/bits/char_traits.h, include/bits/stl_iterator.h,
include/bits/stl_iterator_base_types.h, libsupc++/exception,
libsupc++/new, libsupc++/typeinfo: Use @brief markup.
* include/bits/deque.tcc, include/bits/stl_alloc.h,
include/bits/stl_deque.h, include/bits/stl_list.h: Postpone removal
of deprecated functions until 3.4. (Same timeframe, different text.)
* include/bits/stl_vector.h: Ditto. Also do the same cleanups that
the other sequence classes received.
From-SVN: r55602
2002-07-20 08:26:27 +02:00
|
|
|
*/
|
2001-01-17 08:44:57 +01:00
|
|
|
class type_info
|
|
|
|
{
|
|
|
|
public:
|
2001-07-11 21:35:49 +02:00
|
|
|
/** 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. */
|
2001-01-17 08:44:57 +01:00
|
|
|
virtual ~type_info();
|
|
|
|
|
|
|
|
private:
|
2001-07-11 21:35:49 +02:00
|
|
|
/// Assigning type_info is not supported. Made private.
|
2001-01-17 08:44:57 +01:00
|
|
|
type_info& operator=(const type_info&);
|
|
|
|
type_info(const type_info&);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
const char *__name;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
explicit type_info(const char *__n): __name(__n) { }
|
|
|
|
|
|
|
|
public:
|
|
|
|
// the public interface
|
2001-09-26 01:51:17 +02:00
|
|
|
/** Returns an @e implementation-defined byte string; this is not
|
2001-07-11 21:35:49 +02:00
|
|
|
* portable between compilers! */
|
2001-01-17 08:44:57 +01:00
|
|
|
const char* name() const
|
2000-10-11 01:43:26 +02:00
|
|
|
{ return __name; }
|
|
|
|
|
2001-02-04 09:37:50 +01:00
|
|
|
#if !__GXX_MERGED_TYPEINFO_NAMES
|
2002-04-16 02:45:36 +02:00
|
|
|
bool before(const type_info& __arg) const;
|
2001-02-04 09:37:50 +01:00
|
|
|
// In old abi, or when weak symbols are not supported, there can
|
|
|
|
// be multiple instances of a type_info object for one
|
|
|
|
// type. Uniqueness must use the _name value, not object address.
|
|
|
|
bool operator==(const type_info& __arg) const;
|
2000-10-11 01:43:26 +02:00
|
|
|
#else
|
ChangeLog, [...]: Fix spelling errors.
* ChangeLog, docs/doxygen/maint.cfg.in, docs/doxygen/user.cfg.in,
docs/doxygen/doxygroups.cc, docs/doxygen/Intro.3,
docs/html/17_intro/BUGS, docs/html/17_intro/C++STYLE,
docs/html/17_intro/CHECKLIST, docs/html/17_intro/DESIGN,
docs/html/17_intro/howto.html, docs/html/17_intro/porting.html,
docs/html/17_intro/porting.texi, docs/html/18_support/howto.html,
docs/html/19_diagnostics/howto.html, docs/html/20_util/howto.html,
docs/html/21_strings/howto.html,
docs/html/23_containers/howto.html,
docs/html/26_numerics/howto.html, docs/html/27_io/howto.html,
docs/html/27_io/binary_iostreams_kuehl.txt,
docs/html/ext/sgiexts.html, docs/html/faq/index.html,
docs/html/faq/index.txt, testsuite/24_iterators/iterator.cc,
include/bits/basic_file.h, include/bits/locale_facets.h,
include/bits/locale_facets.tcc, include/bits/std_sstream.h,
include/ext/ropeimpl.h, include/ext/stl_rope.h,
libsupc++/tinfo.cc, libsupc++/cxxabi.h, libsupc++/typeinfo,
libsupc++/eh_throw.cc, acinclude.m4, aclocal.m4, configure,
configure.target, ChangeLog-2000: Fix spelling errors.
From-SVN: r47291
2001-11-23 17:29:02 +01:00
|
|
|
/** Returns true if @c *this precedes @c __arg in the implementation's
|
2001-07-11 21:35:49 +02:00
|
|
|
* collation order. */
|
2001-01-17 08:44:57 +01:00
|
|
|
// 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
|
2000-10-11 01:43:26 +02:00
|
|
|
{ return __name < __arg.__name; }
|
2001-01-17 08:44:57 +01:00
|
|
|
bool operator==(const type_info& __arg) const
|
2000-10-11 01:43:26 +02:00
|
|
|
{ return __name == __arg.__name; }
|
2001-02-04 09:37:50 +01:00
|
|
|
#endif
|
2001-01-17 08:44:57 +01:00
|
|
|
bool operator!=(const type_info& __arg) const
|
|
|
|
{ return !operator==(__arg); }
|
|
|
|
|
|
|
|
// the internal interface
|
|
|
|
public:
|
|
|
|
// return true if this is a pointer type of some kind
|
|
|
|
virtual bool __is_pointer_p() const;
|
|
|
|
// return true if this is a function type
|
|
|
|
virtual bool __is_function_p() const;
|
|
|
|
|
|
|
|
// Try and catch a thrown type. Store an adjusted pointer to the
|
|
|
|
// caught type in THR_OBJ. If THR_TYPE is not a pointer type, then
|
|
|
|
// THR_OBJ points to the thrown object. If THR_TYPE is a pointer
|
|
|
|
// type, then THR_OBJ is the pointer itself. OUTER indicates the
|
|
|
|
// number of outer pointers, and whether they were const
|
|
|
|
// qualified.
|
|
|
|
virtual bool __do_catch(const type_info *__thr_type, void **__thr_obj,
|
|
|
|
unsigned __outer) const;
|
|
|
|
|
|
|
|
// internally used during catch matching
|
|
|
|
virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target,
|
|
|
|
void **__obj_ptr) const;
|
|
|
|
};
|
|
|
|
|
abi.txt: New file.
2002-07-20 Phil Edwards <pme@gcc.gnu.org>
* docs/html/abi.txt: New file.
* docs/html/23_containers/howto.html: Tweak vector-overhead text.
* docs/html/ext/lwg-active.html, docs/html/ext/lwg-defects.html:
Import from upstream, R22.
* include/bits/char_traits.h, include/bits/stl_iterator.h,
include/bits/stl_iterator_base_types.h, libsupc++/exception,
libsupc++/new, libsupc++/typeinfo: Use @brief markup.
* include/bits/deque.tcc, include/bits/stl_alloc.h,
include/bits/stl_deque.h, include/bits/stl_list.h: Postpone removal
of deprecated functions until 3.4. (Same timeframe, different text.)
* include/bits/stl_vector.h: Ditto. Also do the same cleanups that
the other sequence classes received.
From-SVN: r55602
2002-07-20 08:26:27 +02:00
|
|
|
/**
|
|
|
|
* @brief Thrown during incorrect typecasting.
|
|
|
|
*
|
|
|
|
* If you attempt an invalid @c dynamic_cast expression, an instance of
|
2001-07-11 21:35:49 +02:00
|
|
|
* this class (or something derived from this class) is thrown. */
|
2001-01-17 08:44:57 +01:00
|
|
|
class bad_cast : public exception
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bad_cast() throw() { }
|
2002-01-10 00:31:57 +01:00
|
|
|
// This declaration is not useless:
|
|
|
|
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
|
2002-01-09 21:39:27 +01:00
|
|
|
virtual ~bad_cast() throw();
|
2001-01-17 08:44:57 +01:00
|
|
|
};
|
|
|
|
|
2001-07-11 21:35:49 +02:00
|
|
|
/** If you use a NULL pointer in a @c typeid expression, this is thrown. */
|
2001-01-17 08:44:57 +01:00
|
|
|
class bad_typeid : public exception
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bad_typeid () throw() { }
|
2002-01-10 00:31:57 +01:00
|
|
|
// This declaration is not useless:
|
|
|
|
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
|
2002-01-09 21:39:27 +01:00
|
|
|
virtual ~bad_typeid() throw();
|
2001-01-17 08:44:57 +01:00
|
|
|
};
|
2000-10-11 01:43:26 +02:00
|
|
|
} // namespace std
|
|
|
|
|
2004-08-03 08:45:54 +02:00
|
|
|
#pragma GCC visibility pop
|
|
|
|
|
2000-10-11 01:43:26 +02:00
|
|
|
} // extern "C++"
|
|
|
|
#endif
|