From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1698) id CBEF73858D37; Thu, 18 Apr 2024 14:41:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CBEF73858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713451269; bh=G5MUwm2P5iY6nj7xGuAluvB+ISsmBb7FrLj7aj+NGOg=; h=From:To:Subject:Date:From; b=v0CuBURb14HIGhngOeTQq8Va769QMul3ulm4nhVSSTOkJIcEs7ys1vw6DlTmNeIk0 jnkPzg5/T0ENO8xsWkW92/m5s2gVziixt86I9eOFgZpkUgX8cN0tdtb4YD++B2xdrO 2HN1yrzEi21wHheG+7R8GjkalWKccW0FtS/aEGjs= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Iain D Sandoe To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-10336] libstdc++, Darwin: Limit recursive mutex init to OS versions needing it. X-Act-Checkin: gcc X-Git-Author: Iain Sandoe X-Git-Refname: refs/heads/releases/gcc-12 X-Git-Oldrev: e2403376c286692927f61708adec67a91ef64691 X-Git-Newrev: ab4ff3e9fe881ef85a8156f2be528872c6a2fdfc Message-Id: <20240418144109.CBEF73858D37@sourceware.org> Date: Thu, 18 Apr 2024 14:41:09 +0000 (GMT) List-Id: https://gcc.gnu.org/g:ab4ff3e9fe881ef85a8156f2be528872c6a2fdfc commit r12-10336-gab4ff3e9fe881ef85a8156f2be528872c6a2fdfc Author: Iain Sandoe Date: Sat Dec 3 17:09:35 2022 +0000 libstdc++, Darwin: Limit recursive mutex init to OS versions needing it. The problem described in pr 51906 was fixed in the next OS release. Limit the workaround to systems that need it. Signed-off-by: Iain Sandoe libstdc++-v3/ChangeLog: * config/os/bsd/darwin/os_defines.h (_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC): Limit use of this macro to OS versions that need it. (cherry picked from commit a044c9d25972b22c6b4c8ec27f2de5fd622573cc) Diff: --- libstdc++-v3/config/os/bsd/darwin/os_defines.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/config/os/bsd/darwin/os_defines.h b/libstdc++-v3/config/os/bsd/darwin/os_defines.h index a8b6d4fa324..f56f31ad2f5 100644 --- a/libstdc++-v3/config/os/bsd/darwin/os_defines.h +++ b/libstdc++-v3/config/os/bsd/darwin/os_defines.h @@ -39,8 +39,12 @@ // -flat_namespace to work around the way that it doesn't. #define _GLIBCXX_WEAK_DEFINITION __attribute__ ((weak)) -// Static initializer macro is buggy in darwin, see libstdc++/51906 +#if defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) \ + && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1080) +// Static initializer macro is absent for Darwin < 11 and buggy in Darwin 11, +// see libstdc++/51906. Fixed in Darwin 12 (OS X 10.8). #define _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC +#endif // Configure checks for nanosleep fail on Darwin, but nanosleep and // sched_yield are always available, so use them.