From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 5A3B33986813 for ; Tue, 10 Nov 2020 19:41:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5A3B33986813 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-19-A3rV6e4tPzipPdK_-6T2YA-1; Tue, 10 Nov 2020 14:41:37 -0500 X-MC-Unique: A3rV6e4tPzipPdK_-6T2YA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D43C01891E87; Tue, 10 Nov 2020 19:41:36 +0000 (UTC) Received: from localhost (unknown [10.33.36.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id 84F5B5B4A0; Tue, 10 Nov 2020 19:41:36 +0000 (UTC) Date: Tue, 10 Nov 2020 19:41:35 +0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Reorder constructors in Message-ID: <20201110194135.GA4187595@redhat.com> MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="1yeeQ81UyVL57Vl7" Content-Disposition: inline X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 19:41:41 -0000 --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This groups all the constructors together, consistent with the synopses in the C++20 standard. libstdc++-v3/ChangeLog: * include/std/sstream (basic_stringbug, basic_istringstream) (basic_ostringstream, basic_stringstream): Reorder C++20 constructors to be declared next to other constructors. Tested powerpc64le-linux. Committed to trunk. --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" commit f7c41c572bbc16d852104515e506936d447debbe Author: Jonathan Wakely Date: Tue Nov 10 19:12:03 2020 libstdc++: Reorder constructors in This groups all the constructors together, consistent with the synopses in the C++20 standard. libstdc++-v3/ChangeLog: * include/std/sstream (basic_stringbug, basic_istringstream) (basic_ostringstream, basic_stringstream): Reorder C++20 constructors to be declared next to other constructors. diff --git a/libstdc++-v3/include/std/sstream b/libstdc++-v3/include/std/sstream index 8cddda297017..d7200ab6ed88 100644 --- a/libstdc++-v3/include/std/sstream +++ b/libstdc++-v3/include/std/sstream @@ -149,37 +149,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 : basic_stringbuf(std::move(__rhs), __xfer_bufptrs(__rhs, this)) { __rhs._M_sync(const_cast(__rhs._M_string.data()), 0, 0); } - // 27.8.2.2 Assign and swap: - - basic_stringbuf& - operator=(const basic_stringbuf&) = delete; - - basic_stringbuf& - operator=(basic_stringbuf&& __rhs) - { - __xfer_bufptrs __st{__rhs, this}; - const __streambuf_type& __base = __rhs; - __streambuf_type::operator=(__base); - this->pubimbue(__rhs.getloc()); - _M_mode = __rhs._M_mode; - _M_string = std::move(__rhs._M_string); - __rhs._M_sync(const_cast(__rhs._M_string.data()), 0, 0); - return *this; - } - - void - swap(basic_stringbuf& __rhs) noexcept(_Noexcept_swap::value) - { - __xfer_bufptrs __l_st{*this, std::__addressof(__rhs)}; - __xfer_bufptrs __r_st{__rhs, this}; - __streambuf_type& __base = __rhs; - __streambuf_type::swap(__base); - __rhs.pubimbue(this->pubimbue(__rhs.getloc())); - std::swap(_M_mode, __rhs._M_mode); - std::swap(_M_string, __rhs._M_string); // XXX not exception safe - } -#endif // C++11 - #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI explicit basic_stringbuf(const allocator_type& __a) @@ -226,7 +195,38 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 allocator_type get_allocator() const noexcept { return _M_string.get_allocator(); } -#endif +#endif // C++20 + + // 27.8.2.2 Assign and swap: + + basic_stringbuf& + operator=(const basic_stringbuf&) = delete; + + basic_stringbuf& + operator=(basic_stringbuf&& __rhs) + { + __xfer_bufptrs __st{__rhs, this}; + const __streambuf_type& __base = __rhs; + __streambuf_type::operator=(__base); + this->pubimbue(__rhs.getloc()); + _M_mode = __rhs._M_mode; + _M_string = std::move(__rhs._M_string); + __rhs._M_sync(const_cast(__rhs._M_string.data()), 0, 0); + return *this; + } + + void + swap(basic_stringbuf& __rhs) noexcept(_Noexcept_swap::value) + { + __xfer_bufptrs __l_st{*this, std::__addressof(__rhs)}; + __xfer_bufptrs __r_st{__rhs, this}; + __streambuf_type& __base = __rhs; + __streambuf_type::swap(__base); + __rhs.pubimbue(this->pubimbue(__rhs.getloc())); + std::swap(_M_mode, __rhs._M_mode); + std::swap(_M_string, __rhs._M_string); // XXX not exception safe + } +#endif // C++11 // Getters and setters: @@ -282,7 +282,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 else return _M_string; } -#endif +#endif // C++20 /** * @brief Setting a new buffer. @@ -513,7 +513,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _M_mode(__rhs._M_mode), _M_string(std::move(__rhs._M_string), __a) { } #endif -#endif +#endif // C++11 }; @@ -623,27 +623,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _M_stringbuf(std::move(__rhs._M_stringbuf)) { __istream_type::set_rdbuf(&_M_stringbuf); } - // 27.8.3.2 Assign and swap: - - basic_istringstream& - operator=(const basic_istringstream&) = delete; - - basic_istringstream& - operator=(basic_istringstream&& __rhs) - { - __istream_type::operator=(std::move(__rhs)); - _M_stringbuf = std::move(__rhs._M_stringbuf); - return *this; - } - - void - swap(basic_istringstream& __rhs) - { - __istream_type::swap(__rhs); - _M_stringbuf.swap(__rhs._M_stringbuf); - } -#endif - #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI basic_istringstream(ios_base::openmode __mode, const allocator_type& __a) : __istream_type(), _M_stringbuf(__mode | ios_base::in, __a) @@ -674,7 +653,28 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 ios_base::openmode __mode = ios_base::in) : basic_istringstream(__str, __mode, allocator_type()) { } -#endif +#endif // C++20 + + // 27.8.3.2 Assign and swap: + + basic_istringstream& + operator=(const basic_istringstream&) = delete; + + basic_istringstream& + operator=(basic_istringstream&& __rhs) + { + __istream_type::operator=(std::move(__rhs)); + _M_stringbuf = std::move(__rhs._M_stringbuf); + return *this; + } + + void + swap(basic_istringstream& __rhs) + { + __istream_type::swap(__rhs); + _M_stringbuf.swap(__rhs._M_stringbuf); + } +#endif // C++11 // Members: /** @@ -844,27 +844,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _M_stringbuf(std::move(__rhs._M_stringbuf)) { __ostream_type::set_rdbuf(&_M_stringbuf); } - // 27.8.3.2 Assign and swap: - - basic_ostringstream& - operator=(const basic_ostringstream&) = delete; - - basic_ostringstream& - operator=(basic_ostringstream&& __rhs) - { - __ostream_type::operator=(std::move(__rhs)); - _M_stringbuf = std::move(__rhs._M_stringbuf); - return *this; - } - - void - swap(basic_ostringstream& __rhs) - { - __ostream_type::swap(__rhs); - _M_stringbuf.swap(__rhs._M_stringbuf); - } -#endif - #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI basic_ostringstream(ios_base::openmode __mode, const allocator_type& __a) : __ostream_type(), _M_stringbuf(__mode | ios_base::out, __a) @@ -895,7 +874,28 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 ios_base::openmode __mode = ios_base::out) : basic_ostringstream(__str, __mode, allocator_type()) { } -#endif +#endif // C++20 + + // 27.8.3.2 Assign and swap: + + basic_ostringstream& + operator=(const basic_ostringstream&) = delete; + + basic_ostringstream& + operator=(basic_ostringstream&& __rhs) + { + __ostream_type::operator=(std::move(__rhs)); + _M_stringbuf = std::move(__rhs._M_stringbuf); + return *this; + } + + void + swap(basic_ostringstream& __rhs) + { + __ostream_type::swap(__rhs); + _M_stringbuf.swap(__rhs._M_stringbuf); + } +#endif // C++11 // Members: /** @@ -1061,27 +1061,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _M_stringbuf(std::move(__rhs._M_stringbuf)) { __iostream_type::set_rdbuf(&_M_stringbuf); } - // 27.8.3.2 Assign and swap: - - basic_stringstream& - operator=(const basic_stringstream&) = delete; - - basic_stringstream& - operator=(basic_stringstream&& __rhs) - { - __iostream_type::operator=(std::move(__rhs)); - _M_stringbuf = std::move(__rhs._M_stringbuf); - return *this; - } - - void - swap(basic_stringstream& __rhs) - { - __iostream_type::swap(__rhs); - _M_stringbuf.swap(__rhs._M_stringbuf); - } -#endif - #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI basic_stringstream(ios_base::openmode __mode, const allocator_type& __a) : __iostream_type(), _M_stringbuf(__mode, __a) @@ -1114,7 +1093,28 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 | ios_base::out) : basic_stringstream(__str, __mode, allocator_type()) { } -#endif +#endif // C++20 + + // 27.8.3.2 Assign and swap: + + basic_stringstream& + operator=(const basic_stringstream&) = delete; + + basic_stringstream& + operator=(basic_stringstream&& __rhs) + { + __iostream_type::operator=(std::move(__rhs)); + _M_stringbuf = std::move(__rhs._M_stringbuf); + return *this; + } + + void + swap(basic_stringstream& __rhs) + { + __iostream_type::swap(__rhs); + _M_stringbuf.swap(__rhs._M_stringbuf); + } +#endif // C++11 // Members: /** --1yeeQ81UyVL57Vl7--