Skip to content

Commit 3111451

Browse files
authored
Merge pull request #3399 from eseiler/fix/charconv
fix(llvm): charconv on apple
2 parents 0c54481 + c578130 commit 3111451

4 files changed

Lines changed: 23 additions & 4 deletions

File tree

.clang-format

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,13 @@ IncludeCategories:
124124
Priority: 1
125125
SortPriority: 0
126126
CaseSensitive: false
127+
- Regex: '(<seqan3/std/charconv>)'
128+
Priority: 2
129+
SortPriority: 1
130+
CaseSensitive: false
127131
- Regex: '(<[[:alnum:]._]+>|<seqan3/std/.*>)'
128132
Priority: 2
129-
SortPriority: 0
133+
SortPriority: 2
130134
CaseSensitive: false
131135
- Regex: '<sdsl/'
132136
Priority: 3

include/seqan3/std/charconv

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,24 @@
1111
#ifndef SEQAN_STD_CHARCONV_SHIM
1212
#define SEQAN_STD_CHARCONV_SHIM
1313

14+
#include <version> // From C++20 onwards, all feature macros should be defined here.
15+
16+
// Workaround for llvm marking float charconv as unavailable
17+
#if defined(__APPLE__) && defined(_LIBCPP_VERSION)
18+
# ifdef _LIBCPP___CHARCONV_FROM_CHARS_FLOATING_POINT_H
19+
# warning This file needs to be included before any <charconv> include.
20+
# endif
21+
# if __has_include(<__configuration/availability.h>)
22+
# include <__configuration/availability.h>
23+
# undef _LIBCPP_AVAILABILITY_FROM_CHARS_FLOATING_POINT
24+
# define _LIBCPP_AVAILABILITY_FROM_CHARS_FLOATING_POINT /* nothing */
25+
# undef _LIBCPP_AVAILABILITY_HAS_FROM_CHARS_FLOATING_POINT
26+
# define _LIBCPP_AVAILABILITY_HAS_FROM_CHARS_FLOATING_POINT /* nothing */
27+
# endif
28+
#endif
29+
1430
#include <charconv>
1531
#include <utility> // __cpp_lib_to_chars may be defined here as currently documented.
16-
#include <version> // From C++20 onwards, all feature macros should be defined here.
1732

1833
/*!\defgroup std_charconv charconv
1934
* \ingroup std

test/unit/std/charconv_float_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
// make sure that including the std header does not produce any errors
88
// see https://github.com/seqan/seqan3/issues/2352
9+
#include <seqan3/std/charconv>
910
#include <charconv>
1011
#include <cmath>
1112
#include <concepts>
1213
#include <iostream>
1314
#include <limits>
14-
#include <seqan3/std/charconv>
1515

1616
// =============================================================================
1717
// std::from_chars for float, double and long double

test/unit/std/charconv_int_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
// make sure that including the std header does not produce any errors
88
// see https://github.com/seqan/seqan3/issues/2352
9+
#include <seqan3/std/charconv>
910
#include <charconv>
1011
#include <cmath>
1112
#include <concepts>
1213
#include <iostream>
1314
#include <limits>
14-
#include <seqan3/std/charconv>
1515

1616
// =============================================================================
1717
// std::from_chars for integral types

0 commit comments

Comments
 (0)