From patchwork Thu Oct 11 20:21:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Easwaran Raman X-Patchwork-Id: 190990 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 979882C007F for ; Fri, 12 Oct 2012 07:21:33 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1350591693; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:To:Subject:Message-Id:Date:From: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=0TCdNXftsAEVCi6RcMy6 G/t5IIc=; b=lGMr/kkhb6G7Hgii519645oA5QRpAMTZeZ5DNX90boP2cCiMVuDB AiC8R6M+CAFGjnhNmanhiJKDaaFK50hZXkEfmJEOBM8CClT0+VZDsIBeOjZo4EKA ErTPasrCcKBp3MaE6lQwYfeRJZaFhNjnmLf+HhhLpXTuIXk37VLs76U= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:Received:Received:To:Subject:Message-Id:Date:From:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=FaJZV+DVdYDPP2FlGQrJNPDFQ7eyekiTWHvsnpCXEIWi1iYv9UyN6citfBl2Zj vEXPwyFfY1moaSNGH30XaOeqoNpZfydZfJJ5QkI2635ZJOVpLltr8tMi0da7DNg8 3KrnWSq8xC9h4JKpH+XmdAyWnJ2fEHo2BkFCE0bnsVekI=; Received: (qmail 2371 invoked by alias); 11 Oct 2012 20:21:26 -0000 Received: (qmail 2357 invoked by uid 22791); 11 Oct 2012 20:21:25 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-fa0-f73.google.com (HELO mail-fa0-f73.google.com) (209.85.161.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 11 Oct 2012 20:21:19 +0000 Received: by mail-fa0-f73.google.com with SMTP id v1so134773fav.2 for ; Thu, 11 Oct 2012 13:21:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=to:subject:message-id:date:from:x-gm-message-state; bh=ni7X0tSupmPqWar2b+o2llkddfk2uaegGiHhzAHfDok=; b=BSdeCPrknAOetCVjBTSQgnvmCb/DudyOiGTc+BfyMMJdGytYAmNG+raMg1E7uZxR9+ iDWVl62duiGrA179Q6Iks9mBw3yZxWj5a8I08E7g16v5JjSBBUg3O5wUYt1pcTB2SF+y P2kI3zFeldFV/qPbUqIONWddUmz/Hsv66dJ78zZvqLbyBGtWAKQP+7HwO+nvDqF76c9M XC2dv1eUKsjrVTs9ChZg1O74Q+SSUJY9YAzJMNM3RDZ40n3IGHrhh2eR5a1HJpf3OSR5 /Qv/V3ZNzWkPT5gJIBupf73Qm2A3hsvJbqOudNevPvCv88W42MH5HoxmhOKvNQflY9pS DC1w== Received: by 10.180.75.197 with SMTP id e5mr52892wiw.1.1349986878409; Thu, 11 Oct 2012 13:21:18 -0700 (PDT) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id cq5si22212wib.1.2012.10.11.13.21.18 (version=TLSv1/SSLv3 cipher=AES128-SHA); Thu, 11 Oct 2012 13:21:18 -0700 (PDT) Received: from agni2.mtv.corp.google.com (agni2.mtv.corp.google.com [172.18.110.219]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id C452120004E; Thu, 11 Oct 2012 13:21:17 -0700 (PDT) Received: by agni2.mtv.corp.google.com (Postfix, from userid 93554) id 06BDB2214DE; Thu, 11 Oct 2012 13:21:16 -0700 (PDT) To: reply@codereview.appspotmail.com,gcc-patches@gcc.gnu.org Subject: [google] Move delete with size to its own file (issue6655052) Message-Id: <20121011202117.06BDB2214DE@agni2.mtv.corp.google.com> Date: Thu, 11 Oct 2012 13:21:16 -0700 (PDT) From: eraman@google.com (Easwaran Raman) X-Gm-Message-State: ALoCoQlIHc5MZbgsy8nb0x+amxOmaC4jSj77Rsw/n8JyFu0LEZHMTLJpvB0FJiUtWJzD+GSefGXNHnO0O1dnNtNLjyhsKtEgrHSYLZbj0j8aQGv47kn088EM7OqMuQxRrTOyzlqXU9Dmu75IvhcwNjgUtKeuFJVYWNpjNkyXI51rcsn4R56v11T0N+EkYkY5lgJQrztsUohQ X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 * 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. --- This patch is available for review at http://codereview.appspot.com/6655052 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 +// . + +#include + +#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 +#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 \