From 0a2de6fb327dfa25a8f0feb48d0a5f824c344e89 Mon Sep 17 00:00:00 2001 From: Roman Koshelev Date: Sun, 1 Jan 2023 17:21:52 +0300 Subject: [PATCH] Fix errors setting of FMT_USE_FLOAT128 --- include/fmt/format.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 8f05c7d9..76fb60a3 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -786,12 +786,24 @@ using is_integer = !std::is_same::value>; #ifndef FMT_USE_FLOAT128 -# ifdef __SIZEOF_FLOAT128__ -# define FMT_USE_FLOAT128 1 -# else +# ifdef __clang__ +// Clang C++ emulates GCC, so it has to appear early. +# if defined(__has_include) +# if __has_include() +# define FMT_USE_FLOAT128 1 +# endif +# endif +# elif defined(__GNUC__) +// GNU C++: +# if defined(_GLIBCXX_USE_FLOAT128) && !defined(__STRICT_ANSI__) +# define FMT_USE_FLOAT128 1 +# endif +# endif +# ifndef FMT_USE_FLOAT128 # define FMT_USE_FLOAT128 0 # endif #endif + #if FMT_USE_FLOAT128 using float128 = __float128; #else