Skip to content

Commit 75f00fe

Browse files
authored
Merge pull request #76370 from swiftlang/susmonteiro/cxx-span-benchmarks
[cxx-interop] Fix check to include std::span
2 parents e5abfcb + 2b90ea3 commit 75f00fe

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

benchmark/utils/CxxTests/CxxStdlibPerformance.h

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,25 @@
55
#include <set>
66

77
// FIXME swift-ci linux tests do not support std::span
8-
#if defined(__has_include) && __has_include(<span>)
8+
#ifndef __linux__
99
#include <span>
10-
#define SPAN_DEFINED 1
11-
#else
12-
#define SPAN_DEFINED 0
13-
#endif
10+
#endif // __linux__
1411

1512
static const size_t spanSize = 50000;
1613

1714
using VectorOfU32 = std::vector<uint32_t>;
1815
using SetOfU32 = std::set<uint32_t>;
19-
#if SPAN_DEFINED
16+
#ifndef __linux__
2017
using ArrayOfU32 = uint32_t[spanSize];
2118
using SpanOfU32 = std::span<uint32_t>;
22-
#endif
19+
#endif // __linux__
2320

2421
static inline VectorOfU32 vec;
2522
static inline SetOfU32 set;
26-
#if SPAN_DEFINED
23+
#ifndef __linux__
2724
static inline ArrayOfU32 array;
2825
static inline SpanOfU32 span;
29-
#endif
26+
#endif // __linux__
3027

3128
inline void initVector(size_t size) {
3229
if (!vec.empty()) {
@@ -47,7 +44,7 @@ inline void initSet(size_t size) {
4744
}
4845
}
4946

50-
#if SPAN_DEFINED
47+
#ifndef __linux__
5148
inline void initSpan() {
5249
if (!span.empty()) {
5350
return;
@@ -57,7 +54,7 @@ inline void initSpan() {
5754
}
5855
span = SpanOfU32(array);
5956
}
60-
#endif
57+
#endif // __linux__
6158

6259
inline VectorOfU32 makeVector32(size_t size) {
6360
initVector(size);

0 commit comments

Comments
 (0)