Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5483)

Issue 6655052: [google] Move delete with size to its own file

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 6 months ago by eraman
Modified:
9 years, 4 months ago
Reviewers:
davidxl
CC:
gcc-patches_gcc.gnu.org
Base URL:
svn+ssh://gcc.gnu.org/svn/gcc/branches/google/gcc-4_7/
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+54 lines, -10 lines) Patch
M libstdc++-v3/libsupc++/Makefile.am View 1 chunk +1 line, -0 lines 0 comments Download
M libstdc++-v3/libsupc++/Makefile.in View 2 chunks +3 lines, -2 lines 0 comments Download
M libstdc++-v3/libsupc++/del_op.cc View 1 chunk +0 lines, -8 lines 0 comments Download
A libstdc++-v3/libsupc++/del_opsz.cc View 1 chunk +50 lines, -0 lines 0 comments Download

Messages

Total messages: 2
eraman
This patch moves the two argument delete operator into its own file. When a program ...
11 years, 6 months ago (2012-10-11 20:21:18 UTC) #1
davidxl
11 years, 6 months ago (2012-10-11 20:41:01 UTC) #2
ok.

thanks,

David

On Thu, Oct 11, 2012 at 1:21 PM, Easwaran Raman <eraman@google.com> wrote:
> This patch moves the two argument delete operator into its own file.
> When a program provides its own definition of operator delete (void
> *), but not operator delete (void *, size_t), we could end up linking
> two files that define _ZdlPv resulting in a linker error. Bootstraps
> with no test regressions on a x86_64 machine running linux. Ok for
> google/4_7 and google/main branches?
>
> Google ref b/6982747
>
> 2012-10-11  Easwaran Raman  <eraman@google.com>
>
>         * libsupc++/Makefile.am: Add del_opsz.cc to sources.
>         * libsupc++/Makefile.in: Regenerated.
>         * libsupc++/del_opsz.cc: New file.
>         * libsupc++/del_op.cc(operator delete(void*,std::size_t)):
>           Remove.
>
> Index: libstdc++-v3/libsupc++/Makefile.in
> ===================================================================
> --- libstdc++-v3/libsupc++/Makefile.in  (revision 192373)
> +++ libstdc++-v3/libsupc++/Makefile.in  (working copy)
> @@ -92,8 +92,8 @@ LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_
>  libsupc___la_LIBADD =
>  am__objects_1 = array_type_info.lo atexit_arm.lo bad_alloc.lo \
>         bad_cast.lo bad_typeid.lo class_type_info.lo del_op.lo \
> -       del_opnt.lo del_opv.lo del_opvnt.lo dyncast.lo eh_alloc.lo \
> -       eh_arm.lo eh_aux_runtime.lo eh_call.lo eh_catch.lo \
> +       del_opsz.lo del_opnt.lo del_opv.lo del_opvnt.lo dyncast.lo \
> +       eh_alloc.lo eh_arm.lo eh_aux_runtime.lo eh_call.lo eh_catch.lo \
>         eh_exception.lo eh_globals.lo eh_personality.lo eh_ptr.lo \
>         eh_term_handler.lo eh_terminate.lo eh_tm.lo eh_throw.lo \
>         eh_type.lo eh_unex_handler.lo enum_type_info.lo \
> @@ -362,6 +362,7 @@ sources = \
>         bad_typeid.cc \
>         class_type_info.cc \
>         del_op.cc \
> +       del_opsz.cc \
>         del_opnt.cc \
>         del_opv.cc \
>         del_opvnt.cc \
> Index: libstdc++-v3/libsupc++/del_op.cc
> ===================================================================
> --- libstdc++-v3/libsupc++/del_op.cc    (revision 192373)
> +++ libstdc++-v3/libsupc++/del_op.cc    (working copy)
> @@ -47,11 +47,3 @@ operator delete(void* ptr) _GLIBCXX_USE_NOEXCEPT
>    if (ptr)
>      std::free(ptr);
>  }
> -
> -_GLIBCXX_WEAK_DEFINITION void
> -operator delete(void* ptr,
> -                std::size_t bytes __attribute__((__unused__))) throw ()
> -{
> -  if (ptr)
> -    std::free(ptr);
> -}
> Index: libstdc++-v3/libsupc++/del_opsz.cc
> ===================================================================
> --- libstdc++-v3/libsupc++/del_opsz.cc  (revision 0)
> +++ libstdc++-v3/libsupc++/del_opsz.cc  (revision 0)
> @@ -0,0 +1,50 @@
> +// Boilerplate support routines for -*- C++ -*- dynamic memory management.
> +
> +// Copyright (C) 2012
> +// Free Software Foundation
> +//
> +// This file is part of GCC.
> +//
> +// GCC 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 3, or (at your option)
> +// any later version.
> +//
> +// GCC 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.
> +//
> +// Under Section 7 of GPL version 3, you are granted additional
> +// permissions described in the GCC Runtime Library Exception, version
> +// 3.1, as published by the Free Software Foundation.
> +
> +// You should have received a copy of the GNU General Public License and
> +// a copy of the GCC Runtime Library Exception along with this program;
> +// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
> +// <http://www.gnu.org/licenses/>.
> +
> +#include <bits/c++config.h>
> +
> +#if !_GLIBCXX_HOSTED
> +// A freestanding C runtime may not provide "free" -- but there is no
> +// other reasonable way to implement "operator delete".
> +namespace std
> +{
> +_GLIBCXX_BEGIN_NAMESPACE_VERSION
> +  extern "C" void free(void*);
> +_GLIBCXX_END_NAMESPACE_VERSION
> +} // namespace
> +#else
> +# include <cstdlib>
> +#endif
> +
> +#include "new"
> +
> +_GLIBCXX_WEAK_DEFINITION void
> +operator delete(void* ptr,
> +                std::size_t bytes __attribute__((__unused__))) throw ()
> +{
> +  if (ptr)
> +    std::free(ptr);
> +}
> Index: libstdc++-v3/libsupc++/Makefile.am
> ===================================================================
> --- libstdc++-v3/libsupc++/Makefile.am  (revision 192373)
> +++ libstdc++-v3/libsupc++/Makefile.am  (working copy)
> @@ -53,6 +53,7 @@ sources = \
>         bad_typeid.cc \
>         class_type_info.cc \
>         del_op.cc \
> +       del_opsz.cc \
>         del_opnt.cc \
>         del_opv.cc \
>         del_opvnt.cc \
>
> --
> This patch is available for review at http://codereview.appspot.com/6655052
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b