From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1698) id 7D8CB385840D; Wed, 24 Apr 2024 18:38:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7D8CB385840D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713983903; bh=dggOsKgiBcaiT21YKPUwFw2ZBtRwexZhNyUD5iB2J8s=; h=From:To:Subject:Date:From; b=GVuycwjiIYvszss3GItPnKn4019FibBM+1ZtRpDdWpzOhK0jVJnK/J6VaK2r4/0Hx Ru6OFaxHO/o22+3Bx7HixCsbMhCl7ovGFJfdF3mPpH+NnyTAcW/fS2fzJHiWGAOFMj NUZq9xYQCLMnkNXvQgYus1XD5gv7IIq7YbAuAkJ4= 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 r11-11356] 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-11 X-Git-Oldrev: 61e6a6d2aa139781de9b6b94206f6a526c0addaa X-Git-Newrev: 17212f5912d8f57b3757633444ae64c9831aa8f7 Message-Id: <20240424183823.7D8CB385840D@sourceware.org> Date: Wed, 24 Apr 2024 18:38:23 +0000 (GMT) List-Id: https://gcc.gnu.org/g:17212f5912d8f57b3757633444ae64c9831aa8f7 commit r11-11356-g17212f5912d8f57b3757633444ae64c9831aa8f7 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 0b3bb7950b1..394d7209711 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.