From c57813043ee2084d6887338fbb09879a4e485cf8 Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Sat, 28 Feb 2026 18:47:17 +0100 Subject: [PATCH] fix(llvm): charconv on apple This is a nasty workaround. Ideally, there should be a seqan::stl::from_chars. --- .clang-format | 6 +++++- include/seqan3/std/charconv | 17 ++++++++++++++++- test/unit/std/charconv_float_test.cpp | 2 +- test/unit/std/charconv_int_test.cpp | 2 +- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.clang-format b/.clang-format index f27353b3ef..5a57292110 100644 --- a/.clang-format +++ b/.clang-format @@ -124,9 +124,13 @@ IncludeCategories: Priority: 1 SortPriority: 0 CaseSensitive: false + - Regex: '()' + Priority: 2 + SortPriority: 1 + CaseSensitive: false - Regex: '(<[[:alnum:]._]+>|)' Priority: 2 - SortPriority: 0 + SortPriority: 2 CaseSensitive: false - Regex: ' // From C++20 onwards, all feature macros should be defined here. + +// Workaround for llvm marking float charconv as unavailable +#if defined(__APPLE__) && defined(_LIBCPP_VERSION) +# ifdef _LIBCPP___CHARCONV_FROM_CHARS_FLOATING_POINT_H +# warning This file needs to be included before any include. +# endif +# if __has_include(<__configuration/availability.h>) +# include <__configuration/availability.h> +# undef _LIBCPP_AVAILABILITY_FROM_CHARS_FLOATING_POINT +# define _LIBCPP_AVAILABILITY_FROM_CHARS_FLOATING_POINT /* nothing */ +# undef _LIBCPP_AVAILABILITY_HAS_FROM_CHARS_FLOATING_POINT +# define _LIBCPP_AVAILABILITY_HAS_FROM_CHARS_FLOATING_POINT /* nothing */ +# endif +#endif + #include #include // __cpp_lib_to_chars may be defined here as currently documented. -#include // From C++20 onwards, all feature macros should be defined here. /*!\defgroup std_charconv charconv * \ingroup std diff --git a/test/unit/std/charconv_float_test.cpp b/test/unit/std/charconv_float_test.cpp index 8396afe0f4..53411e49f2 100644 --- a/test/unit/std/charconv_float_test.cpp +++ b/test/unit/std/charconv_float_test.cpp @@ -6,12 +6,12 @@ // make sure that including the std header does not produce any errors // see https://github.com/seqan/seqan3/issues/2352 +#include #include #include #include #include #include -#include // ============================================================================= // std::from_chars for float, double and long double diff --git a/test/unit/std/charconv_int_test.cpp b/test/unit/std/charconv_int_test.cpp index ba9a02ddb3..99c9d75fd6 100644 --- a/test/unit/std/charconv_int_test.cpp +++ b/test/unit/std/charconv_int_test.cpp @@ -6,12 +6,12 @@ // make sure that including the std header does not produce any errors // see https://github.com/seqan/seqan3/issues/2352 +#include #include #include #include #include #include -#include // ============================================================================= // std::from_chars for integral types