From patchwork Tue Jun 14 17:50:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 100395 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 EF626B6F9B for ; Wed, 15 Jun 2011 03:50:12 +1000 (EST) Received: (qmail 13146 invoked by alias); 14 Jun 2011 17:50:09 -0000 Received: (qmail 13120 invoked by uid 22791); 14 Jun 2011 17:50:06 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, TW_WP X-Spam-Check-By: sourceware.org Received: from smtp207.alice.it (HELO smtp207.alice.it) (82.57.200.103) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Jun 2011 17:49:49 +0000 Received: from [192.168.1.4] (79.33.221.114) by smtp207.alice.it (8.5.124.08) id 4DE640D501466E58; Tue, 14 Jun 2011 19:49:47 +0200 Message-ID: <4DF79F68.3020304@oracle.com> Date: Tue, 14 Jun 2011 19:50:32 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110414 SUSE/3.1.10 Thunderbird/3.1.10 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: libstdc++ Subject: [v2] Mark noexcept some destructors, add tests 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 Hi, tested x86_64-linux, committed to mainline. Paolo. //////////////////////// 2011-06-14 Paolo Carlini * include/std/valarray (~valarray): Use noexcept. * include/bits/unique_ptr.h (~unique_ptr): Likewise. * testsuite/26_numerics/valarray/noexcept_move_construct.cc: New. * testsuite/20_util/shared_ptr/cons/noexcept_move_construct.cc: Likewise. * testsuite/20_util/unique_ptr/cons/noexcept_move_construct.cc: Likewise. * testsuite/20_util/weak_ptr/cons/noexcept_move_construct.cc: Likewise. Index: include/std/valarray =================================================================== --- include/std/valarray (revision 175025) +++ include/std/valarray (working copy) @@ -165,7 +165,7 @@ template valarray(const _Expr<_Dom, _Tp>& __e); - ~valarray(); + ~valarray() _GLIBCXX_NOEXCEPT; // _lib.valarray.assign_ assignment: /** @@ -697,7 +697,7 @@ template inline - valarray<_Tp>::~valarray() + valarray<_Tp>::~valarray() _GLIBCXX_NOEXCEPT { std::__valarray_destroy_elements(_M_data, _M_data + _M_size); std::__valarray_release_memory(_M_data); Index: include/bits/unique_ptr.h =================================================================== --- include/bits/unique_ptr.h (revision 175025) +++ include/bits/unique_ptr.h (working copy) @@ -166,7 +166,7 @@ #endif // Destructor. - ~unique_ptr() { reset(); } + ~unique_ptr() noexcept { reset(); } // Assignment. unique_ptr& Index: testsuite/26_numerics/valarray/noexcept_move_construct.cc =================================================================== --- testsuite/26_numerics/valarray/noexcept_move_construct.cc (revision 0) +++ testsuite/26_numerics/valarray/noexcept_move_construct.cc (revision 0) @@ -0,0 +1,27 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2011-06-14 Paolo Carlini +// +// Copyright (C) 2011 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 + +typedef std::valarray vtype; + +static_assert(std::is_nothrow_move_constructible::value, "Error"); Index: testsuite/20_util/shared_ptr/cons/noexcept_move_construct.cc =================================================================== --- testsuite/20_util/shared_ptr/cons/noexcept_move_construct.cc (revision 0) +++ testsuite/20_util/shared_ptr/cons/noexcept_move_construct.cc (revision 0) @@ -0,0 +1,27 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2011-06-14 Paolo Carlini +// +// Copyright (C) 2011 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 + +typedef std::shared_ptr sptype; + +static_assert(std::is_nothrow_move_constructible::value, "Error"); Index: testsuite/20_util/unique_ptr/cons/noexcept_move_construct.cc =================================================================== --- testsuite/20_util/unique_ptr/cons/noexcept_move_construct.cc (revision 0) +++ testsuite/20_util/unique_ptr/cons/noexcept_move_construct.cc (revision 0) @@ -0,0 +1,27 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2011-06-14 Paolo Carlini +// +// Copyright (C) 2011 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 + +typedef std::unique_ptr uptype; + +static_assert(std::is_nothrow_move_constructible::value, "Error"); Index: testsuite/20_util/weak_ptr/cons/noexcept_move_construct.cc =================================================================== --- testsuite/20_util/weak_ptr/cons/noexcept_move_construct.cc (revision 0) +++ testsuite/20_util/weak_ptr/cons/noexcept_move_construct.cc (revision 0) @@ -0,0 +1,27 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2011-06-14 Paolo Carlini +// +// Copyright (C) 2011 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 + +typedef std::weak_ptr wptype; + +static_assert(std::is_nothrow_move_constructible::value, "Error");