This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[g++,bootstrap] Conflict between -fhonor-std and -fnew-abi


While building the runtime during bootstrap on sparc-sun-solaris2.6 with
--enable-libstdcxx-v3 --enable-new-gxx-abi, gcc/cp/inc/cxxabi.h
includes <stddef.h>, then refers to std::ptrdiff_t which isn't
available. The attached patch is a temporary solution that lets me
bootstrap (up to the ICE in libstdc++-v3/src/complex_io.cc).

-- 
Branko Čibej                 <branko.cibej@hermes.si>
HERMES SoftLab, Litijska 51, 1000 Ljubljana, Slovenia
voice: (+386 1) 586 53 49     fax: (+386 1) 586 52 70


2000-05-06  Branko Cibej  <branko.cibej@hermes.si>

	* inc/cxxabi.h: When building the runtime, include <stddef.h> and
	use `ptrdiff_t'; otherwise include <cstddef> and use
	`std::ptrdiff_t'.



Index: cxxabi.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/inc/cxxabi.h,v
retrieving revision 1.9
diff -u -r1.9 cxxabi.h
--- cxxabi.h 2000/05/02 01:25:15 1.9
+++ cxxabi.h 2000/05/05 14:55:31
@@ -50,9 +50,15 @@
 #ifdef __cplusplus
 
 #include <typeinfo>
+#ifdef IN_GCC
 // This should really be cstddef, but that currently is not available when
 // building the runtime.
-#include <stddef.h>
+#  include <stddef.h>
+#  define __cxxabi_ptrdiff_t ptrdiff_t
+#else
+#  include <cstddef>
+#  define __cxxabi_ptrdiff_t std::ptrdiff_t
+#endif // IN_GCC
 
 namespace __cxxabiv1
 {
@@ -207,11 +213,11 @@
     { return vmi_offset_flags & virtual_mask; }
   bool __is_public_p () const
     { return vmi_offset_flags & public_mask; }
-  std::ptrdiff_t __offset () const
+  __cxxabi_ptrdiff_t __offset () const
     { 
       // This shift, being of a signed type, is implementation defined. GCC
       // implements such shifts as arithmetic, which is what we want.
-      return std::ptrdiff_t (vmi_offset_flags) >> offset_shift;
+      return __cxxabi_ptrdiff_t (vmi_offset_flags) >> offset_shift;
     }
 };
 
@@ -277,7 +283,7 @@
      within this type.  If SRC_PTR is one of our SRC_TYPE bases, indicate the
      virtuality. Returns not_contained for non containment or private
      containment. */
-  inline __sub_kind __find_public_src (std::ptrdiff_t __src2dst,
+  inline __sub_kind __find_public_src (__cxxabi_ptrdiff_t __src2dst,
                                        const void *__obj_ptr,
                                        const __class_type_info *__src_type,
                                        const void *__src_ptr) const;
@@ -289,7 +295,7 @@
      indicates the static type started from and SRC_PTR points to that base
      within the most derived object. Fill in RESULT with what we find. Return
      true if we have located an ambiguous match. */
-  virtual bool __do_dyncast (std::ptrdiff_t __src2dst,
+  virtual bool __do_dyncast (__cxxabi_ptrdiff_t __src2dst,
                              __sub_kind __access_path,
                              const __class_type_info *__dst_type,
                              const void *__obj_ptr,
@@ -301,7 +307,7 @@
      inherited by the type started from -- which is not necessarily the
      current type. The current type will be a base of the destination type.
      OBJ_PTR points to the current base. */
-  virtual __sub_kind __do_find_public_src (std::ptrdiff_t __src2dst,
+  virtual __sub_kind __do_find_public_src (__cxxabi_ptrdiff_t __src2dst,
                                            const void *__obj_ptr,
                                            const __class_type_info *__src_type,
                                            const void *__src_ptr) const;
@@ -326,14 +332,14 @@
 
 /* implementation defined member functions */
 protected:
-  virtual bool __do_dyncast (std::ptrdiff_t __src2dst,
+  virtual bool __do_dyncast (__cxxabi_ptrdiff_t __src2dst,
                              __sub_kind __access_path,
                              const __class_type_info *__dst_type,
                              const void *__obj_ptr,
                              const __class_type_info *__src_type,
                              const void *__src_ptr,
                              __dyncast_result &__result) const;
-  virtual __sub_kind __do_find_public_src (std::ptrdiff_t __src2dst,
+  virtual __sub_kind __do_find_public_src (__cxxabi_ptrdiff_t __src2dst,
                                            const void *__obj_ptr,
                                            const __class_type_info *__src_type,
                                            const void *__sub_ptr) const;
@@ -376,14 +382,14 @@
 
 /* implementation defined member functions */
 protected:
-  virtual bool __do_dyncast (std::ptrdiff_t __src2dst,
+  virtual bool __do_dyncast (__cxxabi_ptrdiff_t __src2dst,
                              __sub_kind __access_path,
                              const __class_type_info *__dst_type,
                              const void *__obj_ptr,
                              const __class_type_info *__src_type,
                              const void *__src_ptr,
                              __dyncast_result &__result) const;
-  virtual __sub_kind __do_find_public_src (std::ptrdiff_t __src2dst,
+  virtual __sub_kind __do_find_public_src (__cxxabi_ptrdiff_t __src2dst,
                                            const void *__obj_ptr,
                                            const __class_type_info *__src_type,
                                            const void *__src_ptr) const;
@@ -397,7 +403,7 @@
 void *__dynamic_cast (const void *__src_ptr,    /* object started from */
                       const __class_type_info *__src_type, /* static type of object */
                       const __class_type_info *__dst_type, /* desired target type */
-                      std::ptrdiff_t __src2dst); /* how src and dst are related */
+                      __cxxabi_ptrdiff_t __src2dst); /* how src and dst are related */
 
     /* src2dst has the following possible values
        >= 0: src_type is a unique public non-virtual base of dst_type
@@ -438,6 +444,9 @@
 
 /* User programs should use the alias `abi'. */
 namespace abi = __cxxabiv1;
+
+// Remove temporary definitions
+#undef __cxxabi_ptrdiff_t
 
 #else
 #endif /* __cplusplus */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]