From e5d5e576a6385197c126a2a9761348704c90d796 Mon Sep 17 00:00:00 2001 From: Jonas Rahlf Date: Thu, 2 Sep 2021 22:22:03 +0200 Subject: [PATCH] use #if defined __has_include properly --- include/fast_float/ascii_number.h | 12 +++++++----- include/fast_float/fast_float.h | 18 +++++++++++------- include/fast_float/float_common.h | 18 +++++++++++------- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/include/fast_float/ascii_number.h b/include/fast_float/ascii_number.h index fbcc5f9..39c8d67 100644 --- a/include/fast_float/ascii_number.h +++ b/include/fast_float/ascii_number.h @@ -7,11 +7,13 @@ #include #include -#if defined(__has_include) && __has_include() -#include -#if defined(__cpp_lib_bit_cast) -#include -#endif +#if defined __has_include + #if __has_include() + #include + #if defined(__cpp_lib_bit_cast) + #include + #endif + #endif #endif #include "float_common.h" diff --git a/include/fast_float/fast_float.h b/include/fast_float/fast_float.h index ac18297..1efe917 100644 --- a/include/fast_float/fast_float.h +++ b/include/fast_float/fast_float.h @@ -4,13 +4,17 @@ #include -#if !defined(CXX20_CONSTEXPR) && defined(__has_include) && __has_include() -#include -#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() + #include + #if defined(__cpp_lib_bit_cast) + #undef CXX20_CONSTEXPR + #define CXX20_CONSTEXPR constexpr + #endif + #endif + #endif #endif namespace fast_float { diff --git a/include/fast_float/float_common.h b/include/fast_float/float_common.h index 1e10bf8..9ce20a8 100644 --- a/include/fast_float/float_common.h +++ b/include/fast_float/float_common.h @@ -73,13 +73,17 @@ #define fastfloat_really_inline inline __attribute__((always_inline)) #endif -#if !defined(CXX20_CONSTEXPR) && defined(__has_include) && __has_include() -#include -#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() + #include + #if defined(__cpp_lib_bit_cast) + #undef CXX20_CONSTEXPR + #define CXX20_CONSTEXPR constexpr + #endif + #endif + #endif #endif namespace fast_float {