From 21d5a7dfdac96afb9d0fbe7137ffbf5c212ccaf6 Mon Sep 17 00:00:00 2001 From: Artem Chikin Date: Tue, 10 Sep 2024 10:18:29 -0700 Subject: [PATCH] Revert "[cxx-interop] Fix check to include std::span" This reverts commit 2b90ea3bda4ccd1694ee2ceefd4f4877260c58e3. --- .../utils/CxxTests/CxxStdlibPerformance.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/benchmark/utils/CxxTests/CxxStdlibPerformance.h b/benchmark/utils/CxxTests/CxxStdlibPerformance.h index e5eed5c7747..311659cb6f6 100644 --- a/benchmark/utils/CxxTests/CxxStdlibPerformance.h +++ b/benchmark/utils/CxxTests/CxxStdlibPerformance.h @@ -5,25 +5,28 @@ #include // FIXME swift-ci linux tests do not support std::span -#ifndef __linux__ +#if defined(__has_include) && __has_include() #include -#endif // __linux__ +#define SPAN_DEFINED 1 +#else +#define SPAN_DEFINED 0 +#endif static const size_t spanSize = 50000; using VectorOfU32 = std::vector; using SetOfU32 = std::set; -#ifndef __linux__ +#if SPAN_DEFINED using ArrayOfU32 = uint32_t[spanSize]; using SpanOfU32 = std::span; -#endif // __linux__ +#endif static inline VectorOfU32 vec; static inline SetOfU32 set; -#ifndef __linux__ +#if SPAN_DEFINED static inline ArrayOfU32 array; static inline SpanOfU32 span; -#endif // __linux__ +#endif inline void initVector(size_t size) { if (!vec.empty()) { @@ -44,7 +47,7 @@ inline void initSet(size_t size) { } } -#ifndef __linux__ +#if SPAN_DEFINED inline void initSpan() { if (!span.empty()) { return; @@ -54,7 +57,7 @@ inline void initSpan() { } span = SpanOfU32(array); } -#endif // __linux__ +#endif inline VectorOfU32 makeVector32(size_t size) { initVector(size);