From 87989a5f090d5575ff13784d6aadafb0f2a71264 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 31 Jan 2020 18:09:25 +0100 Subject: [PATCH] Again with this non-conformance stupidity! --- server/TracyPrint.hpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/server/TracyPrint.hpp b/server/TracyPrint.hpp index 082a0fe9..21497943 100644 --- a/server/TracyPrint.hpp +++ b/server/TracyPrint.hpp @@ -2,9 +2,17 @@ #define __TRACYPRINT_HPP__ #if ( defined _MSC_VER && _MSVC_LANG >= 201703L ) || __cplusplus >= 201703L -# include -# include +# if __has_include() && __has_include() +# include +# include +# else +# define NO_CHARCONV +# endif #else +# define NO_CHARCONV +#endif + +#ifdef NO_CHARCONV # include #endif @@ -63,7 +71,7 @@ static tracy_force_inline void RealToStringInteger( char* buf, char* end ) template static inline char* PrintFloat( char* begin, char* end, T value, int precision ) { -#if ( defined _MSC_VER && _MSVC_LANG >= 201703L ) || __cplusplus >= 201703L +#ifndef NO_CHARCONV return std::to_chars( begin, end, value, std::chars_format::fixed, precision ).ptr; #else return begin + sprintf( begin, "%.*f", precision, value ); @@ -73,14 +81,14 @@ static inline char* PrintFloat( char* begin, char* end, T value, int precision ) template static inline char* PrintFloat( char* begin, char* end, T value ) { -#if ( defined _MSC_VER && _MSVC_LANG >= 201703L ) || __cplusplus >= 201703L +#ifndef NO_CHARCONV return std::to_chars( begin, end, value, std::chars_format::fixed ).ptr; #else return begin + sprintf( begin, "%f", value ); #endif } -#if ( defined _MSC_VER && _MSVC_LANG >= 201703L ) || __cplusplus >= 201703L +#ifndef NO_CHARCONV template static inline const char* RealToString( T val ) {