Skip to content

Commit 84149a9

Browse files
committed
remove support for building without c++20 ranges
1 parent 2c2bbad commit 84149a9

11 files changed

Lines changed: 40 additions & 91 deletions

examples/benchmark/static_thread_pool_bulk_enqueue.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,43 +17,42 @@
1717
#include "./common.hpp"
1818
#include <exec/static_thread_pool.hpp>
1919

20-
#if !STDEXEC_NO_STDCPP_RANGES()
21-
# include <exec/sequence/ignore_all_values.hpp>
22-
# include <ranges>
20+
#include <exec/sequence/ignore_all_values.hpp>
21+
#include <ranges>
2322

2423
struct RunThread
2524
{
2625
void operator()(exec::static_thread_pool& pool,
2726
std::size_t total_scheds,
2827
std::size_t tid,
2928
std::barrier<>& barrier,
30-
# ifndef STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE
29+
#ifndef STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE
3130
std::span<char> buffer,
32-
# endif
31+
#endif
3332
std::atomic<bool>& stop,
3433
exec::numa_policy numa)
3534
{
3635
int numa_node = numa.thread_index_to_node(tid);
37-
numa.bind_to_node(numa_node);
36+
void(numa.bind_to_node(numa_node));
3837
while (true)
3938
{
4039
barrier.arrive_and_wait();
4140
if (stop.load())
4241
{
4342
break;
4443
}
45-
# ifndef STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE
44+
#ifndef STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE
4645
pmr::monotonic_buffer_resource rsrc{buffer.data(), buffer.size()};
4746
pmr::polymorphic_allocator<char> alloc{&rsrc};
4847
auto env = stdexec::prop{stdexec::get_allocator, alloc};
4948
auto [start, end] = exec::_pool_::even_share(total_scheds, tid, pool.available_parallelism());
5049
auto iterate = exec::schedule_all(pool, std::views::iota(start, end))
5150
| exec::ignore_all_values() | stdexec::write_env(env);
52-
# else
51+
#else
5352
auto [start, end] = exec::_pool_::even_share(total_scheds, tid, pool.available_parallelism());
5453
auto iterate = exec::schedule_all(pool, std::views::iota(start, end))
5554
| exec::ignore_all_values();
56-
# endif
55+
#endif
5756
stdexec::sync_wait(iterate);
5857
barrier.arrive_and_wait();
5958
}
@@ -74,6 +73,3 @@ auto main(int argc, char** argv) -> int
7473
exec::numa_policy numa{my_numa_distribution{}};
7574
my_main<exec::static_thread_pool, RunThread>(argc, argv, std::move(numa));
7675
}
77-
#else
78-
int main() {}
79-
#endif

examples/benchmark/static_thread_pool_bulk_enqueue_nested.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,23 @@
1717
#include "./common.hpp"
1818
#include <exec/static_thread_pool.hpp>
1919

20-
#if !STDEXEC_NO_STDCPP_RANGES()
21-
# include <exec/sequence/ignore_all_values.hpp>
22-
# include <ranges>
20+
#include <exec/sequence/ignore_all_values.hpp>
21+
#include <ranges>
2322

2423
struct RunThread
2524
{
2625
void operator()(exec::static_thread_pool& pool,
2726
std::size_t total_scheds,
2827
std::size_t tid,
2928
std::barrier<>& barrier,
30-
# ifndef STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE
29+
#ifndef STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE
3130
std::span<char> buffer,
32-
# endif
31+
#endif
3332
std::atomic<bool>& stop,
3433
exec::numa_policy numa)
3534
{
3635
int numa_node = numa.thread_index_to_node(tid);
37-
numa.bind_to_node(numa_node);
36+
void(numa.bind_to_node(numa_node));
3837
auto scheduler = pool.get_scheduler_on_thread(tid);
3938
while (true)
4039
{
@@ -43,17 +42,17 @@ struct RunThread
4342
{
4443
break;
4544
}
46-
# ifndef STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE
45+
#ifndef STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE
4746
pmr::monotonic_buffer_resource rsrc{buffer.data(), buffer.size()};
4847
pmr::polymorphic_allocator<char> alloc{&rsrc};
4948
auto env = stdexec::prop{stdexec::get_allocator, alloc};
5049
auto [start, end] = exec::_pool_::even_share(total_scheds, tid, pool.available_parallelism());
5150
auto iterate = exec::iterate(std::views::iota(start, end)) | exec::ignore_all_values()
5251
| stdexec::write_env(env);
53-
# else
52+
#else
5453
auto [start, end] = exec::_pool_::even_share(total_scheds, tid, pool.available_parallelism());
5554
auto iterate = exec::iterate(std::views::iota(start, end)) | exec::ignore_all_values();
56-
# endif
55+
#endif
5756
stdexec::sync_wait(stdexec::starts_on(scheduler, iterate));
5857
barrier.arrive_and_wait();
5958
}
@@ -64,6 +63,3 @@ auto main(int argc, char** argv) -> int
6463
{
6564
my_main<exec::static_thread_pool, RunThread>(argc, argv);
6665
}
67-
#else
68-
int main() {}
69-
#endif

examples/sudoku.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ void partial_solve(stdexec::parallel_scheduler sch,
336336
{
337337
if (1 << (potential - 1) & board.get()[first_potential_set].potential_set)
338338
{
339+
// NOLINTNEXTLINE(bugprone-unhandled-exception-at-new)
339340
std::unique_ptr<board_element[]> new_board(new board_element[BOARD_SIZE]);
340341
copy_board(board.get(), new_board.get());
341342
new_board.get()[first_potential_set].solved_element = potential;

include/exec/sequence/iterate.hpp

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,24 @@
1818

1919
#include "../../stdexec/__detail/__config.hpp"
2020

21-
#if !STDEXEC_NO_STDCPP_RANGES()
22-
23-
# include "../../stdexec/__detail/__concepts.hpp"
24-
# include "../../stdexec/__detail/__connect.hpp"
25-
# include "../../stdexec/__detail/__env.hpp"
26-
# include "../../stdexec/__detail/__execution_fwd.hpp"
27-
# include "../../stdexec/__detail/__operation_states.hpp"
28-
# include "../../stdexec/__detail/__optional.hpp"
29-
# include "../../stdexec/__detail/__receivers.hpp"
30-
# include "../../stdexec/__detail/__schedulers.hpp"
31-
# include "../../stdexec/__detail/__sender_concepts.hpp"
32-
33-
# include "../detail/basic_sequence.hpp"
34-
# include "../sender_for.hpp"
35-
# include "../sequence.hpp"
36-
# include "../sequence_senders.hpp"
37-
# include "../trampoline_scheduler.hpp"
38-
39-
# include <exception>
40-
# include <ranges>
21+
#include "../../stdexec/__detail/__concepts.hpp"
22+
#include "../../stdexec/__detail/__connect.hpp"
23+
#include "../../stdexec/__detail/__env.hpp"
24+
#include "../../stdexec/__detail/__execution_fwd.hpp"
25+
#include "../../stdexec/__detail/__operation_states.hpp"
26+
#include "../../stdexec/__detail/__optional.hpp"
27+
#include "../../stdexec/__detail/__receivers.hpp"
28+
#include "../../stdexec/__detail/__schedulers.hpp"
29+
#include "../../stdexec/__detail/__sender_concepts.hpp"
30+
31+
#include "../detail/basic_sequence.hpp"
32+
#include "../sender_for.hpp"
33+
#include "../sequence.hpp"
34+
#include "../sequence_senders.hpp"
35+
#include "../trampoline_scheduler.hpp"
36+
37+
#include <exception>
38+
#include <ranges>
4139

4240
namespace experimental::execution
4341
{
@@ -250,5 +248,3 @@ namespace experimental::execution
250248
} // namespace experimental::execution
251249

252250
namespace exec = experimental::execution;
253-
254-
#endif // !STDEXEC_NO_STDCPP_RANGES()

include/exec/static_thread_pool.hpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,11 @@ namespace experimental::execution
104104
return std::make_pair(static_cast<Shape>(begin), static_cast<Shape>(end));
105105
}
106106

107-
#if !STDEXEC_NO_STDCPP_RANGES()
108107
namespace schedule_all_
109108
{
110109
template <class Range>
111110
class sequence;
112111
} // namespace schedule_all_
113-
#endif
114112

115113
struct task_base
116114
{
@@ -267,7 +265,6 @@ namespace experimental::execution
267265
_static_thread_pool& pool_;
268266
};
269267

270-
#if !STDEXEC_NO_STDCPP_RANGES()
271268
struct _transform_iterate
272269
{
273270
template <class Range>
@@ -278,7 +275,6 @@ namespace experimental::execution
278275

279276
_static_thread_pool& pool_;
280277
};
281-
#endif
282278

283279
static auto _hardware_concurrency() noexcept -> unsigned int
284280
{
@@ -316,7 +312,6 @@ namespace experimental::execution
316312
}
317313
}
318314

319-
#if !STDEXEC_NO_STDCPP_RANGES()
320315
template <sender_for<exec::iterate_t> Sender, class Env>
321316
constexpr auto
322317
transform_sender(STDEXEC::set_value_t, Sender&& sndr, Env const & env) const noexcept
@@ -340,7 +335,6 @@ namespace experimental::execution
340335
STDEXEC::_WITH_ENVIRONMENT_(Env)>();
341336
}
342337
}
343-
#endif
344338
};
345339

346340
public:
@@ -1578,7 +1572,6 @@ namespace experimental::execution
15781572
{}
15791573
};
15801574

1581-
#if !STDEXEC_NO_STDCPP_RANGES()
15821575
namespace schedule_all_
15831576
{
15841577
template <class Rcvr>
@@ -1832,14 +1825,11 @@ namespace experimental::execution
18321825
} // namespace schedule_all_
18331826

18341827
struct schedule_all_t;
1835-
#endif
18361828
} // namespace _pool_
18371829

18381830
struct static_thread_pool : private _pool_::_static_thread_pool
18391831
{
1840-
#if !STDEXEC_NO_STDCPP_RANGES()
18411832
friend struct _pool_::schedule_all_t;
1842-
#endif
18431833
using task_base = _pool_::task_base;
18441834

18451835
static_thread_pool() = default;
@@ -1872,7 +1862,6 @@ namespace experimental::execution
18721862
using _pool_::_static_thread_pool::params;
18731863
};
18741864

1875-
#if !STDEXEC_NO_STDCPP_RANGES()
18761865
namespace _pool_
18771866
{
18781867
struct schedule_all_t
@@ -1887,7 +1876,6 @@ namespace experimental::execution
18871876
} // namespace _pool_
18881877

18891878
inline constexpr _pool_::schedule_all_t schedule_all{};
1890-
#endif
18911879

18921880
} // namespace experimental::execution
18931881

