Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76599 - trunk/boost
From: antoshkka_at_[hidden]
Date: 2012-01-20 14:33:05


Author: apolukhin
Date: 2012-01-20 14:33:04 EST (Fri, 20 Jan 2012)
New Revision: 76599
URL: http://svn.boost.org/trac/boost/changeset/76599

Log:
Attempt to fix #6251
Text files modified:
   trunk/boost/lexical_cast.hpp | 31 ++++++++++++++++++++++++++-----
   1 files changed, 26 insertions(+), 5 deletions(-)

Modified: trunk/boost/lexical_cast.hpp
==============================================================================
--- trunk/boost/lexical_cast.hpp (original)
+++ trunk/boost/lexical_cast.hpp 2012-01-20 14:33:04 EST (Fri, 20 Jan 2012)
@@ -21,6 +21,32 @@
 // Cheng Yang, Matthew Bradbury, David W. Birdsall and other Boosters
 // when: November 2000, March 2003, June 2005, June 2006, March 2011 - 2012
 
+#include <boost/config.hpp>
+#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING)
+#define BOOST_LCAST_NO_WCHAR_T
+#endif
+
+#if (defined(__MINGW32__) || defined(__MINGW64__)) && (__GNUC__ == 4) \
+ && ((__GNUC_MINOR__ == 4) || (__GNUC_MINOR__ == 5)) && defined(__STRICT_ANSI__) \
+ && !defined(BOOST_LCAST_NO_WCHAR_T)
+
+// workaround for a mingw bug
+// http://sourceforge.net/tracker/index.php?func=detail&aid=2373234&group_id=2435&atid=102435
+#include <_mingw.h>
+#if (__GNUC_MINOR__ == 4)
+extern "C" {
+_CRTIMP int __cdecl swprintf(wchar_t * __restrict__ , const wchar_t * __restrict__ , ...);
+_CRTIMP int __cdecl vswprintf(wchar_t * __restrict__ , const wchar_t * __restrict__ , ...);
+}
+#endif
+#if (__GNUC_MINOR__ == 5)
+extern "C" {
+_CRTIMP int __cdecl swprintf(wchar_t * __restrict__ , const wchar_t * __restrict__ , ...);
+_CRTIMP int __cdecl vswprintf(wchar_t * __restrict__ , const wchar_t * __restrict__ , va_list);
+}
+#endif
+#endif
+
 #include <climits>
 #include <cstddef>
 #include <istream>
@@ -30,7 +56,6 @@
 #include <typeinfo>
 #include <exception>
 #include <cmath>
-#include <boost/config.hpp>
 #include <boost/limits.hpp>
 #include <boost/mpl/if.hpp>
 #include <boost/throw_exception.hpp>
@@ -67,10 +92,6 @@
 #include <sstream>
 #endif
 
-#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING)
-#define BOOST_LCAST_NO_WCHAR_T
-#endif
-
 #ifdef BOOST_NO_TYPEID
 #define BOOST_LCAST_THROW_BAD_CAST(S, T) throw_exception(bad_lexical_cast())
 #else


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk