libstdc++: Move C++14 <chrono> components to new <bits/chrono.h> header

This moves the "classic" contents of <chrono> to a new header, so that
<future>, <thread> etc. can get use durations and clocks without
calendar types, time zones, and chrono I/O.

libstdc++-v3/ChangeLog:

	* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/std/chrono (duration, time_point, system_clock)
	(steady_clock, high_resolution_clock, chrono_literals, sys_time)
	(file_clock, file_time): Move to ...
	* include/bits/chrono.h: New file.
	* include/bits/atomic_futex.h: Include new header instead of
	<chrono>.
	* include/bits/atomic_timed_wait.h: Likewise.
	* include/bits/fs_fwd.h: Likewise.
	* include/bits/semaphore_base.h: Likewise.
	* include/bits/this_thread_sleep.h: Likewise.
	* include/bits/unique_lock.h: Likewise.
	* include/experimental/bits/fs_fwd.h: Likewise.
	* include/experimental/chrono: Likewise.
	* include/experimental/io_context: Likewise.
	* include/experimental/netfwd: Likewise.
	* include/experimental/timer: Likewise.
	* include/std/condition_variable: Likewise.
	* include/std/mutex: Likewise.
	* include/std/shared_mutex: Likewise.
This commit is contained in:
Jonathan Wakely 2021-10-07 14:51:18 +01:00
parent 1848fbf054
commit 7f78718b79
18 changed files with 1435 additions and 1376 deletions

View File

@ -117,6 +117,7 @@ bits_headers = \
${bits_srcdir}/c++0x_warning.h \
${bits_srcdir}/char_traits.h \
${bits_srcdir}/charconv.h \
${bits_srcdir}/chrono.h \
${bits_srcdir}/codecvt.h \
${bits_srcdir}/concept_check.h \
${bits_srcdir}/cow_string.h \

View File

@ -467,6 +467,7 @@ bits_headers = \
${bits_srcdir}/c++0x_warning.h \
${bits_srcdir}/char_traits.h \
${bits_srcdir}/charconv.h \
${bits_srcdir}/chrono.h \
${bits_srcdir}/codecvt.h \
${bits_srcdir}/concept_check.h \
${bits_srcdir}/cow_string.h \

View File

@ -32,13 +32,12 @@
#pragma GCC system_header
#include <bits/c++config.h>
#include <atomic>
#include <chrono>
#if ! (defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1)
#include <mutex>
#include <condition_variable>
#endif
#include <bits/chrono.h>
#ifndef _GLIBCXX_ALWAYS_INLINE
#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__))

View File

@ -37,8 +37,7 @@
#if __cpp_lib_atomic_wait
#include <bits/functional_hash.h>
#include <bits/this_thread_sleep.h>
#include <chrono>
#include <bits/chrono.h>
#ifdef _GLIBCXX_HAVE_LINUX_FUTEX
#include <exception> // std::terminate

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@
#include <system_error>
#include <cstdint>
#include <chrono>
#include <bits/chrono.h>
namespace std _GLIBCXX_VISIBILITY(default)
{

View File

@ -33,6 +33,7 @@
#pragma GCC system_header
#include <bits/atomic_base.h>
#include <bits/chrono.h>
#if __cpp_lib_atomic_wait
#include <bits/atomic_timed_wait.h>
#include <ext/numeric_traits.h>
@ -45,9 +46,6 @@
# include <semaphore.h> // sem_t, sem_init, sem_wait, sem_post etc.
#endif
#include <chrono>
#include <type_traits>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION

View File

@ -33,9 +33,7 @@
#pragma GCC system_header
#if __cplusplus >= 201103L
#include <bits/c++config.h>
#include <chrono> // std::chrono::*
#include <bits/chrono.h> // std::chrono::*
#ifdef _GLIBCXX_USE_NANOSLEEP
# include <cerrno> // errno, EINTR

View File

@ -36,7 +36,7 @@
# include <bits/c++0x_warning.h>
#else
#include <chrono>
#include <bits/chrono.h>
#include <bits/move.h> // for std::swap
#include <bits/std_mutex.h> // for std::defer_lock_t

View File

@ -36,7 +36,7 @@
#include <system_error>
#include <cstdint>
#include <chrono>
#include <bits/chrono.h>
namespace std _GLIBCXX_VISIBILITY(default)
{

View File

@ -38,7 +38,7 @@
#if __cplusplus >= 201402L
#include <chrono>
#include <bits/chrono.h> // Only the C++14 parts of <chrono>
#include <experimental/bits/lfts_config.h>
namespace std _GLIBCXX_VISIBILITY(default)

View File

@ -35,7 +35,6 @@
#if __cplusplus >= 201402L
#include <atomic>
#include <chrono>
#include <forward_list>
#include <functional>
#include <system_error>
@ -43,6 +42,7 @@
#include <vector>
#include <experimental/netfwd>
#include <experimental/executor>
#include <bits/chrono.h>
#if _GLIBCXX_HAVE_UNISTD_H
# include <unistd.h>
#endif

View File

@ -37,7 +37,7 @@
// #define __cpp_lib_experimental_net 201803
// #define __cpp_lib_experimental_net_extensible 201803
#include <chrono>
#include <bits/chrono.h>
namespace std _GLIBCXX_VISIBILITY(default)
{

View File

@ -34,7 +34,7 @@
#if __cplusplus >= 201402L
#include <chrono>
#include <bits/chrono.h>
#include <system_error>
#include <thread>
#include <experimental/netfwd>

File diff suppressed because it is too large Load Diff

View File

@ -35,8 +35,7 @@
# include <bits/c++0x_warning.h>
#else
#include <chrono>
#include <bits/chrono.h>
#include <bits/std_mutex.h>
#include <bits/unique_lock.h>
#include <bits/alloc_traits.h>

View File

@ -36,10 +36,10 @@
#else
#include <tuple>
#include <chrono>
#include <exception>
#include <type_traits>
#include <system_error>
#include <bits/chrono.h>
#include <bits/std_mutex.h>
#include <bits/unique_lock.h>
#if ! _GTHREAD_USE_MUTEX_TIMEDLOCK

View File

@ -33,7 +33,7 @@
#if __cplusplus >= 201402L
#include <chrono>
#include <bits/chrono.h>
#include <bits/functexcept.h>
#include <bits/move.h> // move, __exchange
#include <bits/std_mutex.h> // defer_lock_t