From 1d9b75b1c21de16454063ad86da9e906980f9b49 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Tue, 15 Dec 2015 15:51:29 +0800 Subject: [PATCH] fix std numeric conversions errors for GCC 5.1 --- include/nana/config.hpp | 18 +++++++++++++++--- include/nana/deploy.hpp | 13 +++++++++---- source/deploy.cpp | 7 +++++++ 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/include/nana/config.hpp b/include/nana/config.hpp index e97c70f6..0fead174 100644 --- a/include/nana/config.hpp +++ b/include/nana/config.hpp @@ -81,24 +81,36 @@ #define STD_CODECVT_NOT_SUPPORTED #endif + #if (__GNUC__ == 4) #if ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 1)) #define STD_THREAD_NOT_SUPPORTED - + //boost.thread is preferred //but if USE_github_com_meganz_mingw_std_threads is enabled, //boost.thread will be replaced with meganz's mingw-std-threads. // https://github.com/meganz/mingw-std-threads //#define USE_github_com_meganz_mingw_std_threads + + #define STD_TO_STRING_NOT_SUPPORTED #endif - + + //_GLIBCXX_HAVE_BROKEN_VSWPRINTF is enabled to turn off all numeric conversions on MinGW(GCC 4) + #if defined(NANA_MINGW) - //It's a known issue under MinGW + //It's a knonwn issue under MinGW #define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED #endif #if ((__GNUC_MINOR__ < 8) || defined(NANA_MINGW)) #define STD_TO_STRING_NOT_SUPPORTED + #define STD_TO_WSTRING_NOT_SUPPORTED + #endif + #elif (__GNUC__ == 5) + #if defined(NANA_MINGW) + //The _GLIBCXX_HAVE_BROKEN_VSWPRINTF only applies to wide string + //It's a knonwn issue under MinGW + #define STD_TO_WSTRING_NOT_SUPPORTED #endif #endif #endif diff --git a/include/nana/deploy.hpp b/include/nana/deploy.hpp index 30d87935..802e6335 100644 --- a/include/nana/deploy.hpp +++ b/include/nana/deploy.hpp @@ -1,10 +1,10 @@ /* * The Deploy Implementation * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com) * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * @file: nana/deploy.hpp @@ -72,7 +72,12 @@ namespace std std::string to_string(long long); std::string to_string(unsigned long long); std::string to_string(float); - +} +#endif + +#ifdef STD_TO_WSTRING_NOT_SUPPORTED +namespace std +{ std::wstring to_wstring(long double); std::wstring to_wstring(double); std::wstring to_wstring(unsigned); diff --git a/source/deploy.cpp b/source/deploy.cpp index ce92982a..0f751352 100644 --- a/source/deploy.cpp +++ b/source/deploy.cpp @@ -298,6 +298,7 @@ namespace std #endif //STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED #ifdef STD_TO_STRING_NOT_SUPPORTED +#include namespace std { std::string to_string(double v) @@ -362,7 +363,13 @@ namespace std ss << v; return ss.str(); } +} +#endif // STD_TO_STRING_NOT_SUPPORTED +#ifdef STD_TO_WSTRING_NOT_SUPPORTED +#include +namespace std +{ std::wstring to_wstring(double v) { std::wstringstream ss;