From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 58FE33858D28; Tue, 11 Oct 2022 19:36:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 58FE33858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665517014; bh=2RTzSMBEnaS8I9lW5DdGOUSOOC3txwHojCm1hsZ5ifE=; h=From:To:Subject:Date:From; b=m78NngEPCTf75berDBFmNqlw/Niuf6TdXjAPV24ksYluPiTo+xAWOXnVV5iWqItIh Q+fPgf4tRECfIOCErWh1ovoxAtvJbn5FIQAz/sc9korwp/RK4oHbl19v7+GECspLYO xWF5HgjB1dO+UbKYDv8EEOmSZxXqlFrbnKdh/DY0= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-3237] libstdc++: Fix bootstrap for --disable-threads build [PR107221] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 9736a42e1fb8df30d72cf28594d9046bf50200c1 X-Git-Newrev: 23c3cbaed36f6d2f3a7a64f6ebda69329723514b Message-Id: <20221011193654.58FE33858D28@sourceware.org> Date: Tue, 11 Oct 2022 19:36:54 +0000 (GMT) List-Id: https://gcc.gnu.org/g:23c3cbaed36f6d2f3a7a64f6ebda69329723514b commit r13-3237-g23c3cbaed36f6d2f3a7a64f6ebda69329723514b Author: Jonathan Wakely Date: Tue Oct 11 20:19:08 2022 +0100 libstdc++: Fix bootstrap for --disable-threads build [PR107221] The __scoped_lock type should be used unqualified so that we always refer to pool::__scoped_lock, which might be the dummy fallback implementation. The __mutex and __scoped_lock types in already work fine without __GTHREADS being defined, but that header isn't included at all unless _GLIBCXX_HOSTED != 0. The fallback implementation should be used for ! _GLIBCXX_HOSTED instead of for !defined __GTHREADS. libstdc++-v3/ChangeLog: PR bootstrap/107221 * libsupc++/eh_alloc.cc (pool): Change preprocessor condition for using __mutex from __GTHREADS to _GLIBCXX_HOSTED. (pool::allocate): Remove namespace qualification to use pool::__scoped_lock instead of __gnu_cxx::__scoped_lock. Diff: --- libstdc++-v3/libsupc++/eh_alloc.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/libsupc++/eh_alloc.cc b/libstdc++-v3/libsupc++/eh_alloc.cc index 50dc37c0d9c..81b8a1548c6 100644 --- a/libstdc++-v3/libsupc++/eh_alloc.cc +++ b/libstdc++-v3/libsupc++/eh_alloc.cc @@ -145,7 +145,7 @@ namespace char data[] __attribute__((aligned)); }; -#ifdef __GTHREADS +#if _GLIBCXX_HOSTED // A single mutex controlling emergency allocations. __gnu_cxx::__mutex emergency_mutex; using __scoped_lock = __gnu_cxx::__scoped_lock; @@ -236,7 +236,7 @@ namespace void *pool::allocate (std::size_t size) noexcept { - __gnu_cxx::__scoped_lock sentry(emergency_mutex); + __scoped_lock sentry(emergency_mutex); // We need an additional size_t member plus the padding to // ensure proper alignment of data. size += offsetof (allocated_entry, data);