Jonathan Wakely c17539d71b libstdc++: Fix src/c++20/tzdb.cc for non-constexpr std::mutex
Building libstdc++ reportedly fails for targets without lock-free
std::atomic<T*> which don't define __GTHREAD_MUTEX_INIT:

src/c++20/tzdb.cc:110:21: error: 'constinit' variable 'std::chrono::{anonymous}::list_mutex' does not have a constant initializer
src/c++20/tzdb.cc:110:21: error: call to non-'constexpr' function 'std::mutex::mutex()'

The solution implemented by this commit is to use a local static mutex
when it can't be constinit, so that it's constructed on first use.

With this change, we can also simplify the preprocessor logic for
defining USE_ATOMIC_SHARED_PTR. It now depends on the same conditions as
USE_ATOMIC_LIST_HEAD, so in theory we could have a single macro. Keeping
them separate would allow us to replace the use of atomic<shared_ptr<T>>
with a mutex if that performs better, without having to give up on the
lock-free cache for fast access to the list head.

libstdc++-v3/ChangeLog:

	* src/c++20/tzdb.cc (USE_ATOMIC_SHARED_PTR): Define consistently
	with USE_ATOMIC_LIST_HEAD.
	(list_mutex): Replace global object with function. Use local
	static object when std::mutex constructor isn't constexpr.

(cherry picked from commit 5dfdf0ae4dca44a4f572c346d322fd6244598190)
2023-07-18 10:05:48 +01:00
2023-04-27 00:21:18 +00:00
2023-07-18 00:20:49 +00:00
2023-04-27 00:21:18 +00:00
2023-05-10 00:22:50 +00:00
2023-05-07 00:21:31 +00:00
2023-06-04 00:20:45 +00:00
2023-06-29 00:21:39 +00:00
2023-06-29 00:21:39 +00:00
2023-07-04 00:21:20 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
S
Description
Yggdrasil port of the GNU Compiler Collection
Readme 978 MiB
Languages
C++ 33%
C 27.4%
Ada 13%
Go 7.1%
D 7%
Other 12.1%