fix issues that nuwen/TDM MinGW distro

This commit is contained in:
Jinhao 2017-07-08 04:22:26 +08:00
parent 50db6f81f0
commit d4fb5a226f
2 changed files with 18 additions and 27 deletions

View File

@ -150,11 +150,7 @@
#if ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 1)) #if ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 1))
#define STD_THREAD_NOT_SUPPORTED #define STD_THREAD_NOT_SUPPORTED
#endif #endif
#if 0
#if (__GNUC_MINOR__ < 9)
#define _enable_std_make_unique
#endif
#endif
#if defined(NANA_MINGW) #if defined(NANA_MINGW)
#ifndef __MINGW64_VERSION_MAJOR #ifndef __MINGW64_VERSION_MAJOR
//It's a knonwn issue under MinGW(except MinGW-W64) //It's a knonwn issue under MinGW(except MinGW-W64)
@ -183,30 +179,23 @@
# endif # endif
#endif #endif
#include <iosfwd>
//Detects std::make_unique //Detects the feature std::make_unique
#if (!defined(_MSC_VER)) && (__cplusplus >= 201300) //std::make_unique has been provided by Visual C++ 2013 and later
# if !defined(__cpp_lib_make_unique) || (__cpp_lib_make_unique != 201304) #undef _enable_std_make_unique
# ifndef _enable_std_make_unique #if (defined(__clang__) && (__cplusplus < 201305L || (__cplusplus == 201305L && (__clang_major__ * 100 + __clang_minor__ < 304 )))) \
# define _enable_std_make_unique || ((!defined(__clang__)) && defined(__GNUC__) && __cplusplus < 201300L)
# endif # define _enable_std_make_unique
# endif
#endif #endif
//Detects the feature std::clamp //Detects the feature std::clamp
//Visual C++ 2017 with /std:c++latest provides the std::clamp //Visual C++ 2017 with /std:c++latest provides the std::clamp
#if !defined(_MSVC_LANG) || (_MSVC_LANG < 201403L) #undef _enable_std_clamp
#if (defined(_MSC_VER) && ((!defined(_MSVC_LANG)) || _MSVC_LANG < 201403L)) \
// std::clamp's feature test macro is defined inside <algorithm> || (defined(__clang__) && (__cplusplus < 201406L)) \
// But nana still avoids introducing <algorithm> on MSVC. || (defined(__GNUC__) && (!defined(__clang__)) && (__cplusplus < 201703))
# ifndef _MSC_VER # define _enable_std_clamp
# include <algorithm>
# endif
# if ((!defined(__cpp_lib_clamp)) || (__cpp_lib_clamp < 201603)) && (!defined(_enable_std_clamp))
# define _enable_std_clamp
# endif
#endif #endif

View File

@ -15,6 +15,8 @@
//Implement workarounds for GCC/MinGW which version is below 4.8.2 //Implement workarounds for GCC/MinGW which version is below 4.8.2
#if defined(STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED) #if defined(STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED)
#include <sstream> #include <sstream>
#include <cstdlib>
#include <stdexcept>
namespace std namespace std
{ {
int stoi(const std::string& str, std::size_t * pos, int base) int stoi(const std::string& str, std::size_t * pos, int base)
@ -449,14 +451,14 @@ namespace std
//{ //{
// unsigned sz = 200; // unsigned sz = 200;
// std::wstring str(sz, L'\0'); // std::wstring str(sz, L'\0');
// sz = std::wcsftime(&str[0], str.size() - 1, fmt, tmb); // sz = std::wcsftime(&str[0], str.size() - 1, fmt, tmb);
// str.resize(sz); // str.resize(sz);
// return str; // return str;
//} //}
// http://en.cppreference.com/w/cpp/chrono/c/wcsftime // http://en.cppreference.com/w/cpp/chrono/c/wcsftime
// Defined in header <cwchar> // Defined in header <cwchar>
// std::size_t wcsftime(wchar_t* str, std::size_t count, const wchar_t* format, const std::tm* time); // std::size_t wcsftime(wchar_t* str, std::size_t count, const wchar_t* format, const std::tm* time);
// Converts the date and time information from a given calendar time time to a null - terminated // Converts the date and time information from a given calendar time time to a null - terminated
// wide character string str according to format string format.Up to count bytes are written. // wide character string str according to format string format.Up to count bytes are written.
// Parameters // Parameters
// str - pointer to the first element of the wchar_t array for output // str - pointer to the first element of the wchar_t array for output
@ -464,4 +466,4 @@ namespace std
// format - pointer to a null - terminated wide character string specifying the format of conversion. // format - pointer to a null - terminated wide character string specifying the format of conversion.
} }
#endif // _enable_std_put_time #endif // _enable_std_put_time