[libc++] Granularize chrono includes

Reviewed By: Quuxplusone, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D120141
This commit is contained in:
Nikolas Klauser 2022-02-23 23:05:22 +01:00
parent 8f780ba362
commit 489637e66d
19 changed files with 42 additions and 22 deletions

View File

@ -53,10 +53,10 @@ API Changes
``<filesystem>`` header. The associated macro
``_LIBCPP_DEPRECATED_EXPERIMENTAL_FILESYSTEM`` has also been removed.
- Transitive includes of ``<algorithm>`` have been removed. If you see compiler errors
related to missing declarations inside namespace ``std`` when updating libc++,
you are probably missing ``#include <algorithm>`` in a file where you use algorithms.
- Some libc++ headers no longer transitively include all of ``<algorithm>``and ``<chrono>``.
If, after updating libc++, you see compiler errors related to missing declarations in
namespace ``std``, it might be because one of your source files now needs to
``#include <algorithm>`` and/or ``#include <chrono>``.
ABI Changes
-----------

View File

@ -11,6 +11,7 @@
#define _LIBCPP___FILESYSTEM_DIRECTORY_ENTRY_H
#include <__availability>
#include <__chrono/time_point.h>
#include <__config>
#include <__errc>
#include <__filesystem/file_status.h>
@ -21,7 +22,6 @@
#include <__filesystem/path.h>
#include <__filesystem/perms.h>
#include <__utility/unreachable.h>
#include <chrono>
#include <cstdint>
#include <cstdlib>
#include <iosfwd>

View File

@ -11,8 +11,9 @@
#define _LIBCPP___FILESYSTEM_FILE_TIME_TYPE_H
#include <__availability>
#include <__chrono/file_clock.h>
#include <__chrono/time_point.h>
#include <__config>
#include <chrono>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header

View File

@ -11,6 +11,7 @@
#define _LIBCPP___FILESYSTEM_OPERATIONS_H
#include <__availability>
#include <__chrono/time_point.h>
#include <__config>
#include <__filesystem/copy_options.h>
#include <__filesystem/file_status.h>
@ -20,7 +21,6 @@
#include <__filesystem/perm_options.h>
#include <__filesystem/perms.h>
#include <__filesystem/space_info.h>
#include <chrono>
#include <cstdint>
#include <system_error>

View File

@ -10,9 +10,12 @@
#ifndef _LIBCPP___MUTEX_BASE
#define _LIBCPP___MUTEX_BASE
#include <__chrono/duration.h>
#include <__chrono/steady_clock.h>
#include <__chrono/system_clock.h>
#include <__chrono/time_point.h>
#include <__config>
#include <__threading_support>
#include <chrono>
#include <ratio>
#include <system_error>
#include <time.h>

View File

@ -10,8 +10,12 @@
#define _LIBCPP___THREAD_POLL_WITH_BACKOFF_H
#include <__availability>
#include <__chrono/duration.h>
#include <__chrono/high_resolution_clock.h>
#include <__chrono/steady_clock.h>
#include <__chrono/time_point.h>
#include <__config>
#include <chrono>
#include <__filesystem/file_time_type.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header

View File

@ -13,8 +13,8 @@
#ifndef _LIBCPP_HAS_NO_THREADS
#include <__threading_support>
#include <chrono>
# include <__chrono/duration.h>
# include <__threading_support>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header

View File

@ -11,9 +11,10 @@
#define _LIBCPP_THREADING_SUPPORT
#include <__availability>
#include <__chrono/convert_to_timespec.h>
#include <__chrono/duration.h>
#include <__config>
#include <__thread/poll_with_backoff.h>
#include <chrono>
#include <errno.h>
#include <iosfwd>
#include <limits>

View File

@ -519,6 +519,7 @@ template <class T>
*/
#include <__availability>
#include <__chrono/duration.h>
#include <__config>
#include <__thread/poll_with_backoff.h>
#include <__thread/timed_backoff_policy.h>

View File

@ -363,12 +363,13 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
#include <__assert>
#include <__availability>
#include <__chrono/duration.h>
#include <__chrono/time_point.h>
#include <__config>
#include <__memory/allocator_arg_t.h>
#include <__memory/uses_allocator.h>
#include <__utility/auto_cast.h>
#include <__utility/forward.h>
#include <chrono>
#include <exception>
#include <memory>
#include <mutex>
@ -376,6 +377,8 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
#include <thread>
#include <version>
#include <chrono> // TODO: Remove unused header
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif

View File

@ -46,6 +46,7 @@ using binary_semaphore = counting_semaphore<1>;
*/
#include <__availability>
#include <__chrono/time_point.h>
#include <__config>
#include <__thread/timed_backoff_policy.h>
#include <__threading_support>

View File

@ -89,7 +89,6 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#include <__thread/timed_backoff_policy.h>
#include <__threading_support>
#include <__utility/forward.h>
#include <chrono>
#include <cstddef>
#include <functional>
#include <iosfwd>

View File

@ -20,10 +20,11 @@
// async(launch policy, F&& f, Args&&... args);
#include <future>
#include <atomic>
#include <memory>
#include <cassert>
#include <chrono>
#include <future>
#include <memory>
#include "test_macros.h"

View File

@ -15,8 +15,9 @@
// void wait() const;
#include <future>
#include <cassert>
#include <chrono>
#include <future>
#include "make_test_thread.h"
#include "test_macros.h"

View File

@ -17,8 +17,9 @@
// future_status
// wait_for(const chrono::duration<Rep, Period>& rel_time) const;
#include <future>
#include <cassert>
#include <chrono>
#include <future>
#include "make_test_thread.h"
#include "test_macros.h"

View File

@ -17,9 +17,10 @@
// future_status
// wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
#include <future>
#include <atomic>
#include <cassert>
#include <chrono>
#include <future>
#include "make_test_thread.h"
#include "test_macros.h"

View File

@ -15,8 +15,9 @@
// void wait() const;
#include <future>
#include <cassert>
#include <chrono>
#include <future>
#include "make_test_thread.h"
#include "test_macros.h"

View File

@ -19,8 +19,9 @@
// future_status
// wait_for(const chrono::duration<Rep, Period>& rel_time) const;
#include <future>
#include <cassert>
#include <chrono>
#include <future>
#include "make_test_thread.h"
#include "test_macros.h"

View File

@ -17,9 +17,10 @@
// future_status
// wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
#include <future>
#include <atomic>
#include <cassert>
#include <chrono>
#include <future>
#include "make_test_thread.h"
#include "test_macros.h"