include/stdexec/__detail/__config.hpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -592,15 +592,6 @@ namespace STDEXEC
592592
# define STDEXEC_TSAN() 0
593593
#endif
594594

595-
// Before clang-16, clang did not like libstdc++'s ranges implementation
596-
#if __has_include(<ranges>) && \
597-
(defined(__cpp_lib_ranges) && __cpp_lib_ranges >= 201911L) && \
598-
(!STDEXEC_CLANG() || STDEXEC_CLANG_VERSION >= 1600 || defined(_LIBCPP_VERSION))
599-
# define STDEXEC_NO_STDCPP_RANGES() 0
600-
#else
601-
# define STDEXEC_NO_STDCPP_RANGES() 1
602-
#endif
603-
604595
#if __has_include(<memory_resource>) && \
605596
(defined(__cpp_lib_memory_resource) && __cpp_lib_memory_resource >= 201603L)
606597
# define STDEXEC_NO_STDCPP_MEMORY_RESOURCE() 0

test/exec/sequence/test_iterate.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@
1818
#include "exec/sequence/iterate.hpp"
1919
#include "stdexec/execution.hpp"
2020

21-
#if !STDEXEC_NO_STDCPP_RANGES()
22-
23-
# include <array>
24-
# include <catch2/catch_all.hpp>
25-
# include <numeric>
21+
#include <array>
22+
#include <catch2/catch_all.hpp>
23+
#include <numeric>
2624

2725
namespace
2826
{
@@ -143,5 +141,3 @@ namespace
143141
}
144142

145143
} // namespace
146-
147-
#endif // !STDEXEC_NO_STDCPP_RANGES()

test/exec/sequence/test_merge.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,9 @@
2828
#include "exec/trampoline_scheduler.hpp"
2929
#include "stdexec/__detail/__continues_on.hpp"
3030
#include "stdexec/__detail/__just.hpp"
31-
#include "stdexec/__detail/__meta.hpp"
3231
#include "stdexec/__detail/__upon_error.hpp"
33-
#include <atomic>
3432
#include <catch2/catch_all.hpp>
3533

36-
#include <mutex>
3734
#include <test_common/receivers.hpp>
3835
#include <test_common/schedulers.hpp>
3936
#include <test_common/senders.hpp>
@@ -141,7 +138,6 @@ namespace
141138
CHECK(count == 2);
142139
}
143140

144-
#if !STDEXEC_NO_STDCPP_RANGES()
145141
TEST_CASE("merge - merge sender merges all items", "[sequence_senders][merge][iterate]")
146142
{
147143
auto range = [](auto from, auto to)
@@ -231,7 +227,6 @@ namespace
231227
CHECK(total == 12570);
232228
CHECK(count == 60);
233229
}
234-
#endif
235230

236231
struct my_domain
237232
{

test/exec/sequence/test_merge_each.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@ namespace
194194
});
195195
};
196196

197-
#if !STDEXEC_NO_STDCPP_RANGES()
198-
199197
// a sequence of numbers from itoa()
200198
[[maybe_unused]]
201199
static constexpr auto range = [](auto from, auto to)
@@ -356,7 +354,7 @@ namespace
356354
}
357355

358356
// TODO - fix problem with stopping
359-
# if 0
357+
#if 0
360358
TEST_CASE(
361359
"merge_each - merge_each sender stops when a nested sequence fails",
362360
"[sequence_senders][static_thread_pool][merge_each][merge][iterate]") {
@@ -380,8 +378,6 @@ namespace
380378
CHECK(count == 20);
381379
CHECK(v.has_value() == false);
382380
}
383-
# endif // 0
384-
385-
#endif // !STDEXEC_NO_STDCPP_RANGES()
381+
#endif // 0
386382

387383
} // namespace

test/exec/sequence/test_merge_each_threaded.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,6 @@ namespace
198198
});
199199
};
200200

201-
#if !STDEXEC_NO_STDCPP_RANGES()
202-
203201
// a sequence of numbers from itoa()
204202
[[maybe_unused]]
205203
static constexpr auto range = [](auto from, auto to)
@@ -406,6 +404,4 @@ namespace
406404
CHECK(v.has_value() == false);
407405
}
408406

409-
#endif // !STDEXEC_NO_STDCPP_RANGES()
410-
411407
} // namespace

0 commit comments

Comments
 (0)