[libc++] Remove unnecessary #ifdef guards around PSTL implementation details (#95268)
We want the PSTL implementation details to be available regardless of the Standard mode or whether the experimental PSTL is enabled. This patch guards the inclusion of the PSTL to the top-level headers that define the public API in `__numeric` and `__algorithm`.
This commit is contained in:
parent
148417bfaa
commit
acb896a344
@ -10,17 +10,6 @@
|
|||||||
#define _LIBCPP___ALGORITHM_PSTL_H
|
#define _LIBCPP___ALGORITHM_PSTL_H
|
||||||
|
|
||||||
#include <__config>
|
#include <__config>
|
||||||
#include <__functional/operations.h>
|
|
||||||
#include <__iterator/cpp17_iterator_concepts.h>
|
|
||||||
#include <__iterator/iterator_traits.h>
|
|
||||||
#include <__pstl/backend.h>
|
|
||||||
#include <__pstl/dispatch.h>
|
|
||||||
#include <__pstl/handle_exception.h>
|
|
||||||
#include <__type_traits/enable_if.h>
|
|
||||||
#include <__type_traits/is_execution_policy.h>
|
|
||||||
#include <__type_traits/remove_cvref.h>
|
|
||||||
#include <__utility/forward.h>
|
|
||||||
#include <__utility/move.h>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
# pragma GCC system_header
|
# pragma GCC system_header
|
||||||
@ -31,6 +20,18 @@ _LIBCPP_PUSH_MACROS
|
|||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
||||||
|
|
||||||
|
# include <__functional/operations.h>
|
||||||
|
# include <__iterator/cpp17_iterator_concepts.h>
|
||||||
|
# include <__iterator/iterator_traits.h>
|
||||||
|
# include <__pstl/backend.h>
|
||||||
|
# include <__pstl/dispatch.h>
|
||||||
|
# include <__pstl/handle_exception.h>
|
||||||
|
# include <__type_traits/enable_if.h>
|
||||||
|
# include <__type_traits/is_execution_policy.h>
|
||||||
|
# include <__type_traits/remove_cvref.h>
|
||||||
|
# include <__utility/forward.h>
|
||||||
|
# include <__utility/move.h>
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _ExecutionPolicy,
|
template <class _ExecutionPolicy,
|
||||||
|
@ -10,18 +10,6 @@
|
|||||||
#define _LIBCPP___NUMERIC_PSTL_H
|
#define _LIBCPP___NUMERIC_PSTL_H
|
||||||
|
|
||||||
#include <__config>
|
#include <__config>
|
||||||
#include <__functional/identity.h>
|
|
||||||
#include <__functional/operations.h>
|
|
||||||
#include <__iterator/cpp17_iterator_concepts.h>
|
|
||||||
#include <__iterator/iterator_traits.h>
|
|
||||||
#include <__pstl/backend.h>
|
|
||||||
#include <__pstl/dispatch.h>
|
|
||||||
#include <__pstl/handle_exception.h>
|
|
||||||
#include <__type_traits/enable_if.h>
|
|
||||||
#include <__type_traits/is_execution_policy.h>
|
|
||||||
#include <__type_traits/remove_cvref.h>
|
|
||||||
#include <__utility/forward.h>
|
|
||||||
#include <__utility/move.h>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
# pragma GCC system_header
|
# pragma GCC system_header
|
||||||
@ -32,6 +20,19 @@ _LIBCPP_PUSH_MACROS
|
|||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
||||||
|
|
||||||
|
# include <__functional/identity.h>
|
||||||
|
# include <__functional/operations.h>
|
||||||
|
# include <__iterator/cpp17_iterator_concepts.h>
|
||||||
|
# include <__iterator/iterator_traits.h>
|
||||||
|
# include <__pstl/backend.h>
|
||||||
|
# include <__pstl/dispatch.h>
|
||||||
|
# include <__pstl/handle_exception.h>
|
||||||
|
# include <__type_traits/enable_if.h>
|
||||||
|
# include <__type_traits/is_execution_policy.h>
|
||||||
|
# include <__type_traits/remove_cvref.h>
|
||||||
|
# include <__utility/forward.h>
|
||||||
|
# include <__utility/move.h>
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _ExecutionPolicy,
|
template <class _ExecutionPolicy,
|
||||||
|
@ -33,8 +33,6 @@
|
|||||||
_LIBCPP_PUSH_MACROS
|
_LIBCPP_PUSH_MACROS
|
||||||
#include <__undef_macros>
|
#include <__undef_macros>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
namespace __pstl {
|
namespace __pstl {
|
||||||
|
|
||||||
@ -500,8 +498,6 @@ struct __rotate_copy<__default_backend_tag, _ExecutionPolicy> {
|
|||||||
} // namespace __pstl
|
} // namespace __pstl
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
_LIBCPP_POP_MACROS
|
_LIBCPP_POP_MACROS
|
||||||
|
|
||||||
#endif // _LIBCPP___PSTL_BACKENDS_DEFAULT_H
|
#endif // _LIBCPP___PSTL_BACKENDS_DEFAULT_H
|
||||||
|
@ -44,8 +44,6 @@
|
|||||||
_LIBCPP_PUSH_MACROS
|
_LIBCPP_PUSH_MACROS
|
||||||
#include <__undef_macros>
|
#include <__undef_macros>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
namespace __pstl {
|
namespace __pstl {
|
||||||
|
|
||||||
@ -142,15 +140,15 @@ struct __cpu_traits<__libdispatch_backend_tag> {
|
|||||||
|
|
||||||
unique_ptr<__merge_range_t[], decltype(__destroy)> __ranges(
|
unique_ptr<__merge_range_t[], decltype(__destroy)> __ranges(
|
||||||
[&]() -> __merge_range_t* {
|
[&]() -> __merge_range_t* {
|
||||||
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
|
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
|
||||||
try {
|
try {
|
||||||
# endif
|
#endif
|
||||||
return std::allocator<__merge_range_t>().allocate(__n_ranges);
|
return std::allocator<__merge_range_t>().allocate(__n_ranges);
|
||||||
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
|
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
|
||||||
} catch (const std::bad_alloc&) {
|
} catch (const std::bad_alloc&) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
}(),
|
}(),
|
||||||
__destroy);
|
__destroy);
|
||||||
|
|
||||||
@ -394,8 +392,6 @@ struct __fill<__libdispatch_backend_tag, _ExecutionPolicy>
|
|||||||
} // namespace __pstl
|
} // namespace __pstl
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
_LIBCPP_POP_MACROS
|
_LIBCPP_POP_MACROS
|
||||||
|
|
||||||
#endif // _LIBCPP___PSTL_BACKENDS_LIBDISPATCH_H
|
#endif // _LIBCPP___PSTL_BACKENDS_LIBDISPATCH_H
|
||||||
|
@ -27,10 +27,8 @@
|
|||||||
# pragma GCC system_header
|
# pragma GCC system_header
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
_LIBCPP_PUSH_MACROS
|
_LIBCPP_PUSH_MACROS
|
||||||
# include <__undef_macros>
|
#include <__undef_macros>
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
namespace __pstl {
|
namespace __pstl {
|
||||||
@ -180,6 +178,4 @@ _LIBCPP_END_NAMESPACE_STD
|
|||||||
|
|
||||||
_LIBCPP_POP_MACROS
|
_LIBCPP_POP_MACROS
|
||||||
|
|
||||||
#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
#endif // _LIBCPP___PSTL_BACKENDS_SERIAL_H
|
#endif // _LIBCPP___PSTL_BACKENDS_SERIAL_H
|
||||||
|
@ -32,8 +32,6 @@
|
|||||||
_LIBCPP_PUSH_MACROS
|
_LIBCPP_PUSH_MACROS
|
||||||
#include <__undef_macros>
|
#include <__undef_macros>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
namespace __pstl {
|
namespace __pstl {
|
||||||
|
|
||||||
@ -133,8 +131,6 @@ struct __fill<__std_thread_backend_tag, _ExecutionPolicy>
|
|||||||
} // namespace __pstl
|
} // namespace __pstl
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
_LIBCPP_POP_MACROS
|
_LIBCPP_POP_MACROS
|
||||||
|
|
||||||
#endif // _LIBCPP___PSTL_BACKENDS_STD_THREAD_H
|
#endif // _LIBCPP___PSTL_BACKENDS_STD_THREAD_H
|
||||||
|
@ -23,10 +23,8 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
_LIBCPP_PUSH_MACROS
|
_LIBCPP_PUSH_MACROS
|
||||||
# include <__undef_macros>
|
#include <__undef_macros>
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
namespace __pstl {
|
namespace __pstl {
|
||||||
@ -98,6 +96,4 @@ _LIBCPP_END_NAMESPACE_STD
|
|||||||
|
|
||||||
_LIBCPP_POP_MACROS
|
_LIBCPP_POP_MACROS
|
||||||
|
|
||||||
#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
#endif // _LIBCPP___PSTL_CPU_ALGOS_ANY_OF_H
|
#endif // _LIBCPP___PSTL_CPU_ALGOS_ANY_OF_H
|
||||||
|
@ -23,8 +23,6 @@
|
|||||||
# pragma GCC system_header
|
# pragma GCC system_header
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
namespace __pstl {
|
namespace __pstl {
|
||||||
|
|
||||||
@ -65,6 +63,4 @@ struct __cpu_parallel_fill {
|
|||||||
} // namespace __pstl
|
} // namespace __pstl
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
#endif // _LIBCPP___PSTL_CPU_ALGOS_FILL_H
|
#endif // _LIBCPP___PSTL_CPU_ALGOS_FILL_H
|
||||||
|
@ -28,10 +28,8 @@
|
|||||||
# pragma GCC system_header
|
# pragma GCC system_header
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
_LIBCPP_PUSH_MACROS
|
_LIBCPP_PUSH_MACROS
|
||||||
# include <__undef_macros>
|
#include <__undef_macros>
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
namespace __pstl {
|
namespace __pstl {
|
||||||
@ -136,6 +134,4 @@ _LIBCPP_END_NAMESPACE_STD
|
|||||||
|
|
||||||
_LIBCPP_POP_MACROS
|
_LIBCPP_POP_MACROS
|
||||||
|
|
||||||
#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
#endif // _LIBCPP___PSTL_CPU_ALGOS_FIND_IF_H
|
#endif // _LIBCPP___PSTL_CPU_ALGOS_FIND_IF_H
|
||||||
|
@ -23,8 +23,6 @@
|
|||||||
# pragma GCC system_header
|
# pragma GCC system_header
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
namespace __pstl {
|
namespace __pstl {
|
||||||
|
|
||||||
@ -65,6 +63,4 @@ struct __cpu_parallel_for_each {
|
|||||||
} // namespace __pstl
|
} // namespace __pstl
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
#endif // _LIBCPP___PSTL_CPU_ALGOS_FOR_EACH_H
|
#endif // _LIBCPP___PSTL_CPU_ALGOS_FOR_EACH_H
|
||||||
|
@ -23,10 +23,8 @@
|
|||||||
# pragma GCC system_header
|
# pragma GCC system_header
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
_LIBCPP_PUSH_MACROS
|
_LIBCPP_PUSH_MACROS
|
||||||
# include <__undef_macros>
|
#include <__undef_macros>
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
namespace __pstl {
|
namespace __pstl {
|
||||||
@ -84,6 +82,4 @@ _LIBCPP_END_NAMESPACE_STD
|
|||||||
|
|
||||||
_LIBCPP_POP_MACROS
|
_LIBCPP_POP_MACROS
|
||||||
|
|
||||||
#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
#endif // _LIBCPP___PSTL_CPU_ALGOS_MERGE_H
|
#endif // _LIBCPP___PSTL_CPU_ALGOS_MERGE_H
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
# pragma GCC system_header
|
# pragma GCC system_header
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
namespace __pstl {
|
namespace __pstl {
|
||||||
|
|
||||||
@ -46,6 +44,4 @@ struct __cpu_parallel_stable_sort {
|
|||||||
} // namespace __pstl
|
} // namespace __pstl
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
#endif // _LIBCPP___PSTL_CPU_ALGOS_STABLE_SORT_H
|
#endif // _LIBCPP___PSTL_CPU_ALGOS_STABLE_SORT_H
|
||||||
|
@ -24,10 +24,8 @@
|
|||||||
# pragma GCC system_header
|
# pragma GCC system_header
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
_LIBCPP_PUSH_MACROS
|
_LIBCPP_PUSH_MACROS
|
||||||
# include <__undef_macros>
|
#include <__undef_macros>
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
namespace __pstl {
|
namespace __pstl {
|
||||||
@ -152,6 +150,4 @@ _LIBCPP_END_NAMESPACE_STD
|
|||||||
|
|
||||||
_LIBCPP_POP_MACROS
|
_LIBCPP_POP_MACROS
|
||||||
|
|
||||||
#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
#endif // _LIBCPP___PSTL_CPU_ALGOS_TRANSFORM_H
|
#endif // _LIBCPP___PSTL_CPU_ALGOS_TRANSFORM_H
|
||||||
|
@ -31,8 +31,6 @@
|
|||||||
_LIBCPP_PUSH_MACROS
|
_LIBCPP_PUSH_MACROS
|
||||||
#include <__undef_macros>
|
#include <__undef_macros>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
namespace __pstl {
|
namespace __pstl {
|
||||||
|
|
||||||
@ -213,8 +211,6 @@ struct __cpu_parallel_transform_reduce {
|
|||||||
} // namespace __pstl
|
} // namespace __pstl
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
|
|
||||||
|
|
||||||
_LIBCPP_POP_MACROS
|
_LIBCPP_POP_MACROS
|
||||||
|
|
||||||
#endif // _LIBCPP___PSTL_CPU_ALGOS_TRANSFORM_REDUCE_H
|
#endif // _LIBCPP___PSTL_CPU_ALGOS_TRANSFORM_REDUCE_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user