use #if defined __has_include properly

This commit is contained in:
Jonas Rahlf 2021-09-02 22:22:03 +02:00
parent b17eafd06f
commit e5d5e576a6
3 changed files with 29 additions and 19 deletions

View File

@ -7,11 +7,13 @@
#include <cstring> #include <cstring>
#include <iterator> #include <iterator>
#if defined(__has_include) && __has_include(<version>) #if defined __has_include
#include <version> #if __has_include(<version>)
#if defined(__cpp_lib_bit_cast) #include <version>
#include <bit> #if defined(__cpp_lib_bit_cast)
#endif #include <bit>
#endif
#endif
#endif #endif
#include "float_common.h" #include "float_common.h"

View File

@ -4,13 +4,17 @@
#include <system_error> #include <system_error>
#if !defined(CXX20_CONSTEXPR) && defined(__has_include) && __has_include(<version>) #if !defined(CXX20_CONSTEXPR)
#include <version> #define CXX20_CONSTEXPR
#if defined(__cpp_lib_bit_cast) #if defined __has_include
#define CXX20_CONSTEXPR constexpr #if __has_include(<version>)
#else #include <version>
#define CXX20_CONSTEXPR #if defined(__cpp_lib_bit_cast)
#endif #undef CXX20_CONSTEXPR
#define CXX20_CONSTEXPR constexpr
#endif
#endif
#endif
#endif #endif
namespace fast_float { namespace fast_float {

View File

@ -73,13 +73,17 @@
#define fastfloat_really_inline inline __attribute__((always_inline)) #define fastfloat_really_inline inline __attribute__((always_inline))
#endif #endif
#if !defined(CXX20_CONSTEXPR) && defined(__has_include) && __has_include(<version>) #if !defined(CXX20_CONSTEXPR)
#include <version> #define CXX20_CONSTEXPR
#if defined(__cpp_lib_bit_cast) #if defined __has_include
#define CXX20_CONSTEXPR constexpr #if __has_include(<version>)
#else #include <version>
#define CXX20_CONSTEXPR #if defined(__cpp_lib_bit_cast)
#endif #undef CXX20_CONSTEXPR
#define CXX20_CONSTEXPR constexpr
#endif
#endif
#endif
#endif #endif
namespace fast_float { namespace fast_float {