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 E48DA398780E for ; Fri, 23 Oct 2020 00:13:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E48DA398780E 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-425-zKLh0z8cNhSfqDKsUSS9uw-1; Thu, 22 Oct 2020 20:13:31 -0400 X-MC-Unique: zKLh0z8cNhSfqDKsUSS9uw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 08C30835B8C; Fri, 23 Oct 2020 00:13:30 +0000 (UTC) Received: from localhost (unknown [10.33.36.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E19E6266E; Fri, 23 Oct 2020 00:13:29 +0000 (UTC) Date: Fri, 23 Oct 2020 01:13:28 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [committed 1/2] libstdc++: Reduce header dependencies in and on Message-ID: <20201023001328.GA1487664@redhat.com> References: <20201022175820.GA1313862@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201022175820.GA1313862@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="UugvWAfsgieZRqgk" Content-Disposition: inline X-Spam-Status: No, score=-14.2 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Oct 2020 00:13:35 -0000 --UugvWAfsgieZRqgk Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline On 22/10/20 18:59 +0100, Jonathan Wakely wrote: >By moving std::make_obj_using_allocator and the related "utility >functions for uses-allocator construction" to a new header, we can avoid >including the whole of in and >. > >In order to simplify the implementation of those utility functions they >now use concepts unconditionally. They are no longer defined if >__cpp_concepts is not defined. To simplify the code that uses those >functions I've introduced a __cpp_lib_make_obj_using_allocator feature >test macro (not specified in the standard, which might be an oversight). >That allows the code in and to >check the feature test macro to decide whether to use the new utilities, >or fall back to the C++17 code. > >At the same time, this reshuffles some of the headers included by > so that they are (mostly?) self-contained. It should no longer >be necessary to include other headers before when >other parts of the library want to use std::shared_ptr without including >the whole of . > >libstdc++-v3/ChangeLog: > > * include/Makefile.am: Add new header. > * include/Makefile.in: Regenerate. > * include/bits/shared_ptr.h: Include . > * include/bits/shared_ptr_base.h: Include required headers here > directly, instead of in . > * include/bits/uses_allocator_args.h: New file. Move utility > functions for uses-allocator construction from to here. > Only define the utility functions when concepts are available. > (__cpp_lib_make_obj_using_allocator): Define non-standard > feature test macro. > * include/std/condition_variable: Remove unused headers. > * include/std/future: Likewise. > * include/std/memory: Remove headers that are not needed > directly, and are now inclkuded where they're needed. Include > new header. > * include/std/memory_resource: Include only the necessary > headers. Use new feature test macro to detect support for the > utility functions. > * include/std/scoped_allocator: Likewise. > * include/std/version (__cpp_lib_make_obj_using_allocator): > Define. The recent changes to reduce includes in went a bit too far, and it's possible for std::forward_as_tuple to not be defined when used. While doing this, I noticed the problematic calls to forward_as_tuple were not qualified, so performed unwanted ADL. Fixed with this patch. Tested powerpc64le-linux. Committed to trunk. --UugvWAfsgieZRqgk Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" commit ca021ac617277ba73cb694f8d26ec0f5e1293451 Author: Jonathan Wakely Date: Fri Oct 23 00:58:35 2020 libstdc++: Ensure std::forward_as_tuple is defined The recent changes to reduce includes in went a bit too far, and it's possible for std::forward_as_tuple to not be defined when used. While doing this, I noticed the problematic calls to forward_as_tuple were not qualified, so performed unwanted ADL. libstdc++-v3/ChangeLog: * include/experimental/memory_resource: Include . (polymorphic_allocator::construct): Qualify forward_as_tuple. * include/std/memory_resource: Likewise. diff --git a/libstdc++-v3/include/experimental/memory_resource b/libstdc++-v3/include/experimental/memory_resource index 1c4de70c533..ca1bad9ecd0 100644 --- a/libstdc++-v3/include/experimental/memory_resource +++ b/libstdc++-v3/include/experimental/memory_resource @@ -36,6 +36,7 @@ #include // align, uses_allocator, __uses_alloc #include // pair, experimental::erased_type +#include // tuple, forward_as_tuple #include // atomic #include // placement new #include // max_align_t @@ -196,8 +197,8 @@ namespace pmr { construct(pair<_Tp1,_Tp2>* __p, _Up&& __x, _Vp&& __y) { this->construct(__p, piecewise_construct, - forward_as_tuple(std::forward<_Up>(__x)), - forward_as_tuple(std::forward<_Vp>(__y))); + std::forward_as_tuple(std::forward<_Up>(__x)), + std::forward_as_tuple(std::forward<_Vp>(__y))); } template @@ -205,8 +206,8 @@ namespace pmr { construct(pair<_Tp1,_Tp2>* __p, const std::pair<_Up, _Vp>& __pr) { this->construct(__p, piecewise_construct, - forward_as_tuple(__pr.first), - forward_as_tuple(__pr.second)); + std::forward_as_tuple(__pr.first), + std::forward_as_tuple(__pr.second)); } template @@ -214,8 +215,8 @@ namespace pmr { construct(pair<_Tp1,_Tp2>* __p, pair<_Up, _Vp>&& __pr) { this->construct(__p, piecewise_construct, - forward_as_tuple(std::forward<_Up>(__pr.first)), - forward_as_tuple(std::forward<_Vp>(__pr.second))); + std::forward_as_tuple(std::forward<_Up>(__pr.first)), + std::forward_as_tuple(std::forward<_Vp>(__pr.second))); } template diff --git a/libstdc++-v3/include/std/memory_resource b/libstdc++-v3/include/std/memory_resource index 350799ee382..40e23a2f9ce 100644 --- a/libstdc++-v3/include/std/memory_resource +++ b/libstdc++-v3/include/std/memory_resource @@ -45,6 +45,7 @@ #if ! __cpp_lib_make_obj_using_allocator # include // pair, index_sequence +# include // tuple, forward_as_tuple #endif namespace std _GLIBCXX_VISIBILITY(default) @@ -286,8 +287,8 @@ namespace pmr construct(pair<_Tp1, _Tp2>* __p, _Up&& __x, _Vp&& __y) { this->construct(__p, piecewise_construct, - forward_as_tuple(std::forward<_Up>(__x)), - forward_as_tuple(std::forward<_Vp>(__y))); + std::forward_as_tuple(std::forward<_Up>(__x)), + std::forward_as_tuple(std::forward<_Vp>(__y))); } template @@ -296,8 +297,8 @@ namespace pmr construct(pair<_Tp1, _Tp2>* __p, const std::pair<_Up, _Vp>& __pr) { this->construct(__p, piecewise_construct, - forward_as_tuple(__pr.first), - forward_as_tuple(__pr.second)); + std::forward_as_tuple(__pr.first), + std::forward_as_tuple(__pr.second)); } template @@ -306,8 +307,8 @@ namespace pmr construct(pair<_Tp1, _Tp2>* __p, pair<_Up, _Vp>&& __pr) { this->construct(__p, piecewise_construct, - forward_as_tuple(std::forward<_Up>(__pr.first)), - forward_as_tuple(std::forward<_Vp>(__pr.second))); + std::forward_as_tuple(std::forward<_Up>(__pr.first)), + std::forward_as_tuple(std::forward<_Vp>(__pr.second))); } #else // make_obj_using_allocator template --UugvWAfsgieZRqgk--