From d6ce31aadc1241d68bbfd5857fbc3af10ed267f5 Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Sat, 28 Feb 2026 18:51:22 +0100 Subject: [PATCH] fix(llvm): charconv on apple This is a nasty workaround. Ideally, there should be a seqan::stl::from_chars. --- .clang-format | 4 ++++ include/sharg/std/charconv | 17 ++++++++++++++++- test/unit/std/charconv_float_test.cpp | 6 ++---- test/unit/std/charconv_int_test.cpp | 6 ++---- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/.clang-format b/.clang-format index f202a07c..6547d167 100644 --- a/.clang-format +++ b/.clang-format @@ -86,8 +86,12 @@ IncludeBlocks: Regroup IncludeCategories: - Regex: '()' + Priority: 2 + SortPriority: 1 - Regex: '(<[[:alnum:]._]+>|)' Priority: 2 + SortPriority: 2 - 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 std * \ingroup misc diff --git a/test/unit/std/charconv_float_test.cpp b/test/unit/std/charconv_float_test.cpp index 6addf21c..fd99256e 100644 --- a/test/unit/std/charconv_float_test.cpp +++ b/test/unit/std/charconv_float_test.cpp @@ -4,15 +4,13 @@ #include -#if __has_include() // make sure that including the std header does not produce any errors // see https://github.com/seqan/seqan3/issues/2352 -# include -#endif // __has_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 6cb632ed..186d347f 100644 --- a/test/unit/std/charconv_int_test.cpp +++ b/test/unit/std/charconv_int_test.cpp @@ -4,15 +4,13 @@ #include -#if __has_include() // make sure that including the std header does not produce any errors // see https://github.com/seqan/seqan3/issues/2352 -# include -#endif // __has_include() +#include +#include #include #include #include -#include // ============================================================================= // std::from_chars for integral types