Skip to content

Commit e5d5e57

Browse files
committed
use #if defined __has_include properly
1 parent b17eafd commit e5d5e57

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed

include/fast_float/ascii_number.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
#include <cstring>
88
#include <iterator>
99

10-
#if defined(__has_include) && __has_include(<version>)
11-
#include <version>
12-
#if defined(__cpp_lib_bit_cast)
13-
#include <bit>
14-
#endif
10+
#if defined __has_include
11+
#if __has_include(<version>)
12+
#include <version>
13+
#if defined(__cpp_lib_bit_cast)
14+
#include <bit>
15+
#endif
16+
#endif
1517
#endif
1618

1719
#include "float_common.h"

include/fast_float/fast_float.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44

55
#include <system_error>
66

7-
#if !defined(CXX20_CONSTEXPR) && defined(__has_include) && __has_include(<version>)
8-
#include <version>
9-
#if defined(__cpp_lib_bit_cast)
10-
#define CXX20_CONSTEXPR constexpr
11-
#else
12-
#define CXX20_CONSTEXPR
13-
#endif
7+
#if !defined(CXX20_CONSTEXPR)
8+
#define CXX20_CONSTEXPR
9+
#if defined __has_include
10+
#if __has_include(<version>)
11+
#include <version>
12+
#if defined(__cpp_lib_bit_cast)
13+
#undef CXX20_CONSTEXPR
14+
#define CXX20_CONSTEXPR constexpr
15+
#endif
16+
#endif
17+
#endif
1418
#endif
1519

1620
namespace fast_float {

include/fast_float/float_common.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,17 @@
7373
#define fastfloat_really_inline inline __attribute__((always_inline))
7474
#endif
7575

76-
#if !defined(CXX20_CONSTEXPR) && defined(__has_include) && __has_include(<version>)
77-
#include <version>
78-
#if defined(__cpp_lib_bit_cast)
79-
#define CXX20_CONSTEXPR constexpr
80-
#else
81-
#define CXX20_CONSTEXPR
82-
#endif
76+
#if !defined(CXX20_CONSTEXPR)
77+
#define CXX20_CONSTEXPR
78+
#if defined __has_include
79+
#if __has_include(<version>)
80+
#include <version>
81+
#if defined(__cpp_lib_bit_cast)
82+
#undef CXX20_CONSTEXPR
83+
#define CXX20_CONSTEXPR constexpr
84+
#endif
85+
#endif
86+
#endif
8387
#endif
8488

8589
namespace fast_float {

0 commit comments

Comments
 (0)