This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] libstdc++/7442
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, jakub at redhat dot com, mark at codesourcery dot com, grigory at stl dot sarov dot ru
- Date: Wed, 31 Jul 2002 14:02:15 -0700
- Subject: [v3] libstdc++/7442
Changes cxxabi.h to be strictly conforming to the IA64 C++ ABI standard.
A couple of notes:
1) refrained from the obvious temptation to format this file correctly.
2) possible issue with standard, not a biggie.
(__si_class_type_info::__base_type): Change member to type, as per
2.9.6p. Or fix the document to be consistent. This is probably a typo.
The code sample and the text above it clash: one wants to be
__base_type, the other type.
3) this fixes more issues than were reported in GNATS. I suggest yet another
person carefully go over this file.
tested x86/linux
gcc
gcc-3_2-branch
2002-07-31 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/7442
* libsupc++/cxxabi.h
(__base_class_info): Change to __base_class_type_info. 2.9.5p6c
(__base_class_info::__base): Change to __base_type. 2.9.5p6c
(__base_class_info::offset_shift): Change to __offset_shift. 2.9.5p6c
(__vmi_class_type_info::__base_info): Don't make const, of type
__base_class_type_info, as per 2.9.5p6c
(__pbase_type_info::__qualifier_flags): Change to __flags, as per
2.9.5p7.
(__pbase_type_info::__qualifier_masks): Change to __masks, as per
2.9.5p7.
(__pointer_to_member_type_info::__context_class): Change member to
__context, as per 2.9.5p9.
* libsupc++/tinfo2.cc (__pointer_catch): Change __context_class to
__context.
* libsupc++/tinfo2.cc (__do_catch): Change __qualifier_flags to
__flags.
* libsupc++/tinfo.cc (__do_find_public_src): Change __base to
__base_type.
* libsupc++/tinfo.cc (__do_dyncast): Same.
* libsupc++/tinfo.cc (__do_upcast): Same.
Index: libsupc++/cxxabi.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/libsupc++/cxxabi.h,v
retrieving revision 1.6
diff -c -p -r1.6 cxxabi.h
*** libsupc++/cxxabi.h 23 Nov 2001 16:29:02 -0000 1.6
--- libsupc++/cxxabi.h 31 Jul 2002 21:11:32 -0000
***************
*** 1,6 ****
// new abi support -*- C++ -*-
! // Copyright (C) 2000 Free Software Foundation, Inc.
//
// This file is part of GNU CC.
//
--- 1,6 ----
// new abi support -*- C++ -*-
! // Copyright (C) 2000, 2002 Free Software Foundation, Inc.
//
// This file is part of GNU CC.
//
*************** class __pbase_type_info
*** 117,123 ****
{
/* abi defined member variables */
public:
! unsigned int __qualifier_flags; /* qualification of the target object */
const std::type_info *__pointee; /* type of pointed to object */
/* abi defined member functions */
--- 117,123 ----
{
/* abi defined member variables */
public:
! unsigned int __flags; /* qualification of the target object */
const std::type_info *__pointee; /* type of pointed to object */
/* abi defined member functions */
*************** public:
*** 127,138 ****
explicit __pbase_type_info (const char *__n,
int __quals,
const std::type_info *__type)
! : std::type_info (__n), __qualifier_flags (__quals), __pointee (__type)
{ }
/* implementation defined types */
public:
! enum __qualifier_masks {
__const_mask = 0x1,
__volatile_mask = 0x2,
__restrict_mask = 0x4,
--- 127,138 ----
explicit __pbase_type_info (const char *__n,
int __quals,
const std::type_info *__type)
! : std::type_info (__n), __flags (__quals), __pointee (__type)
{ }
/* implementation defined types */
public:
! enum __masks {
__const_mask = 0x1,
__volatile_mask = 0x2,
__restrict_mask = 0x4,
*************** class __pointer_to_member_type_info
*** 181,187 ****
{
/* abi defined member variables */
public:
! __class_type_info *__context_class; /* class of the member */
/* abi defined member functions */
public:
--- 181,187 ----
{
/* abi defined member variables */
public:
! __class_type_info *__context; /* class of the member */
/* abi defined member functions */
public:
*************** public:
*** 191,197 ****
int __quals,
const std::type_info *__type,
__class_type_info *__klass)
! : __pbase_type_info (__n, __quals, __type), __context_class (__klass)
{ }
/* implementation defined member functions */
--- 191,197 ----
int __quals,
const std::type_info *__type,
__class_type_info *__klass)
! : __pbase_type_info (__n, __quals, __type), __context (__klass)
{ }
/* implementation defined member functions */
*************** protected:
*** 204,214 ****
class __class_type_info;
/* helper class for __vmi_class_type */
! class __base_class_info
{
/* abi defined member variables */
public:
! const __class_type_info *__base; /* base class type */
long __offset_flags; /* offset and info */
/* implementation defined types */
--- 204,214 ----
class __class_type_info;
/* helper class for __vmi_class_type */
! class __base_class_type_info
{
/* abi defined member variables */
public:
! const __class_type_info* __base_type; /* base class type */
long __offset_flags; /* offset and info */
/* implementation defined types */
*************** public:
*** 217,223 ****
__virtual_mask = 0x1,
__public_mask = 0x2,
hwm_bit = 2,
! offset_shift = 8 /* bits to shift offset by */
};
/* implementation defined member functions */
--- 217,223 ----
__virtual_mask = 0x1,
__public_mask = 0x2,
hwm_bit = 2,
! __offset_shift = 8 /* bits to shift offset by */
};
/* implementation defined member functions */
*************** public:
*** 230,236 ****
{
// This shift, being of a signed type, is implementation defined. GCC
// implements such shifts as arithmetic, which is what we want.
! return static_cast<__PTRDIFF_TYPE__> (__offset_flags) >> offset_shift;
}
};
--- 230,236 ----
{
// This shift, being of a signed type, is implementation defined. GCC
// implements such shifts as arithmetic, which is what we want.
! return static_cast<__PTRDIFF_TYPE__> (__offset_flags) >> __offset_shift;
}
};
*************** public:
*** 259,267 ****
/* publicly) */
__contained_ambig, /* contained ambiguously */
! __contained_virtual_mask = __base_class_info::__virtual_mask, /* via a virtual path */
! __contained_public_mask = __base_class_info::__public_mask, /* via a public path */
! __contained_mask = 1 << __base_class_info::hwm_bit, /* contained within us */
__contained_private = __contained_mask,
__contained_public = __contained_mask | __contained_public_mask
--- 259,267 ----
/* publicly) */
__contained_ambig, /* contained ambiguously */
! __contained_virtual_mask = __base_class_type_info::__virtual_mask, /* via a virtual path */
! __contained_public_mask = __base_class_type_info::__public_mask, /* via a public path */
! __contained_mask = 1 << __base_class_type_info::hwm_bit, /* contained within us */
__contained_private = __contained_mask,
__contained_public = __contained_mask | __contained_public_mask
*************** class __vmi_class_type_info : public __c
*** 365,371 ****
public:
unsigned int __flags; /* details about the class hierarchy */
unsigned int __base_count; /* number of direct bases */
! __base_class_info const __base_info[1]; /* array of bases */
/* The array of bases uses the trailing array struct hack
so this class is not constructable with a normal constructor. It is
internally generated by the compiler. */
--- 365,371 ----
public:
unsigned int __flags; /* details about the class hierarchy */
unsigned int __base_count; /* number of direct bases */
! __base_class_type_info __base_info[1]; /* array of bases */
/* The array of bases uses the trailing array struct hack
so this class is not constructable with a normal constructor. It is
internally generated by the compiler. */
Index: libsupc++/tinfo.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/libsupc++/tinfo.cc,v
retrieving revision 1.10
diff -c -p -r1.10 tinfo.cc
*** libsupc++/tinfo.cc 25 Jun 2002 16:55:47 -0000 1.10
--- libsupc++/tinfo.cc 31 Jul 2002 21:11:32 -0000
*************** __do_find_public_src (ptrdiff_t src2dst,
*** 312,318 ****
}
base = convert_to_base (base, is_virtual, offset);
! __sub_kind base_kind = __base_info[i].__base->__do_find_public_src
(src2dst, base, src_type, src_ptr);
if (contained_p (base_kind))
{
--- 312,318 ----
}
base = convert_to_base (base, is_virtual, offset);
! __sub_kind base_kind = __base_info[i].__base_type->__do_find_public_src
(src2dst, base, src_type, src_ptr);
if (contained_p (base_kind))
{
*************** __do_dyncast (ptrdiff_t src2dst,
*** 449,455 ****
}
bool result2_ambig
! = __base_info[i].__base->__do_dyncast (src2dst, base_access,
dst_type, base,
src_type, src_ptr, result2);
result.whole2src = __sub_kind (result.whole2src | result2.whole2src);
--- 449,455 ----
}
bool result2_ambig
! = __base_info[i].__base_type->__do_dyncast (src2dst, base_access,
dst_type, base,
src_type, src_ptr, result2);
result.whole2src = __sub_kind (result.whole2src | result2.whole2src);
*************** __do_upcast (const __class_type_info *ds
*** 633,642 ****
if (base)
base = convert_to_base (base, is_virtual, offset);
! if (__base_info[i].__base->__do_upcast (dst, base, result2))
{
if (result2.base_type == nonvirtual_base_type && is_virtual)
! result2.base_type = __base_info[i].__base;
if (contained_p (result2.part2dst) && !is_public)
result2.part2dst = __sub_kind (result2.part2dst & ~__contained_public_mask);
--- 633,642 ----
if (base)
base = convert_to_base (base, is_virtual, offset);
! if (__base_info[i].__base_type->__do_upcast (dst, base, result2))
{
if (result2.base_type == nonvirtual_base_type && is_virtual)
! result2.base_type = __base_info[i].__base_type;
if (contained_p (result2.part2dst) && !is_public)
result2.part2dst = __sub_kind (result2.part2dst & ~__contained_public_mask);
Index: libsupc++/tinfo2.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/libsupc++/tinfo2.cc,v
retrieving revision 1.6
diff -c -p -r1.6 tinfo2.cc
*** libsupc++/tinfo2.cc 28 Mar 2001 11:04:50 -0000 1.6
--- libsupc++/tinfo2.cc 31 Jul 2002 21:11:32 -0000
***************
*** 1,6 ****
// Methods for type_info for -*- C++ -*- Run Time Type Identification.
! // Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001
// Free Software Foundation
//
// This file is part of GNU CC.
--- 1,6 ----
// Methods for type_info for -*- C++ -*- Run Time Type Identification.
! // Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002
// Free Software Foundation
//
// This file is part of GNU CC.
*************** __do_catch (const type_info *thr_type,
*** 116,126 ****
const __pbase_type_info *thrown_type =
static_cast <const __pbase_type_info *> (thr_type);
! if (thrown_type->__qualifier_flags & ~__qualifier_flags)
// We're less qualified.
return false;
! if (!(__qualifier_flags & __const_mask))
outer &= ~1;
return __pointer_catch (thrown_type, thr_obj, outer);
--- 116,126 ----
const __pbase_type_info *thrown_type =
static_cast <const __pbase_type_info *> (thr_type);
! if (thrown_type->__flags & ~__flags)
// We're less qualified.
return false;
! if (!(__flags & __const_mask))
outer &= ~1;
return __pointer_catch (thrown_type, thr_obj, outer);
*************** __pointer_catch (const __pbase_type_info
*** 158,164 ****
const __pointer_to_member_type_info *thrown_type =
static_cast <const __pointer_to_member_type_info *> (thr_type);
! if (*__context_class != *thrown_type->__context_class)
return false; // not pointers to member of same class
return __pbase_type_info::__pointer_catch (thrown_type, thr_obj, outer);
--- 158,164 ----
const __pointer_to_member_type_info *thrown_type =
static_cast <const __pointer_to_member_type_info *> (thr_type);
! if (*__context != *thrown_type->__context)
return false; // not pointers to member of same class
return __pbase_type_info::__pointer_catch (thrown_type, thr_obj, outer);