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]
Other format: [Raw text]

PATCH: __cxa_vec_new[23] Change to Reflect ABI Change


The attached patch changes the implementation of array creation routines __cxa_vec_new2 and __cxa_vec_new3. These functions, specified in the C++ ABI specification section 3.3.3, now require returning NULL if the allocation function returns NULL. The ABI change occurred 05Sep. The ABI is available at http://www.codesourcery.com/cxx-abi/abi.html .

2003-09-10 Jeffrey D. Oldham <oldham@codesourcery.com>

	* libsupc++/vec.cc (__cxa_vec_new2): If the allocator returns
	NULL, return NULL.  This reflects a C++ ABI change 2003 Sep 05.
	(__cxa_vec_new3): Likewise.

Tested on i686-pc-linux-gnu by running C++ and libstdc++ regression tests. No new regressions occurred.

Jeffrey D. Oldham
oldham@codesourcery.com
Index: libsupc++/vec.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/libsupc++/vec.cc,v
retrieving revision 1.10
diff -c -p -r1.10 vec.cc
*** libsupc++/vec.cc	24 May 2003 16:22:03 -0000	1.10
--- libsupc++/vec.cc	9 Sep 2003 16:21:11 -0000
***************
*** 1,6 ****
  // New abi Support -*- C++ -*-
  
! // Copyright (C) 2000, 2001 Free Software Foundation, Inc.
  //  
  // This file is part of GCC.
  //
--- 1,6 ----
  // New abi Support -*- C++ -*-
  
! // Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
  //  
  // This file is part of GCC.
  //
*************** namespace __cxxabiv1
*** 83,89 ****
    {
      std::size_t size = element_count * element_size + padding_size;
      char *base = static_cast <char *> (alloc (size));
!     
      if (padding_size)
        {
  	base += padding_size;
--- 83,91 ----
    {
      std::size_t size = element_count * element_size + padding_size;
      char *base = static_cast <char *> (alloc (size));
!     if (!base)
!       return base;
! 
      if (padding_size)
        {
  	base += padding_size;
*************** namespace __cxxabiv1
*** 116,121 ****
--- 118,125 ----
    {
      std::size_t size = element_count * element_size + padding_size;
      char *base = static_cast<char *>(alloc (size));
+     if (!base)
+       return base;
      
      if (padding_size)
        {

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