From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1725) id 62238393C903; Tue, 18 Aug 2020 18:35:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 62238393C903 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1597775739; bh=KsvNtWAHuQH21HqAUQ5RF3sFc/8/OP1HdNBgIEk4GeI=; h=From:To:Subject:Date:From; b=I0N72rrxunqglCdrJ7oaEzT3e0hXbglsnhYXYj6DyjLOOB0wJPx7ToHHfvyhl5Zba jUrlZPdaZ+XmwiRCQtGgR9SxkWTgysxK2t0py0SIcMNw8TS/AjTzzdKpqR/BTtMdzM IxfyDRm0gibUWp078CwNUxUBPSRApezo+2tYcs64= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: William Schmidt To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/users/wschmidt/heads/builtins3)] libstdc++: Fix to compile without gthreads X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/users/wschmidt/heads/builtins3 X-Git-Oldrev: 5bbb1f3000c57fd4d95969b30fa0e35be6d54ffb X-Git-Newrev: 35e5294c4b779f8fc24fdc86464f999867332995 Message-Id: <20200818183539.62238393C903@sourceware.org> Date: Tue, 18 Aug 2020 18:35:39 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Aug 2020 18:35:39 -0000 https://gcc.gnu.org/g:35e5294c4b779f8fc24fdc86464f999867332995 commit 35e5294c4b779f8fc24fdc86464f999867332995 Author: Jonathan Wakely Date: Tue Aug 11 16:16:21 2020 +0100 libstdc++: Fix to compile without gthreads libstdc++-v3/ChangeLog: * include/std/stop_token: Check _GLIBCXX_HAS_GTHREADS using #ifdef instead of #if. (stop_token::_S_yield()): Check _GLIBCXX_HAS_GTHREADS before using __gthread_yield. Diff: --- libstdc++-v3/include/std/stop_token | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/include/std/stop_token b/libstdc++-v3/include/std/stop_token index 847d12f7454..ccec6fab15c 100644 --- a/libstdc++-v3/include/std/stop_token +++ b/libstdc++-v3/include/std/stop_token @@ -105,7 +105,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { #if defined __i386__ || defined __x86_64__ __builtin_ia32_pause(); -#elif defined _GLIBCXX_USE_SCHED_YIELD +#elif defined _GLIBCXX_HAS_GTHREADS && defined _GLIBCXX_USE_SCHED_YIELD __gthread_yield(); #endif } @@ -162,7 +162,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION std::atomic _M_owners{1}; std::atomic _M_value{_S_ssrc_counter_inc}; _Stop_cb* _M_head = nullptr; -#if _GLIBCXX_HAS_GTHREADS +#ifdef _GLIBCXX_HAS_GTHREADS __gthread_t _M_requester; #endif @@ -237,7 +237,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } while (!_M_try_lock_and_stop(__old)); -#if _GLIBCXX_HAS_GTHREADS +#ifdef _GLIBCXX_HAS_GTHREADS _M_requester = __gthread_self(); #endif @@ -266,7 +266,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (!__destroyed) { __cb->_M_destroyed = nullptr; -#if _GLIBCXX_HAS_GTHREADS +#ifdef _GLIBCXX_HAS_GTHREADS // synchronize with destructor of stop_callback that owns *__cb __cb->_M_done.release(); #endif @@ -343,7 +343,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Callback is not in the list, so must have been removed by a call to // _M_request_stop. -#if _GLIBCXX_HAS_GTHREADS +#ifdef _GLIBCXX_HAS_GTHREADS // Despite appearances there is no data race on _M_requester. The only // write to it happens before the callback is removed from the list, // and removing it from the list happens before this read.