[libc++] Guard PSTL headers with >= C++17 (#108234)
Otherwise we fail to build with modules in C++03 mode once we migrate to a single top-level module, because those headers get pulled in but they don't compile as C++03.
This commit is contained in:
@@ -19,16 +19,20 @@
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if defined(_LIBCPP_PSTL_BACKEND_SERIAL)
|
||||
# include <__pstl/backends/default.h>
|
||||
# include <__pstl/backends/serial.h>
|
||||
#elif defined(_LIBCPP_PSTL_BACKEND_STD_THREAD)
|
||||
# include <__pstl/backends/default.h>
|
||||
# include <__pstl/backends/std_thread.h>
|
||||
#elif defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH)
|
||||
# include <__pstl/backends/default.h>
|
||||
# include <__pstl/backends/libdispatch.h>
|
||||
#endif
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
# if defined(_LIBCPP_PSTL_BACKEND_SERIAL)
|
||||
# include <__pstl/backends/default.h>
|
||||
# include <__pstl/backends/serial.h>
|
||||
# elif defined(_LIBCPP_PSTL_BACKEND_STD_THREAD)
|
||||
# include <__pstl/backends/default.h>
|
||||
# include <__pstl/backends/std_thread.h>
|
||||
# elif defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH)
|
||||
# include <__pstl/backends/default.h>
|
||||
# include <__pstl/backends/libdispatch.h>
|
||||
# endif
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@ _LIBCPP_PUSH_MACROS
|
||||
// the user.
|
||||
//
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace __pstl {
|
||||
|
||||
@@ -50,18 +52,18 @@ struct __libdispatch_backend_tag;
|
||||
struct __serial_backend_tag;
|
||||
struct __std_thread_backend_tag;
|
||||
|
||||
#if defined(_LIBCPP_PSTL_BACKEND_SERIAL)
|
||||
# if defined(_LIBCPP_PSTL_BACKEND_SERIAL)
|
||||
using __current_configuration = __backend_configuration<__serial_backend_tag, __default_backend_tag>;
|
||||
#elif defined(_LIBCPP_PSTL_BACKEND_STD_THREAD)
|
||||
# elif defined(_LIBCPP_PSTL_BACKEND_STD_THREAD)
|
||||
using __current_configuration = __backend_configuration<__std_thread_backend_tag, __default_backend_tag>;
|
||||
#elif defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH)
|
||||
# elif defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH)
|
||||
using __current_configuration = __backend_configuration<__libdispatch_backend_tag, __default_backend_tag>;
|
||||
#else
|
||||
# else
|
||||
|
||||
// ...New vendors can add parallel backends here...
|
||||
|
||||
# error "Invalid PSTL backend configuration"
|
||||
#endif
|
||||
# error "Invalid PSTL backend configuration"
|
||||
# endif
|
||||
|
||||
template <class _Backend, class _ExecutionPolicy>
|
||||
struct __find_if;
|
||||
@@ -296,6 +298,8 @@ struct __reduce;
|
||||
} // namespace __pstl
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___PSTL_BACKEND_FWD_H
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace __pstl {
|
||||
|
||||
@@ -498,6 +500,8 @@ struct __rotate_copy<__default_backend_tag, _ExecutionPolicy> {
|
||||
} // namespace __pstl
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___PSTL_BACKENDS_DEFAULT_H
|
||||
|
||||
@@ -44,6 +44,8 @@
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace __pstl {
|
||||
|
||||
@@ -140,15 +142,15 @@ struct __cpu_traits<__libdispatch_backend_tag> {
|
||||
|
||||
unique_ptr<__merge_range_t[], decltype(__destroy)> __ranges(
|
||||
[&]() -> __merge_range_t* {
|
||||
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
|
||||
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
|
||||
try {
|
||||
#endif
|
||||
# endif
|
||||
return std::allocator<__merge_range_t>().allocate(__n_ranges);
|
||||
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
|
||||
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
|
||||
} catch (const std::bad_alloc&) {
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
}(),
|
||||
__destroy);
|
||||
|
||||
@@ -392,6 +394,8 @@ struct __fill<__libdispatch_backend_tag, _ExecutionPolicy>
|
||||
} // namespace __pstl
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___PSTL_BACKENDS_LIBDISPATCH_H
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace __pstl {
|
||||
|
||||
@@ -176,6 +178,8 @@ struct __transform_reduce_binary<__serial_backend_tag, _ExecutionPolicy> {
|
||||
} // namespace __pstl
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___PSTL_BACKENDS_SERIAL_H
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace __pstl {
|
||||
|
||||
@@ -131,6 +133,8 @@ struct __fill<__std_thread_backend_tag, _ExecutionPolicy>
|
||||
} // namespace __pstl
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___PSTL_BACKENDS_STD_THREAD_H
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace __pstl {
|
||||
|
||||
@@ -94,6 +96,8 @@ struct __cpu_parallel_any_of {
|
||||
} // namespace __pstl
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___PSTL_CPU_ALGOS_ANY_OF_H
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace __pstl {
|
||||
|
||||
@@ -81,6 +83,8 @@ struct __cpu_traits;
|
||||
} // namespace __pstl
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___PSTL_CPU_ALGOS_CPU_TRAITS_H
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace __pstl {
|
||||
|
||||
@@ -63,4 +65,6 @@ struct __cpu_parallel_fill {
|
||||
} // namespace __pstl
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif // _LIBCPP___PSTL_CPU_ALGOS_FILL_H
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace __pstl {
|
||||
|
||||
@@ -132,6 +134,8 @@ struct __cpu_parallel_find_if {
|
||||
} // namespace __pstl
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___PSTL_CPU_ALGOS_FIND_IF_H
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace __pstl {
|
||||
|
||||
@@ -63,4 +65,6 @@ struct __cpu_parallel_for_each {
|
||||
} // namespace __pstl
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif // _LIBCPP___PSTL_CPU_ALGOS_FOR_EACH_H
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace __pstl {
|
||||
|
||||
@@ -80,6 +82,8 @@ struct __cpu_parallel_merge {
|
||||
} // namespace __pstl
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___PSTL_CPU_ALGOS_MERGE_H
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace __pstl {
|
||||
|
||||
@@ -44,4 +46,6 @@ struct __cpu_parallel_stable_sort {
|
||||
} // namespace __pstl
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif // _LIBCPP___PSTL_CPU_ALGOS_STABLE_SORT_H
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace __pstl {
|
||||
|
||||
@@ -148,6 +150,8 @@ struct __cpu_parallel_transform_binary {
|
||||
} // namespace __pstl
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___PSTL_CPU_ALGOS_TRANSFORM_H
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace __pstl {
|
||||
|
||||
@@ -211,6 +213,8 @@ struct __cpu_parallel_transform_reduce {
|
||||
} // namespace __pstl
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___PSTL_CPU_ALGOS_TRANSFORM_REDUCE_H
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace __pstl {
|
||||
|
||||
@@ -61,6 +63,8 @@ using __dispatch = typename __find_first_implemented<_Algorithm, _BackendConfigu
|
||||
} // namespace __pstl
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___PSTL_DISPATCH_H
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace __pstl {
|
||||
|
||||
@@ -52,6 +54,8 @@ _LIBCPP_HIDE_FROM_ABI auto __handle_exception(_Args&&... __args) {
|
||||
} // namespace __pstl
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___PSTL_HANDLE_EXCEPTION_H
|
||||
|
||||
Reference in New Issue
Block a user