From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from arjuna.pair.com (arjuna.pair.com [209.68.5.131]) by sourceware.org (Postfix) with ESMTPS id 5F921386EC64; Thu, 29 Jul 2021 22:43:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5F921386EC64 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=bitrange.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bitrange.com Received: by arjuna.pair.com (Postfix, from userid 3006) id 1AFA48A701; Thu, 29 Jul 2021 18:43:09 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by arjuna.pair.com (Postfix) with ESMTP id 1A54C8A639; Thu, 29 Jul 2021 18:43:09 -0400 (EDT) Date: Thu, 29 Jul 2021 18:43:09 -0400 (EDT) From: Hans-Peter Nilsson X-X-Sender: hp@arjuna.pair.com To: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org cc: Jonathan Wakely Subject: [PATCH] fix breakage from "libstdc++: Remove unnecessary uses of " Message-ID: User-Agent: Alpine 2.20.16 (BSF 172 2016-09-29) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Thu, 29 Jul 2021 22:43:10 -0000 Commit r12-2534 was incomplete and (by inspection derived from an MMIX build) failing for targets without an insn for compare_and_swap for pointer-size objects, IOW for targets for which "ATOMIC_POINTER_LOCK_FREE != 2" is true: x/gcc/libstdc++-v3/src/c++17/memory_resource.cc: In member function 'std::pmr::memory_resource* std::pmr::{anonymous}::atomic_mem_res::exchange(std::pmr::memory_resource*)': x/gcc/libstdc++-v3/src/c++17/memory_resource.cc:140:21: error: 'exchange' is not a member of 'std' 140 | return std::exchange(val, r); | ^~~~~~~~ make[5]: *** [Makefile:577: memory_resource.lo] Error 1 make[5]: Leaving directory '/home/hp/tmp/newmmix-r12-2579-p3/gccobj/mmix/libstdc++-v3/src/c++17' This fix was derived from edits elsewhere in that patch. Tested mmix-knuth-mmixware, restoring build (together with target-reviving patches as MMIX is currently and at that commit broken for target-specific reasons). Ok to commit? libstdc++-v3/: * src/c++17/memory_resource.cc: Use __exchange instead of std::exchange. --- libstdc++-v3/src/c++17/memory_resource.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/src/c++17/memory_resource.cc b/libstdc++-v3/src/c++17/memory_resource.cc index 5dfc29fc0ec8..1ba79903f870 100644 --- a/libstdc++-v3/src/c++17/memory_resource.cc +++ b/libstdc++-v3/src/c++17/memory_resource.cc @@ -29,7 +29,7 @@ #include #if ATOMIC_POINTER_LOCK_FREE != 2 # include // std::mutex, std::lock_guard -# include // std::exchange +# include // std::__exchange #endif namespace std _GLIBCXX_VISIBILITY(default) @@ -117,7 +117,7 @@ namespace pmr memory_resource* exchange(memory_resource* r) { lock_guard lock(mx); - return std::exchange(val, r); + return std::__exchange(val, r); } }; #else @@ -137,7 +137,7 @@ namespace pmr memory_resource* exchange(memory_resource* r) { - return std::exchange(val, r); + return std::__exchange(val, r); } }; #endif // ATOMIC_POINTER_LOCK_FREE == 2 -- 2.20.1