File mpfr_vasprintf.patch of Package mingw32-mpfr
applies to mpfr-2.4.2-rc1 and also to mpfr-2.4.1. already in mpfr-2.4 branch
and should be in the official mpfr-2.4.2 release.
--- vasprintf.c 2009/09/08 08:49:33 6413
+++ vasprintf.c 2009/09/11 22:03:10 6415
@@ -56,7 +56,7 @@
# include <inttypes.h> /* for intmax_t */
#else
# if HAVE_STDINT_H
-# include <stdint.h>
+# include <stdint.h> /* for WINT_MAX in particular */
# endif
#endif
@@ -387,8 +387,15 @@
integer type : int, unsigned int, long or unsigned long (unfortunately,
this is implementation dependant).
We follow gmp which assumes in print/doprnt.c that wchar_t is converted
- to int. */
+ to int (because wchar_t <= int).
+ For wint_t, we assume that the case WINT_MAX < INT_MAX yields an
+ integer promotion. */
#ifdef HAVE_WCHAR_H
+#if defined(WINT_MAX) && WINT_MAX < INT_MAX
+typedef int mpfr_va_wint; /* integer promotion */
+#else
+typedef wint_t mpfr_va_wint;
+#endif
#define CASE_LONG_ARG(specinfo, ap) \
case LONG_ARG: \
if (((specinfo).spec == 'd') || ((specinfo).spec == 'i') \
@@ -396,7 +403,7 @@
|| ((specinfo).spec == 'x') || ((specinfo).spec == 'X')) \
(void) va_arg ((ap), long); \
else if ((specinfo).spec == 'c') \
- (void) va_arg ((ap), wint_t); \
+ (void) va_arg ((ap), mpfr_va_wint); \
else if ((specinfo).spec == 's') \
(void) va_arg ((ap), int); /* we assume integer promotion */ \
break;