Skip to content

[libc++] Improves _LIBCPP_HAS_NO_THREADS guards. #76624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions libcxx/include/barrier
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,16 @@ namespace std

*/

#include <__config>

#ifdef _LIBCPP_HAS_NO_THREADS
# error "<barrier> is not supported since libc++ has been configured without support for threads."
#endif

#include <__assert> // all public C++ headers provide the assertion handler
#include <__atomic/atomic_base.h>
#include <__atomic/memory_order.h>
#include <__availability>
#include <__config>
#include <__memory/unique_ptr.h>
#include <__thread/poll_with_backoff.h>
#include <__thread/timed_backoff_policy.h>
Expand All @@ -63,10 +68,6 @@ namespace std
# pragma GCC system_header
#endif

#ifdef _LIBCPP_HAS_NO_THREADS
# error "<barrier> is not supported since libc++ has been configured without support for threads."
#endif

_LIBCPP_PUSH_MACROS
#include <__undef_macros>

Expand Down
11 changes: 6 additions & 5 deletions libcxx/include/future
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,16 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;

*/

#include <__config>

#ifdef _LIBCPP_HAS_NO_THREADS
# error "<future> is not supported since libc++ has been configured without support for threads."
#endif

#include <__assert> // all public C++ headers provide the assertion handler
#include <__availability>
#include <__chrono/duration.h>
#include <__chrono/time_point.h>
#include <__config>
#include <__exception/exception_ptr.h>
#include <__memory/addressof.h>
#include <__memory/allocator.h>
Expand Down Expand Up @@ -396,10 +401,6 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
# pragma GCC system_header
#endif

#ifdef _LIBCPP_HAS_NO_THREADS
# error "<future> is not supported since libc++ has been configured without support for threads."
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

// enum class future_errc
Expand Down
11 changes: 6 additions & 5 deletions libcxx/include/latch
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,17 @@ namespace std

*/

#include <__config>

#ifdef _LIBCPP_HAS_NO_THREADS
# error "<latch> is not supported since libc++ has been configured without support for threads."
#endif

#include <__assert> // all public C++ headers provide the assertion handler
#include <__atomic/atomic_base.h>
#include <__atomic/atomic_sync.h>
#include <__atomic/memory_order.h>
#include <__availability>
#include <__config>
#include <cstddef>
#include <limits>
#include <version>
Expand All @@ -54,10 +59,6 @@ namespace std
# pragma GCC system_header
#endif

#ifdef _LIBCPP_HAS_NO_THREADS
# error "<latch> is not supported since libc++ has been configured without support for threads."
#endif

_LIBCPP_PUSH_MACROS
#include <__undef_macros>

Expand Down
11 changes: 6 additions & 5 deletions libcxx/include/semaphore
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,18 @@ using binary_semaphore = counting_semaphore<1>;

*/

#include <__config>

#ifdef _LIBCPP_HAS_NO_THREADS
# error "<semaphore> is not supported since libc++ has been configured without support for threads."
#endif

#include <__assert> // all public C++ headers provide the assertion handler
#include <__atomic/atomic_base.h>
#include <__atomic/atomic_sync.h>
#include <__atomic/memory_order.h>
#include <__availability>
#include <__chrono/time_point.h>
#include <__config>
#include <__thread/poll_with_backoff.h>
#include <__thread/timed_backoff_policy.h>
#include <__threading_support>
Expand All @@ -63,10 +68,6 @@ using binary_semaphore = counting_semaphore<1>;
# pragma GCC system_header
#endif

#ifdef _LIBCPP_HAS_NO_THREADS
# error "<semaphore> is not supported since libc++ has been configured without support for threads."
#endif

_LIBCPP_PUSH_MACROS
#include <__undef_macros>

Expand Down
11 changes: 6 additions & 5 deletions libcxx/include/shared_mutex
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,18 @@ template <class Mutex>

*/

#include <__config>

# ifdef _LIBCPP_HAS_NO_THREADS
# error "<shared_mutex> is not supported since libc++ has been configured without support for threads."
# endif

#include <__assert> // all public C++ headers provide the assertion handler
#include <__availability>
#include <__chrono/duration.h>
#include <__chrono/steady_clock.h>
#include <__chrono/time_point.h>
#include <__condition_variable/condition_variable.h>
#include <__config>
#include <__memory/addressof.h>
#include <__mutex/mutex.h>
#include <__mutex/tag_types.h>
Expand All @@ -147,10 +152,6 @@ _LIBCPP_PUSH_MACROS
# pragma GCC system_header
# endif

# ifdef _LIBCPP_HAS_NO_THREADS
# error "<shared_mutex> is not supported since libc++ has been configured without support for threads."
# endif

_LIBCPP_BEGIN_NAMESPACE_STD

struct _LIBCPP_EXPORTED_FROM_ABI __shared_mutex_base {
Expand Down
11 changes: 6 additions & 5 deletions libcxx/include/stop_token
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ namespace std {

*/

#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>

#ifdef _LIBCPP_HAS_NO_THREADS
# error "<stop_token> is not supported since libc++ has been configured without support for threads."
#endif

#include <__assert> // all public C++ headers provide the assertion handler
#include <__stop_token/stop_callback.h>
#include <__stop_token/stop_source.h>
#include <__stop_token/stop_token.h>
Expand All @@ -42,10 +47,6 @@ namespace std {
# pragma GCC system_header
#endif

#ifdef _LIBCPP_HAS_NO_THREADS
# error "<stop_token> is not supported since libc++ has been configured without support for threads."
#endif

#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <iosfwd>
#endif
Expand Down
11 changes: 6 additions & 5 deletions libcxx/include/thread
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,14 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);

*/

#include <__config>

#ifdef _LIBCPP_HAS_NO_THREADS
# error "<thread> is not supported since libc++ has been configured without support for threads."
#endif

#include <__assert> // all public C++ headers provide the assertion handler
#include <__availability>
#include <__config>
#include <__thread/formatter.h>
#include <__thread/jthread.h>
#include <__thread/this_thread.h>
Expand All @@ -105,10 +110,6 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
# pragma GCC system_header
#endif

#ifdef _LIBCPP_HAS_NO_THREADS
# error "<thread> is not supported since libc++ has been configured without support for threads."
#endif

#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
# include <cstddef>
# include <ctime>
Expand Down