From patchwork Thu Aug 11 17:58:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 109653 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 45249B70C2 for ; Fri, 12 Aug 2011 03:59:09 +1000 (EST) Received: (qmail 29680 invoked by alias); 11 Aug 2011 17:59:06 -0000 Received: (qmail 29663 invoked by uid 22791); 11 Aug 2011 17:59:04 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rcsinet15.oracle.com (HELO rcsinet15.oracle.com) (148.87.113.117) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 11 Aug 2011 17:58:40 +0000 Received: from rtcsinet22.oracle.com (rtcsinet22.oracle.com [66.248.204.30]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p7BHwb2c017748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 11 Aug 2011 17:58:39 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by rtcsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p7BHwaOg017109 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 11 Aug 2011 17:58:37 GMT Received: from abhmt113.oracle.com (abhmt113.oracle.com [141.146.116.65]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p7BHwUEv032554; Thu, 11 Aug 2011 12:58:31 -0500 Received: from [192.168.1.4] (/79.52.240.103) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 11 Aug 2011 10:58:30 -0700 Message-ID: <4E441836.6050309@oracle.com> Date: Thu, 11 Aug 2011 19:58:14 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: libstdc++ Subject: [v3] Remove some redundant inline together with constexpr 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, straightforward (7.1.5/2). Tested x86_64-linux, committed to mainline. Paolo. PS: one could also imagine adding a macro like # ifdef __GXX_EXPERIMENTAL_CXX0X__ # define _GLIBCXX_INLINE_OR_CONSTEXPR constexpr # else # define _GLIBCXX_INLINE_OR_CONSTEXPR inline # endif to be used where now 'inline _GLIBCXX_CONSTEXPR' is used. But I'm not sure it's worth it... ////////////////////// 2011-08-11 Paolo Carlini * include/std/future: constexpr functions are implicitly inline. * include/std/chrono: Likewise. * include/std/complex: Likewise. * include/bits/move.h: Likewise. * include/bits/stl_pair.h: Likewise. Index: include/std/future =================================================================== --- include/std/future (revision 177677) +++ include/std/future (working copy) @@ -129,25 +129,25 @@ deferred = 2 }; - inline constexpr launch operator&(launch __x, launch __y) + constexpr launch operator&(launch __x, launch __y) { return static_cast( static_cast(__x) & static_cast(__y)); } - inline constexpr launch operator|(launch __x, launch __y) + constexpr launch operator|(launch __x, launch __y) { return static_cast( static_cast(__x) | static_cast(__y)); } - inline constexpr launch operator^(launch __x, launch __y) + constexpr launch operator^(launch __x, launch __y) { return static_cast( static_cast(__x) ^ static_cast(__y)); } - inline constexpr launch operator~(launch __x) + constexpr launch operator~(launch __x) { return static_cast(~static_cast(__x)); } inline launch& operator&=(launch& __x, launch __y) Index: include/std/chrono =================================================================== --- include/std/chrono (revision 177677) +++ include/std/chrono (working copy) @@ -168,8 +168,8 @@ /// duration_cast template - inline constexpr typename enable_if<__is_duration<_ToDur>::value, - _ToDur>::type + constexpr typename enable_if<__is_duration<_ToDur>::value, + _ToDur>::type duration_cast(const duration<_Rep, _Period>& __d) { typedef typename _ToDur::period __to_period; @@ -352,8 +352,8 @@ template - inline constexpr typename common_type, - duration<_Rep2, _Period2>>::type + constexpr typename common_type, + duration<_Rep2, _Period2>>::type operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { @@ -365,8 +365,8 @@ template - inline constexpr typename common_type, - duration<_Rep2, _Period2>>::type + constexpr typename common_type, + duration<_Rep2, _Period2>>::type operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { @@ -386,7 +386,7 @@ { typedef typename common_type<_Rep1, _Rep2>::type type; }; template - inline constexpr + constexpr duration::type, _Period> operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { @@ -396,13 +396,13 @@ } template - inline constexpr + constexpr duration::type, _Period> operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) { return __d * __s; } template - inline constexpr duration::value, _Rep2>::type>::type, _Period> operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { @@ -411,9 +411,9 @@ return __cd(__cd(__d).count() / __s); } - template - inline constexpr typename common_type<_Rep1, _Rep2>::type + template + constexpr typename common_type<_Rep1, _Rep2>::type operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { @@ -425,7 +425,7 @@ // DR 934. template - inline constexpr duration::value, _Rep2>::type>::type, _Period> operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { @@ -434,10 +434,10 @@ return __cd(__cd(__d).count() % __s); } - template - inline constexpr typename common_type, - duration<_Rep2, _Period2>>::type + template + constexpr typename common_type, + duration<_Rep2, _Period2>>::type operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { @@ -450,7 +450,7 @@ // comparisons template - inline constexpr bool + constexpr bool operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { @@ -462,7 +462,7 @@ template - inline constexpr bool + constexpr bool operator<(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { @@ -474,28 +474,28 @@ template - inline constexpr bool + constexpr bool operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { return !(__lhs == __rhs); } template - inline constexpr bool + constexpr bool operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { return !(__rhs < __lhs); } template - inline constexpr bool + constexpr bool operator>(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { return __rhs < __lhs; } template - inline constexpr bool + constexpr bool operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { return !(__lhs < __rhs); } @@ -575,8 +575,8 @@ /// time_point_cast template - inline constexpr typename enable_if<__is_duration<_ToDur>::value, - time_point<_Clock, _ToDur>>::type + constexpr typename enable_if<__is_duration<_ToDur>::value, + time_point<_Clock, _ToDur>>::type time_point_cast(const time_point<_Clock, _Dur>& __t) { typedef time_point<_Clock, _ToDur> __time_point; @@ -585,7 +585,7 @@ template - inline constexpr time_point<_Clock, + constexpr time_point<_Clock, typename common_type<_Dur1, duration<_Rep2, _Period2>>::type> operator+(const time_point<_Clock, _Dur1>& __lhs, const duration<_Rep2, _Period2>& __rhs) @@ -598,7 +598,7 @@ template - inline constexpr time_point<_Clock, + constexpr time_point<_Clock, typename common_type, _Dur2>::type> operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Dur2>& __rhs) @@ -611,7 +611,7 @@ template - inline constexpr time_point<_Clock, + constexpr time_point<_Clock, typename common_type<_Dur1, duration<_Rep2, _Period2>>::type> operator-(const time_point<_Clock, _Dur1>& __lhs, const duration<_Rep2, _Period2>& __rhs) @@ -623,43 +623,43 @@ } template - inline constexpr typename common_type<_Dur1, _Dur2>::type + constexpr typename common_type<_Dur1, _Dur2>::type operator-(const time_point<_Clock, _Dur1>& __lhs, const time_point<_Clock, _Dur2>& __rhs) { return __lhs.time_since_epoch() - __rhs.time_since_epoch(); } template - inline constexpr bool + constexpr bool operator==(const time_point<_Clock, _Dur1>& __lhs, const time_point<_Clock, _Dur2>& __rhs) { return __lhs.time_since_epoch() == __rhs.time_since_epoch(); } template - inline constexpr bool + constexpr bool operator!=(const time_point<_Clock, _Dur1>& __lhs, const time_point<_Clock, _Dur2>& __rhs) { return !(__lhs == __rhs); } template - inline constexpr bool + constexpr bool operator<(const time_point<_Clock, _Dur1>& __lhs, const time_point<_Clock, _Dur2>& __rhs) { return __lhs.time_since_epoch() < __rhs.time_since_epoch(); } template - inline constexpr bool + constexpr bool operator<=(const time_point<_Clock, _Dur1>& __lhs, const time_point<_Clock, _Dur2>& __rhs) { return !(__rhs < __lhs); } template - inline constexpr bool + constexpr bool operator>(const time_point<_Clock, _Dur1>& __lhs, const time_point<_Clock, _Dur2>& __rhs) { return __rhs < __lhs; } template - inline constexpr bool + constexpr bool operator>=(const time_point<_Clock, _Dur1>& __lhs, const time_point<_Clock, _Dur2>& __rhs) { return !(__lhs < __rhs); } Index: include/std/complex =================================================================== --- include/std/complex (revision 177677) +++ include/std/complex (working copy) @@ -531,12 +531,12 @@ // Values #ifdef __GXX_EXPERIMENTAL_CXX0X__ template - inline constexpr _Tp + constexpr _Tp real(const complex<_Tp>& __z) { return __z.real(); } - + template - inline constexpr _Tp + constexpr _Tp imag(const complex<_Tp>& __z) { return __z.imag(); } #else Index: include/bits/move.h =================================================================== --- include/bits/move.h (revision 177677) +++ include/bits/move.h (working copy) @@ -58,12 +58,12 @@ /// forward (as per N3143) template - inline constexpr _Tp&& + constexpr _Tp&& forward(typename std::remove_reference<_Tp>::type& __t) noexcept { return static_cast<_Tp&&>(__t); } template - inline constexpr _Tp&& + constexpr _Tp&& forward(typename std::remove_reference<_Tp>::type&& __t) noexcept { static_assert(!std::is_lvalue_reference<_Tp>::value, "template argument" @@ -78,7 +78,7 @@ * @return Same, moved. */ template - inline constexpr typename std::remove_reference<_Tp>::type&& + constexpr typename std::remove_reference<_Tp>::type&& move(_Tp&& __t) noexcept { return static_cast::type&&>(__t); } Index: include/bits/stl_pair.h =================================================================== --- include/bits/stl_pair.h (revision 177677) +++ include/bits/stl_pair.h (working copy) @@ -275,8 +275,8 @@ #ifdef __GXX_EXPERIMENTAL_CXX0X__ // NB: DR 706. template - inline constexpr pair::__type, - typename __decay_and_strip<_T2>::__type> + constexpr pair::__type, + typename __decay_and_strip<_T2>::__type> make_pair(_T1&& __x, _T2&& __y) { typedef typename __decay_and_strip<_T1>::__type __ds_type1;