From patchwork Tue Jun 14 15:11:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 100354 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 CCB85B6F6C for ; Wed, 15 Jun 2011 01:10:52 +1000 (EST) Received: (qmail 21347 invoked by alias); 14 Jun 2011 15:10:48 -0000 Received: (qmail 21320 invoked by uid 22791); 14 Jun 2011 15:10:46 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from smtp204.alice.it (HELO smtp204.alice.it) (82.57.200.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Jun 2011 15:10:24 +0000 Received: from [192.168.1.4] (79.33.221.114) by smtp204.alice.it (8.5.124.08) id 4DE62ADD0146A121; Tue, 14 Jun 2011 17:10:22 +0200 Message-ID: <4DF77A0B.9000503@oracle.com> Date: Tue, 14 Jun 2011 17:11:07 +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: [v3] Use noexcept in and tempbuf 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. Paolo. /////////////////// 2011-06-14 Paolo Carlini * include/std/functional: Use noexcept. * include/bits/stl_tempbuf.h: Likewise. Index: include/std/functional =================================================================== --- include/std/functional (revision 175020) +++ include/std/functional (working copy) @@ -437,28 +437,28 @@ public: typedef _Tp type; - reference_wrapper(_Tp& __indata) + reference_wrapper(_Tp& __indata) noexcept : _M_data(std::__addressof(__indata)) { } reference_wrapper(_Tp&&) = delete; - reference_wrapper(const reference_wrapper<_Tp>& __inref): - _M_data(__inref._M_data) + reference_wrapper(const reference_wrapper<_Tp>& __inref) noexcept + : _M_data(__inref._M_data) { } reference_wrapper& - operator=(const reference_wrapper<_Tp>& __inref) + operator=(const reference_wrapper<_Tp>& __inref) noexcept { _M_data = __inref._M_data; return *this; } - operator _Tp&() const + operator _Tp&() const noexcept { return this->get(); } _Tp& - get() const + get() const noexcept { return *_M_data; } template @@ -473,13 +473,13 @@ /// Denotes a reference should be taken to a variable. template inline reference_wrapper<_Tp> - ref(_Tp& __t) + ref(_Tp& __t) noexcept { return reference_wrapper<_Tp>(__t); } /// Denotes a const reference should be taken to a variable. template inline reference_wrapper - cref(const _Tp& __t) + cref(const _Tp& __t) noexcept { return reference_wrapper(__t); } template @@ -491,13 +491,13 @@ /// Partial specialization. template inline reference_wrapper<_Tp> - ref(reference_wrapper<_Tp> __t) + ref(reference_wrapper<_Tp> __t) noexcept { return ref(__t.get()); } /// Partial specialization. template inline reference_wrapper - cref(reference_wrapper<_Tp> __t) + cref(reference_wrapper<_Tp> __t) noexcept { return cref(__t.get()); } // @} group functors @@ -1913,13 +1913,15 @@ * @brief Default construct creates an empty function call wrapper. * @post @c !(bool)*this */ - function() : _Function_base() { } + function() noexcept + : _Function_base() { } /** * @brief Creates an empty function call wrapper. * @post @c !(bool)*this */ - function(nullptr_t) : _Function_base() { } + function(nullptr_t) noexcept + : _Function_base() { } /** * @brief %Function copy constructor. @@ -2050,7 +2052,7 @@ /// @overload template typename enable_if::value, function&>::type - operator=(reference_wrapper<_Functor> __f) + operator=(reference_wrapper<_Functor> __f) noexcept { function(__f).swap(*this); return *this; @@ -2093,7 +2095,7 @@ * * This function will not throw an %exception. */ - explicit operator bool() const + explicit operator bool() const noexcept { return !_M_empty(); } // [3.7.2.4] function invocation @@ -2119,7 +2121,7 @@ * * This function will not throw an %exception. */ - const type_info& target_type() const; + const type_info& target_type() const noexcept; /** * @brief Access the stored target function object. @@ -2130,10 +2132,10 @@ * * This function will not throw an %exception. */ - template _Functor* target(); + template _Functor* target() noexcept; /// @overload - template const _Functor* target() const; + template const _Functor* target() const noexcept; #endif private: @@ -2187,7 +2189,7 @@ template const type_info& function<_Res(_ArgTypes...)>:: - target_type() const + target_type() const noexcept { if (_M_manager) { @@ -2203,7 +2205,7 @@ template _Functor* function<_Res(_ArgTypes...)>:: - target() + target() noexcept { if (typeid(_Functor) == target_type() && _M_manager) { @@ -2222,7 +2224,7 @@ template const _Functor* function<_Res(_ArgTypes...)>:: - target() const + target() const noexcept { if (typeid(_Functor) == target_type() && _M_manager) { @@ -2246,13 +2248,13 @@ */ template inline bool - operator==(const function<_Res(_Args...)>& __f, nullptr_t) + operator==(const function<_Res(_Args...)>& __f, nullptr_t) noexcept { return !static_cast(__f); } /// @overload template inline bool - operator==(nullptr_t, const function<_Res(_Args...)>& __f) + operator==(nullptr_t, const function<_Res(_Args...)>& __f) noexcept { return !static_cast(__f); } /** @@ -2264,13 +2266,13 @@ */ template inline bool - operator!=(const function<_Res(_Args...)>& __f, nullptr_t) + operator!=(const function<_Res(_Args...)>& __f, nullptr_t) noexcept { return static_cast(__f); } /// @overload template inline bool - operator!=(nullptr_t, const function<_Res(_Args...)>& __f) + operator!=(nullptr_t, const function<_Res(_Args...)>& __f) noexcept { return static_cast(__f); } // [20.7.15.2.7] specialized algorithms Index: include/bits/stl_tempbuf.h =================================================================== --- include/bits/stl_tempbuf.h (revision 175020) +++ include/bits/stl_tempbuf.h (working copy) @@ -1,6 +1,7 @@ // Temporary buffer implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, +// 2010, 2011 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -83,7 +84,7 @@ */ template pair<_Tp*, ptrdiff_t> - get_temporary_buffer(ptrdiff_t __len) + get_temporary_buffer(ptrdiff_t __len) _GLIBCXX_NOEXCEPT { const ptrdiff_t __max = __gnu_cxx::__numeric_traits::__max / sizeof(_Tp);