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 <iterator>
#if defined(__has_include) && __has_include(<version>)
#include <version>
#if defined(__cpp_lib_bit_cast)
#include <bit>
#endif
#if defined __has_include
#if __has_include(<version>)
#include <version>
#if defined(__cpp_lib_bit_cast)
#include <bit>
#endif
#endif
#endif
#include "float_common.h"

View File

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

View File

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