From patchwork Mon Jan 7 00:50:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 209844 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 95B1B2C007C for ; Mon, 7 Jan 2013 11:50:56 +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=1358124659; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:Date:Message-ID:Subject:From:To: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=s6NGSUr /Dgp+zToCfs33DZWP6y8=; b=qTv10sFXwsDGERzrsSuUCU8YF0NT+xhp6SMnJnz uH31hua6AIm7ob01+6hRu3X4IV2esVI1JXh/XjB4Me2iT8D1qWlZkhTtC6Lvhq+t t8+sPrTWzxLon53V2Q18B7VWGUXm0VsEapzdyN1LnOhlq8yKub/O3XpMo2hH/Hde t6e4= 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:MIME-Version:Received:Received:Date:Message-ID:Subject:From:To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=IqakhBG0IpZtQGy5pS2Xs65FeeQdFyWcu5Ah5MfU1Wq0X/cY/h14h24vPj2I+x 3gxVpz38jY1y5lOeJgVjIWE8+d4LQrJJ+ii0HiEAjW6NN4WmKAA0d/VfupxGBRkN Q1xj8ejhszmeSAoDB1Dz6z8zs9Wg6x7MZ3GP3LsRLxYM4=; Received: (qmail 11288 invoked by alias); 7 Jan 2013 00:50:38 -0000 Received: (qmail 11258 invoked by uid 22791); 7 Jan 2013 00:50:36 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-la0-f43.google.com (HELO mail-la0-f43.google.com) (209.85.215.43) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 07 Jan 2013 00:50:27 +0000 Received: by mail-la0-f43.google.com with SMTP id eg20so14085993lab.30 for ; Sun, 06 Jan 2013 16:50:25 -0800 (PST) MIME-Version: 1.0 Received: by 10.152.122.133 with SMTP id ls5mr57341906lab.9.1357519825036; Sun, 06 Jan 2013 16:50:25 -0800 (PST) Received: by 10.112.125.71 with HTTP; Sun, 6 Jan 2013 16:50:24 -0800 (PST) Date: Mon, 7 Jan 2013 00:50:24 +0000 Message-ID: Subject: [v3] fix PR 55728 and PR 55847 From: Jonathan Wakely To: "libstdc++" , gcc-patches 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 PR libstdc++/55847 * src/c++11/shared_ptr.cc (bad_weak_ptr::what()): Correct string. PR libstdc++/55728 * include/std/functional (bad_function_call::what()): Declare. * src/c++11/functional.cc (bad_function_call::what()): Define. * config/abi/pre/gnu.ver (bad_function_call::what()): Export. * testsuite/20_util/bad_function_call/what.cc: New. Tested x86_64-linux, committed to trunk. commit e23405d43828180dff54f54e40e131a769e2c842 Author: Jonathan Wakely Date: Mon Jan 7 00:13:18 2013 +0000 PR libstdc++/55847 * src/c++11/shared_ptr.cc (bad_weak_ptr::what()): Correct string. * testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc: Verify string. PR libstdc++/55728 * include/std/functional (bad_function_call::what()): Declare. * src/c++11/functional.cc (bad_function_call::what()): Define. * config/abi/pre/gnu.ver (bad_function_call::what()): Export. * testsuite/20_util/bad_function_call/what.cc: New. diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index 8b1ec0d..35b4c44 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -1342,6 +1342,9 @@ GLIBCXX_3.4.18 { # std::this_thread::__sleep_for _ZNSt11this_thread11__sleep_for*; + # std::bad_function_call::what() + _ZNKSt17bad_function_call4whatEv; + } GLIBCXX_3.4.17; # Symbols in the support library (libsupc++) have their own tag. diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional index 3ec2e1e..0b5d475 100644 --- a/libstdc++-v3/include/std/functional +++ b/libstdc++-v3/include/std/functional @@ -1,6 +1,6 @@ // -*- C++ -*- -// Copyright (C) 2001-2012 Free Software Foundation, Inc. +// Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -1767,6 +1767,8 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) { public: virtual ~bad_function_call() noexcept; + + const char* what() const noexcept; }; /** diff --git a/libstdc++-v3/src/c++11/functional.cc b/libstdc++-v3/src/c++11/functional.cc index 2ab3405..8d81f60 100644 --- a/libstdc++-v3/src/c++11/functional.cc +++ b/libstdc++-v3/src/c++11/functional.cc @@ -1,7 +1,6 @@ // Support for -*- C++ -*- -// Copyright (C) 2011 -// Free Software Foundation, Inc. +// Copyright (C) 2011-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -29,7 +28,11 @@ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION - bad_function_call::~bad_function_call() throw() = default; + bad_function_call::~bad_function_call() noexcept = default; + + const char* + bad_function_call::what() const noexcept + { return "bad_function_call"; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/src/c++11/shared_ptr.cc b/libstdc++-v3/src/c++11/shared_ptr.cc index 911e745..ca5714a 100644 --- a/libstdc++-v3/src/c++11/shared_ptr.cc +++ b/libstdc++-v3/src/c++11/shared_ptr.cc @@ -1,7 +1,6 @@ // Support for pointer abstractions -*- C++ -*- -// Copyright (C) 2011 -// Free Software Foundation, Inc. +// Copyright (C) 2011-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -33,7 +32,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION char const* bad_weak_ptr::what() const noexcept - { return "std::bad_weak_ptr"; } + { return "bad_weak_ptr"; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/testsuite/20_util/bad_function_call/what.cc b/libstdc++-v3/testsuite/20_util/bad_function_call/what.cc new file mode 100644 index 0000000..4d9c8b4 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/bad_function_call/what.cc @@ -0,0 +1,33 @@ +// { dg-options "-std=gnu++11" } + +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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. + +// This library 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. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +int main() +{ + try + { + std::function{}(); + } + catch (const std::exception& e) + { + VERIFY( e.what() == std::string("bad_function_call") ); + } +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc index d2bf508..2d655d7 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc @@ -1,6 +1,6 @@ // { dg-options "-std=gnu++0x" } -// Copyright (C) 2005, 2006, 2007, 2009, 2012 Free Software Foundation +// Copyright (C) 2005-2013 Free Software Foundation // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -40,10 +40,11 @@ test01() { std::shared_ptr a2(wa); } - catch (const std::bad_weak_ptr&) + catch (const std::bad_weak_ptr& e) { // Expected. - test = true; + if (e.what() == std::string("bad_weak_ptr")) + test = true; } VERIFY( test );