Commit 8dc54971 by Richard Henderson Committed by Richard Henderson

Make-lang.in (CXX_EXTRA_HEADERS): Remove.

        * Make-lang.in (CXX_EXTRA_HEADERS): Remove.
        (c++ language support bits for libgcc): Remove.
        (c++.clean): Remove cplib2.txt cleanup.
        * config-lang.in (headers, lib2funcs): Remove.

        * exception.cc, new.cc, new1.cc, new2.cc: Remove files.
        * tinfo.cc, tinfo.h, tinfo2.cc, vec.cc: Remove files.
        * inc/cxxabi.h, inc/exception, inc/new: Remove files.
        * inc/new.h, inc/typeinfo: Remove files.

From-SVN: r36816
parent 3734420f
2000-10-09 Richard Henderson <rth@cygnus.com>
* Make-lang.in (CXX_EXTRA_HEADERS): Remove.
(c++ language support bits for libgcc): Remove.
(c++.clean): Remove cplib2.txt cleanup.
* config-lang.in (headers, lib2funcs): Remove.
* exception.cc, new.cc, new1.cc, new2.cc: Remove files.
* tinfo.cc, tinfo.h, tinfo2.cc, vec.cc: Remove files.
* inc/cxxabi.h, inc/exception, inc/new: Remove files.
* inc/new.h, inc/typeinfo: Remove files.
2000-10-08 Joseph S. Myers <jsm28@cam.ac.uk>
* decl.c (INTMAX_TYPE, UINTMAX_TYPE): Define if not already
......
......@@ -56,10 +56,6 @@ DEMANGLER_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++filt | sed
# The name to use for the demangler program.
DEMANGLER_PROG = c++filt$(exeext)
# Extra headers to install.
CXX_EXTRA_HEADERS = $(srcdir)/cp/inc/typeinfo $(srcdir)/cp/inc/exception \
$(srcdir)/cp/inc/new $(srcdir)/cp/inc/new.h $(srcdir)/cp/inc/cxxabi.h
# Extra code to include in libgcc2.
CXX_LIB2FUNCS = tinfo.o tinfo2.o new.o opnew.o opnewnt.o opvnew.o opvnewnt.o \
opdel.o opdelnt.o opvdel.o opvdelnt.o exception.o vec.o
......@@ -137,59 +133,6 @@ c++.rest.encap: $(DEMANGLER_PROG)
c++.info:
c++.dvi:
# C++ language-support library pieces for libgcc.
tinfo.o: cc1plus$(exeext) $(srcdir)/cp/tinfo.cc
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-c $(srcdir)/cp/tinfo.cc
tinfo2.o: cc1plus$(exeext) $(srcdir)/cp/tinfo2.cc
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-c $(srcdir)/cp/tinfo2.cc
exception.o: cc1plus$(exeext) $(srcdir)/cp/exception.cc
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-c -fexceptions $(srcdir)/cp/exception.cc
new.o: cc1plus$(exeext) $(srcdir)/cp/new.cc
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-c $(srcdir)/cp/new.cc
opnew.o: cc1plus$(exeext) $(srcdir)/cp/new1.cc
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-c $(srcdir)/cp/new1.cc -DL_op_new -o opnew.o
opnewnt.o: cc1plus$(exeext) $(srcdir)/cp/new1.cc
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-c $(srcdir)/cp/new1.cc -DL_op_newnt -o opnewnt.o
opvnew.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-c $(srcdir)/cp/new2.cc -DL_op_vnew -o opvnew.o
opvnewnt.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-c $(srcdir)/cp/new2.cc -DL_op_vnewnt -o opvnewnt.o
opdel.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-c $(srcdir)/cp/new2.cc -DL_op_delete -o opdel.o
opdelnt.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-c $(srcdir)/cp/new2.cc -DL_op_delnt -o opdelnt.o
opvdel.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-c $(srcdir)/cp/new2.cc -DL_op_vdel -o opvdel.o
opvdelnt.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-c $(srcdir)/cp/new2.cc -DL_op_vdelnt -o opvdelnt.o
vec.o: cc1plus$(exeext) $(srcdir)/cp/vec.cc
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
-c $(srcdir)/cp/vec.cc -o vec.o
# We want to update cplib2.txt if any of the source files change or if the
# Makefile (which contains the list of sources) changes.
cplib2.txt: $(CXX_LIB2SRCS) $(CXX_EXTRA_HEADERS) cp/Makefile
case " $(LANGUAGES) " in \
*" "[cC]"++ "*) \
echo $(CXX_LIB2FUNCS) > cplib2.new;; \
*) \
echo "" > cplib2.new;; \
esac
mv -f cplib2.new cplib2.txt
#
# Install hooks:
# cc1plus is installed elsewhere as part of $(COMPILERS).
......@@ -269,7 +212,6 @@ c++.uninstall:
c++.mostlyclean:
-rm -f cp/*$(objext) $(DEMANGLER_PROG)
c++.clean:
-rm -f cplib2.txt
c++.distclean:
-rm -f cp/config.status cp/Makefile
-rm -f cp/parse.output
......
......@@ -34,8 +34,4 @@ stagestuff="g++\$(exeext) g++-cross\$(exeext) cc1plus\$(exeext)"
diff_excludes="-x parse.c -x parse.h"
headers='$(CXX_EXTRA_HEADERS)'
lib2funcs=cplib2.txt
outputs=cp/Makefile
// Exception Handling support header for -*- C++ -*-
// Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation
// This file is part of GNU CC.
//
// GNU CC is free software; you can redistribute it and/or modify
// 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.
//
// GNU CC is distributed in the hope that it will be useful,
// 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
// along with GNU CC; see the file COPYING. If not, write to
// 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.
#ifndef __EXCEPTION__
#define __EXCEPTION__
#pragma interface "exception"
extern "C++" {
namespace std {
class exception {
public:
exception () { }
virtual ~exception () { }
virtual const char* what () const;
};
class bad_exception : public exception {
public:
bad_exception () { }
virtual ~bad_exception () { }
};
typedef void (*terminate_handler) ();
typedef void (*unexpected_handler) ();
terminate_handler set_terminate (terminate_handler);
void terminate () __attribute__ ((__noreturn__));
unexpected_handler set_unexpected (unexpected_handler);
void unexpected () __attribute__ ((__noreturn__));
bool uncaught_exception ();
} // namespace std
} // extern "C++"
#endif
// The -*- C++ -*- dynamic memory management header.
// Copyright (C) 1994, 1996, 1997, 1998, 2000 Free Software Foundation
// This file is part of GNU CC.
//
// GNU CC is free software; you can redistribute it and/or modify
// 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.
//
// GNU CC is distributed in the hope that it will be useful,
// 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
// along with GNU CC; see the file COPYING. If not, write to
// 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.
#ifndef __NEW__
#define __NEW__
#pragma interface "new"
#include <stddef.h>
#include <exception>
extern "C++" {
namespace std {
class bad_alloc : public exception {
public:
virtual const char* what() const throw() { return "bad_alloc"; }
};
struct nothrow_t {};
extern const nothrow_t nothrow;
typedef void (*new_handler)();
new_handler set_new_handler (new_handler);
} // namespace std
// replaceable signatures
void *operator new (size_t) throw (std::bad_alloc);
void *operator new[] (size_t) throw (std::bad_alloc);
void operator delete (void *) throw();
void operator delete[] (void *) throw();
void *operator new (size_t, const std::nothrow_t&) throw();
void *operator new[] (size_t, const std::nothrow_t&) throw();
void operator delete (void *, const std::nothrow_t&) throw();
void operator delete[] (void *, const std::nothrow_t&) throw();
// default placement versions of operator new
inline void *operator new(size_t, void *place) throw() { return place; }
inline void *operator new[](size_t, void *place) throw() { return place; }
} // extern "C++"
#endif
// -*- C++ -*- forwarding header.
// Copyright (C) 2000 Free Software Foundation
// This file is part of GNU CC.
//
// GNU CC is free software; you can redistribute it and/or modify
// 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.
//
// GNU CC is distributed in the hope that it will be useful,
// 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
// along with GNU CC; see the file COPYING. If not, write to
// 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.
#ifndef __NEW_H__
#define __NEW_H__
#include <new>
using std::new_handler;
using std::set_new_handler;
#endif // __NEW_H__
// RTTI support for -*- C++ -*-
// Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000 Free Software Foundation
// This file is part of GNU CC.
//
// GNU CC is free software; you can redistribute it and/or modify
// 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.
//
// GNU CC is distributed in the hope that it will be useful,
// 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
// along with GNU CC; see the file COPYING. If not, write to
// 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.
// __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/'.
#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
namespace std {
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.
virtual ~type_info ();
private:
// Assigning type_info is not supported. made private.
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
#if !defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100
// In old abi, there can be multiple instances of a type_info object for one
// type. Uniqueness must use the _name value, not object address.
bool before (const type_info& arg) const;
const char* name () const
{ return __name; }
bool operator== (const type_info& __arg) const;
bool operator!= (const type_info& __arg) const
{ return !operator== (__arg); }
#else
// 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
{ return __name < __arg.__name; }
const char* name () const
{ return __name; }
bool operator== (const type_info& __arg) const
{ return __name == __arg.__name; }
bool operator!= (const type_info& __arg) const
{ return !operator== (__arg); }
#endif
// 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;
// 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;
#endif
};
class bad_cast : public exception {
public:
bad_cast() { }
virtual ~bad_cast() { }
};
class bad_typeid : public exception {
public:
bad_typeid () { }
virtual ~bad_typeid () { }
};
} // namespace std
} // extern "C++"
#endif
// Implementation file for the -*- C++ -*- dynamic memory management header.
// Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation
// This file is part of GNU CC.
// GNU CC is free software; you can redistribute it and/or modify
// 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.
// GNU CC is distributed in the hope that it will be useful,
// 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
// along with GNU CC; see the file COPYING. If not, write to
// 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.
#pragma implementation "new"
#include "new"
const std::nothrow_t std::nothrow = { };
using std::new_handler;
new_handler __new_handler;
new_handler
std::set_new_handler (new_handler handler)
{
new_handler prev_handler = __new_handler;
__new_handler = handler;
return prev_handler;
}
// Support routines for the -*- C++ -*- dynamic memory management.
// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
// This file is part of GNU CC.
// GNU CC is free software; you can redistribute it and/or modify
// 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.
// GNU CC is distributed in the hope that it will be useful,
// 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
// along with GNU CC; see the file COPYING. If not, write to
// 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.
#include "new"
using std::new_handler;
using std::bad_alloc;
extern "C" void *malloc (size_t);
extern new_handler __new_handler;
#define WEAK(x) \
x __attribute__ ((weak)); \
x
#ifdef L_op_newnt
WEAK (void * operator new (size_t sz, const std::nothrow_t&) throw())
{
void *p;
/* malloc (0) is unpredictable; avoid it. */
if (sz == 0)
sz = 1;
p = (void *) malloc (sz);
while (p == 0)
{
new_handler handler = __new_handler;
if (! handler)
return 0;
try
{
handler ();
}
catch (bad_alloc &)
{
return 0;
}
p = (void *) malloc (sz);
}
return p;
}
#endif
#ifdef L_op_new
WEAK (void * operator new (size_t sz) throw (std::bad_alloc))
{
void *p;
/* malloc (0) is unpredictable; avoid it. */
if (sz == 0)
sz = 1;
p = (void *) malloc (sz);
while (p == 0)
{
new_handler handler = __new_handler;
if (! handler)
throw bad_alloc ();
handler ();
p = (void *) malloc (sz);
}
return p;
}
#endif
// Boilerplate support routines for -*- C++ -*- dynamic memory management.
// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
// This file is part of GNU CC.
// GNU CC is free software; you can redistribute it and/or modify
// 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.
// GNU CC is distributed in the hope that it will be useful,
// 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
// along with GNU CC; see the file COPYING. If not, write to
// 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.
#include "new"
extern "C" void free (void *);
#define WEAK(x) \
x __attribute__ ((weak)); \
x
#ifdef L_op_vnew
WEAK(void * operator new[] (size_t sz) throw (std::bad_alloc))
{
return ::operator new(sz);
}
#endif
#ifdef L_op_vnewnt
WEAK(void *operator new[] (size_t sz, const std::nothrow_t& nothrow) throw())
{
return ::operator new(sz, nothrow);
}
#endif
#ifdef L_op_delete
WEAK (void operator delete (void *ptr) throw ())
{
if (ptr)
free (ptr);
}
#endif
#ifdef L_op_vdel
WEAK (void operator delete[] (void *ptr) throw ())
{
::operator delete (ptr);
}
#endif
#ifdef L_op_delnt
WEAK (void operator delete (void *ptr, const std::nothrow_t&) throw ())
{
if (ptr)
free (ptr);
}
#endif
#ifdef L_op_vdelnt
WEAK (void operator delete[] (void *ptr, const std::nothrow_t&) throw ())
{
::operator delete (ptr);
}
#endif
// RTTI support internals for -*- C++ -*-
// Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000 Free Software Foundation
#include "typeinfo"
// Class declarations shared between the typeinfo implementation files.
#if !defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100
// original (old) abi
// type_info for a class with no base classes (or an enum).
struct __user_type_info : public std::type_info {
__user_type_info (const char *n) : type_info (n) {}
// If our type can be upcast to a public and unambiguous base, then return
// non-zero and set RES to point to the base object. OBJ points to the throw
// object and can be NULL, if there is no object to adjust.
int upcast (const type_info &target, void *obj, void **res) const;
// If our type can be dynamicly cast to the target type, then return
// pointer to the target object. OBJ is the pointer to the most derived
// type and cannot be NULL. SUBTYPE and SUBOBJ indicate the static type
// base object from whence we came, it cannot be NULL. SUBTYPE cannot be
// the same as TARGET. TARGET cannot be a base of SUBTYPE.
// BOFF indicates how SUBTYPE is related to TARGET.
// BOFF >= 0, there is only one public non-virtual SUBTYPE base at offset
// BOFF, and there are no public virtual SUBTYPE bases.
// Therefore check if SUBOBJ is at offset BOFF when we find a target
// BOFF == -1, SUBTYPE occurs as multiple public virtual or non-virtual bases.
// Lazily search all the bases of TARGET.
// BOFF == -2, SUBTYPE is not a public base.
// BOFF == -3, SUBTYPE occurs as multiple public non-virtual bases.
// Lazily search the non-virtual bases of TARGET.
// For backwards compatibility set BOFF to -1, that is the safe "unknown"
// value. We do not care about SUBTYPES as private bases of TARGET, as they
// can never succeed as downcasts, only as crosscasts -- and then only if
// they are virtual. This is more complicated that it might seem.
void *dyncast (int boff,
const type_info &target, void *obj,
const type_info &subtype, void *subobj) const;
// non_virtual_base_type is used to indicate that a base class is via a
// non-virtual access path.
static const type_info *const nonvirtual_base_type
= static_cast <const type_info *> (0) + 1;
// sub_kind tells us about how a base object is contained within a derived
// object. We often do this lazily, hence the UNKNOWN value. At other times
// we may use NOT_CONTAINED to mean not publicly contained.
enum sub_kind
{
unknown = 0, // we have no idea
not_contained, // not contained within us (in some
// circumstances this might mean not contained
// publicly)
contained_ambig, // contained ambiguously
contained_mask = 4, // contained within us
contained_virtual_mask = 1, // via a virtual path
contained_public_mask = 2, // via a public path
contained_private = contained_mask,
contained_public = contained_mask | contained_public_mask
};
// some predicate functions for sub_kind
static inline bool contained_p (sub_kind access_path)
{
return access_path >= contained_mask;
}
static inline bool contained_public_p (sub_kind access_path)
{
return access_path >= contained_public;
}
static inline bool contained_nonpublic_p (sub_kind access_path)
{
return (access_path & contained_public) == contained_mask;
}
static inline bool contained_nonvirtual_p (sub_kind access_path)
{
return (access_path & (contained_mask | contained_virtual_mask))
== contained_mask;
}
static inline bool contained_virtual_p (sub_kind access_path)
{
return (access_path & (contained_mask | contained_virtual_mask))
== (contained_mask | contained_virtual_mask);
}
struct upcast_result
{
void *target_obj; // pointer to target object or NULL (init NULL)
sub_kind whole2target; // path from most derived object to target
const type_info *base_type; // where we found the target, (init NULL)
// if in vbase the __user_type_info of vbase)
// if a non-virtual base then 1
// else NULL
public:
upcast_result ()
:target_obj (NULL), whole2target (unknown), base_type (NULL)
{}
};
struct dyncast_result
{
void *target_obj; // pointer to target object or NULL (init NULL)
sub_kind whole2target; // path from most derived object to target
sub_kind whole2sub; // path from most derived object to sub object
sub_kind target2sub; // path from target to sub object
public:
dyncast_result ()
:target_obj (NULL), whole2target (unknown),
whole2sub (unknown), target2sub (unknown)
{}
};
public:
// Helper for upcast. See if TARGET is us, or one of our bases. ACCESS_PATH
// gives the access from the start object. Return TRUE if we know the catch
// fails.
virtual bool do_upcast (sub_kind access_path,
const type_info &target, void *obj,
upcast_result &__restrict result) const;
// Helper for dyncast. BOFF indicates how the SUBTYPE is related to TARGET.
// ACCESS_PATH indicates the access from the most derived object. It is
// used to prune the DAG walk. All information about what we find is put
// into RESULT. Return true, if the match we have found is ambiguous.
virtual bool do_dyncast (int boff, sub_kind access_path,
const type_info &target, void *obj,
const type_info &subtype, void *subptr,
dyncast_result &__restrict result) const;
public:
// Indicate whether SUBPTR of type SUBTYPE is contained publicly within
// OBJPTR. OBJPTR points to this base object. BOFF indicates how SUBTYPE
// objects might be contained within this type. If SUBPTR is one of our
// SUBTYPE bases, indicate virtuality. Returns not_contained for non
// containment or private containment.
sub_kind find_public_subobj (int boff, const type_info &subtype,
void *objptr, void *subptr) const
{
if (boff >= 0)
return ((char *)subptr - (char *)objptr) == boff
? contained_public : not_contained;
if (boff == -2)
return not_contained;
return do_find_public_subobj (boff, subtype, objptr, subptr);
}
public:
// Helper for find_subobj. BOFF indicates how SUBTYPE bases are inherited by
// the type started from -- which is not necessarily the current type.
// OBJPTR points to the current base.
virtual sub_kind do_find_public_subobj (int boff, const type_info &subtype,
void *objptr, void *subptr) const;
};
// type_info for a class with one public, nonvirtual base class.
class __si_type_info : public __user_type_info {
const __user_type_info &base;
public:
__si_type_info (const char *n, const __user_type_info &b)
: __user_type_info (n), base (b) { }
private:
virtual bool do_upcast (sub_kind access_path,
const type_info &target, void *obj,
upcast_result &__restrict result) const;
virtual bool do_dyncast (int boff, sub_kind access_path,
const type_info &target, void *obj,
const type_info &subtype, void *subptr,
dyncast_result &__restrict result) const;
virtual sub_kind do_find_public_subobj (int boff, const type_info &subtype,
void *objptr, void *subptr) const;
};
// type_info for a general class.
// Kludge, kludge, kludge.
#include "tconfig.h"
#if BITS_PER_UNIT == 8
typedef int myint32 __attribute__ ((mode (SI)));
#elif BITS_PER_UNIT == 16
typedef int myint32 __attribute__ ((mode (HI)));
#elif BITS_PER_UNIT == 32
typedef int myint32 __attribute__ ((mode (QI)));
#endif
struct __class_type_info : public __user_type_info {
enum access { PUBLIC = 1, PROTECTED = 2, PRIVATE = 3 };
struct base_info {
const __user_type_info *base;
myint32 offset: 29;
bool is_virtual: 1;
enum access access: 2;
};
const base_info *base_list;
size_t n_bases;
__class_type_info (const char *name, const base_info *bl, size_t bn)
: __user_type_info (name), base_list (bl), n_bases (bn) {}
public:
virtual bool do_upcast (sub_kind access_path,
const type_info &target, void *obj,
upcast_result &__restrict result) const;
virtual bool do_dyncast (int boff, sub_kind access_path,
const type_info &target, void *obj,
const type_info &subtype, void *subptr,
dyncast_result &__restrict result) const;
virtual sub_kind do_find_public_subobj (int boff, const type_info &subtype,
void *objptr, void *subptr) const;
};
#else
// new abi
#include <cxxabi.h>
#endif
// new abi support -*- C++ -*-
// Copyright (C) 2000
// Free Software Foundation, Inc.
// Written by Nathan Sidwell, Codesourcery LLC, <nathan@codesourcery.com>
//
// GNU CC is free software; you can redistribute it and/or modify
// 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.
// GNU CC is distributed in the hope that it will be useful,
// 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
// along with GNU CC; see the file COPYING. If not, write to
// 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.
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
#include <cxxabi.h>
#include <new>
#include <exception>
// Exception handling hook, to mark current exception as not caught --
// generally because we're about to rethrow it after some cleanup.
extern "C" void __uncatch_exception (void);
namespace __cxxabiv1
{
/* allocate and construct array */
extern "C" void *
__cxa_vec_new (size_t element_count,
size_t element_size,
size_t padding_size,
void (*constructor) (void *),
void (*destructor) (void *))
{
return __cxa_vec_new2 (element_count, element_size, padding_size,
constructor, destructor,
&operator new[], &operator delete []);
}
extern "C" void *
__cxa_vec_new2 (size_t element_count,
size_t element_size,
size_t padding_size,
void (*constructor) (void *),
void (*destructor) (void *),
void *(*alloc) (size_t),
void (*dealloc) (void *))
{
size_t size = element_count * element_size + padding_size;
char *base = static_cast <char *> (alloc (size));
if (padding_size)
{
base += padding_size;
reinterpret_cast <size_t *> (base)[-1] = element_count;
}
try
{
__cxa_vec_ctor (base, element_count, element_size,
constructor, destructor);
}
catch (...)
{
__uncatch_exception ();
dealloc (base - padding_size);
throw;
}
return base;
}
extern "C" void *
__cxa_vec_new3 (size_t element_count,
size_t element_size,
size_t padding_size,
void (*constructor) (void *),
void (*destructor) (void *),
void *(*alloc) (size_t),
void (*dealloc) (void *, size_t))
{
size_t size = element_count * element_size + padding_size;
char *base = static_cast <char *> (alloc (size));
if (padding_size)
{
base += padding_size;
reinterpret_cast <size_t *> (base)[-1] = element_count;
}
try
{
__cxa_vec_ctor (base, element_count, element_size,
constructor, destructor);
}
catch (...)
{
__uncatch_exception ();
dealloc (base - padding_size, size);
throw;
}
return base;
}
/* construct array */
extern "C" void
__cxa_vec_ctor (void *array_address,
size_t element_count,
size_t element_size,
void (*constructor) (void *),
void (*destructor) (void *))
{
size_t ix = 0;
char *ptr = static_cast <char *> (array_address);
try
{
if (constructor)
for (; ix != element_count; ix++, ptr += element_size)
constructor (ptr);
}
catch (...)
{
__uncatch_exception ();
__cxa_vec_dtor (array_address, ix, element_size, destructor);
throw;
}
}
/* construct an array by copying */
extern "C" void
__cxa_vec_cctor (void *dest_array,
void *src_array,
size_t element_count,
size_t element_size,
void (*constructor) (void *, void *),
void (*destructor) (void *))
{
size_t ix = 0;
char *dest_ptr = static_cast <char *> (dest_array);
char *src_ptr = static_cast <char *> (src_array);
try
{
if (constructor)
for (; ix != element_count;
ix++, src_ptr += element_size, dest_ptr += element_size)
constructor (dest_ptr, src_ptr);
}
catch (...)
{
__uncatch_exception ();
__cxa_vec_dtor (dest_array, ix, element_size, destructor);
throw;
}
}
/* destruct array */
extern "C" void
__cxa_vec_dtor (void *array_address,
size_t element_count,
size_t element_size,
void (*destructor) (void *))
{
if (destructor)
{
char *ptr = static_cast <char *> (array_address);
size_t ix = element_count;
bool unwinding = std::uncaught_exception ();
ptr += element_count * element_size;
try
{
while (ix--)
{
ptr -= element_size;
destructor (ptr);
}
}
catch (...)
{
if (unwinding)
// [except.ctor]/3 If a destructor called during stack unwinding
// exits with an exception, terminate is called.
std::terminate ();
__uncatch_exception ();
__cxa_vec_dtor (array_address, ix, element_size, destructor);
throw;
}
}
}
/* destruct and release array */
extern "C" void
__cxa_vec_delete (void *array_address,
size_t element_size,
size_t padding_size,
void (*destructor) (void *))
{
__cxa_vec_delete2 (array_address, element_size, padding_size,
destructor,
&operator delete []);
}
extern "C" void
__cxa_vec_delete2 (void *array_address,
size_t element_size,
size_t padding_size,
void (*destructor) (void *),
void (*dealloc) (void *))
{
char *base = static_cast <char *> (array_address);
if (padding_size)
{
size_t element_count = reinterpret_cast <size_t *> (base)[-1];
base -= padding_size;
try
{
__cxa_vec_dtor (array_address, element_count, element_size,
destructor);
}
catch (...)
{
__uncatch_exception ();
dealloc (base);
throw;
}
}
dealloc (base);
}
extern "C" void
__cxa_vec_delete3 (void *array_address,
size_t element_size,
size_t padding_size,
void (*destructor) (void *),
void (*dealloc) (void *, size_t))
{
char *base = static_cast <char *> (array_address);
size_t size = 0;
if (padding_size)
{
size_t element_count = reinterpret_cast <size_t *> (base)[-1];
base -= padding_size;
size = element_count * element_size + padding_size;
try
{
__cxa_vec_dtor (array_address, element_count, element_size,
destructor);
}
catch (...)
{
__uncatch_exception ();
dealloc (base, size);
throw;
}
}
dealloc (base, size);
}
} // namespace __cxxabiv1
#endif // defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment