Skip to content

[libc++] Remove unnecessary #ifdef guards around PSTL implementation details #95268

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
Jun 12, 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
23 changes: 12 additions & 11 deletions libcxx/include/__algorithm/pstl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,6 @@
#define _LIBCPP___ALGORITHM_PSTL_H

#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)
# pragma GCC system_header
Expand All @@ -31,6 +20,18 @@ _LIBCPP_PUSH_MACROS

#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

template <class _ExecutionPolicy,
Expand Down
25 changes: 13 additions & 12 deletions libcxx/include/__numeric/pstl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,6 @@
#define _LIBCPP___NUMERIC_PSTL_H

#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)
# pragma GCC system_header
Expand All @@ -32,6 +20,19 @@ _LIBCPP_PUSH_MACROS

#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

template <class _ExecutionPolicy,
Expand Down
4 changes: 0 additions & 4 deletions libcxx/include/__pstl/backends/default.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
_LIBCPP_PUSH_MACROS
#include <__undef_macros>

#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

_LIBCPP_BEGIN_NAMESPACE_STD
namespace __pstl {

Expand Down Expand Up @@ -500,8 +498,6 @@ struct __rotate_copy<__default_backend_tag, _ExecutionPolicy> {
} // namespace __pstl
_LIBCPP_END_NAMESPACE_STD

#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

_LIBCPP_POP_MACROS

#endif // _LIBCPP___PSTL_BACKENDS_DEFAULT_H
12 changes: 4 additions & 8 deletions libcxx/include/__pstl/backends/libdispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
_LIBCPP_PUSH_MACROS
#include <__undef_macros>

#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

_LIBCPP_BEGIN_NAMESPACE_STD
namespace __pstl {

Expand Down Expand Up @@ -142,15 +140,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);

Expand Down Expand Up @@ -394,8 +392,6 @@ struct __fill<__libdispatch_backend_tag, _ExecutionPolicy>
} // namespace __pstl
_LIBCPP_END_NAMESPACE_STD

#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

_LIBCPP_POP_MACROS

#endif // _LIBCPP___PSTL_BACKENDS_LIBDISPATCH_H
6 changes: 1 addition & 5 deletions libcxx/include/__pstl/backends/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@
# pragma GCC system_header
#endif

#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

_LIBCPP_PUSH_MACROS
# include <__undef_macros>
#include <__undef_macros>

_LIBCPP_BEGIN_NAMESPACE_STD
namespace __pstl {
Expand Down Expand Up @@ -180,6 +178,4 @@ _LIBCPP_END_NAMESPACE_STD

_LIBCPP_POP_MACROS

#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && && _LIBCPP_STD_VER >= 17

#endif // _LIBCPP___PSTL_BACKENDS_SERIAL_H
4 changes: 0 additions & 4 deletions libcxx/include/__pstl/backends/std_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
_LIBCPP_PUSH_MACROS
#include <__undef_macros>

#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

_LIBCPP_BEGIN_NAMESPACE_STD
namespace __pstl {

Expand Down Expand Up @@ -133,8 +131,6 @@ struct __fill<__std_thread_backend_tag, _ExecutionPolicy>
} // namespace __pstl
_LIBCPP_END_NAMESPACE_STD

#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && && _LIBCPP_STD_VER >= 17

_LIBCPP_POP_MACROS

#endif // _LIBCPP___PSTL_BACKENDS_STD_THREAD_H
6 changes: 1 addition & 5 deletions libcxx/include/__pstl/cpu_algos/any_of.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
#include <cstdint>
#include <optional>

#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

_LIBCPP_PUSH_MACROS
# include <__undef_macros>
#include <__undef_macros>

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down Expand Up @@ -96,6 +94,4 @@ _LIBCPP_END_NAMESPACE_STD

_LIBCPP_POP_MACROS

#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

#endif // _LIBCPP___PSTL_CPU_ALGOS_ANY_OF_H
4 changes: 0 additions & 4 deletions libcxx/include/__pstl/cpu_algos/fill.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
# pragma GCC system_header
#endif

#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

_LIBCPP_BEGIN_NAMESPACE_STD

template <class _Index, class _DifferenceType, class _Tp>
Expand Down Expand Up @@ -63,6 +61,4 @@ struct __cpu_parallel_fill {

_LIBCPP_END_NAMESPACE_STD

#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

#endif // _LIBCPP___PSTL_CPU_ALGOS_FILL_H
6 changes: 1 addition & 5 deletions libcxx/include/__pstl/cpu_algos/find_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@
# pragma GCC system_header
#endif

#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

_LIBCPP_PUSH_MACROS
# include <__undef_macros>
#include <__undef_macros>

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down Expand Up @@ -134,6 +132,4 @@ _LIBCPP_END_NAMESPACE_STD

_LIBCPP_POP_MACROS

#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

#endif // _LIBCPP___PSTL_CPU_ALGOS_FIND_IF_H
4 changes: 0 additions & 4 deletions libcxx/include/__pstl/cpu_algos/for_each.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
# pragma GCC system_header
#endif

#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

_LIBCPP_BEGIN_NAMESPACE_STD

template <class _Iterator, class _DifferenceType, class _Function>
Expand Down Expand Up @@ -63,6 +61,4 @@ struct __cpu_parallel_for_each {

_LIBCPP_END_NAMESPACE_STD

#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

#endif // _LIBCPP___PSTL_CPU_ALGOS_FOR_EACH_H
6 changes: 1 addition & 5 deletions libcxx/include/__pstl/cpu_algos/merge.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
# pragma GCC system_header
#endif

#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

_LIBCPP_PUSH_MACROS
# include <__undef_macros>
#include <__undef_macros>

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down Expand Up @@ -82,6 +80,4 @@ _LIBCPP_END_NAMESPACE_STD

_LIBCPP_POP_MACROS

#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

#endif // _LIBCPP___PSTL_CPU_ALGOS_MERGE_H
4 changes: 0 additions & 4 deletions libcxx/include/__pstl/cpu_algos/stable_sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
# pragma GCC system_header
#endif

#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

_LIBCPP_BEGIN_NAMESPACE_STD

template <class _Backend, class _RawExecutionPolicy>
Expand All @@ -44,6 +42,4 @@ struct __cpu_parallel_stable_sort {

_LIBCPP_END_NAMESPACE_STD

#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

#endif // _LIBCPP___PSTL_CPU_ALGOS_STABLE_SORT_H
6 changes: 1 addition & 5 deletions libcxx/include/__pstl/cpu_algos/transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@
# pragma GCC system_header
#endif

#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

_LIBCPP_PUSH_MACROS
# include <__undef_macros>
#include <__undef_macros>

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down Expand Up @@ -150,6 +148,4 @@ _LIBCPP_END_NAMESPACE_STD

_LIBCPP_POP_MACROS

#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

#endif // _LIBCPP___PSTL_CPU_ALGOS_TRANSFORM_H
4 changes: 0 additions & 4 deletions libcxx/include/__pstl/cpu_algos/transform_reduce.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
_LIBCPP_PUSH_MACROS
#include <__undef_macros>

#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

_LIBCPP_BEGIN_NAMESPACE_STD

template <typename _Backend,
Expand Down Expand Up @@ -211,8 +209,6 @@ struct __cpu_parallel_transform_reduce {

_LIBCPP_END_NAMESPACE_STD

#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17

_LIBCPP_POP_MACROS

#endif // _LIBCPP___PSTL_CPU_ALGOS_TRANSFORM_REDUCE_H
Loading