diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-11-13 09:03:25 -0800 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-11-13 09:09:43 -0800 |
commit | 2cf599b310efffd5dace66cf6e8b9b4df396df50 (patch) | |
tree | 5c2c8d23c070063c9ab5d749d114d37f41a2dd93 | |
parent | 94c08f27c69a1c8ed1549ffc94f46b0f447806b9 (diff) |
Work around MinGW versions with non-C99 compliant headers
Apparently some MinGW distributions have a compiler that's recent enough to
support C++11 but limits.h header that incorrectly omits LLONG limits in
strict ANSI mode, since it guards the definitions with:
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
We can just define these symbols ourselves in this specific case.
Fixes #66.
-rw-r--r-- | src/pugixml.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 217e001..a53ff4d 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -109,6 +109,13 @@ using std::memmove; using std::memset; #endif +// Some MinGW versions have headers that erroneously omit LLONG_MIN/LLONG_MAX/ULLONG_MAX definitions in strict ANSI mode +#if defined(PUGIXML_HAS_LONG_LONG) && defined(__MINGW32__) && defined(__STRICT_ANSI__) && !defined(LLONG_MAX) && !defined(LLONG_MIN) && !defined(ULLONG_MAX) +# define LLONG_MAX 9223372036854775807LL +# define LLONG_MIN (-LLONG_MAX-1) +# define ULLONG_MAX (2ULL*LLONG_MAX+1) +#endif + // In some environments MSVC is a compiler but the CRT lacks certain MSVC-specific features #if defined(_MSC_VER) && !defined(__S3E__) # define PUGI__MSVC_CRT_VERSION _MSC_VER |