1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/mpfr/2.4.0/100-printf-hh-ll.patch Tue Aug 24 00:15:36 2010 +0200
1.3 @@ -0,0 +1,359 @@
1.4 +diff -Naurd mpfr-2.4.0-a/PATCHES mpfr-2.4.0-b/PATCHES
1.5 +--- mpfr-2.4.0-a/PATCHES 2009-01-26 12:52:01.000000000 +0000
1.6 ++++ mpfr-2.4.0-b/PATCHES 2009-02-20 17:27:44.000000000 +0000
1.7 +@@ -0,0 +1 @@
1.8 ++printf-hh-ll
1.9 +diff -Naurd mpfr-2.4.0-a/VERSION mpfr-2.4.0-b/VERSION
1.10 +--- mpfr-2.4.0-a/VERSION 2009-01-26 12:52:01.000000000 +0000
1.11 ++++ mpfr-2.4.0-b/VERSION 2009-02-20 17:27:44.000000000 +0000
1.12 +@@ -1 +1 @@
1.13 +-2.4.0
1.14 ++2.4.0-p1
1.15 +diff -Naurd mpfr-2.4.0-a/acinclude.m4 mpfr-2.4.0-b/acinclude.m4
1.16 +--- mpfr-2.4.0-a/acinclude.m4 2009-01-26 12:52:01.000000000 +0000
1.17 ++++ mpfr-2.4.0-b/acinclude.m4 2009-01-26 12:52:01.000000000 +0000
1.18 +@@ -722,6 +722,16 @@
1.19 + [AC_DEFINE([NPRINTF_J], 1, [gmp_printf cannot read intmax_t])])
1.20 + fi
1.21 +
1.22 ++MPFR_FUNC_PRINTF_SPEC([%hhd], [char], [
1.23 ++#include <gmp.h>
1.24 ++ ], [gmp_],,
1.25 ++ [AC_DEFINE([NPRINTF_HH], 1, [gmp_printf cannot use 'hh' length modifier])])
1.26 ++
1.27 ++MPFR_FUNC_PRINTF_SPEC([%lld], [long long int], [
1.28 ++#include <gmp.h>
1.29 ++ ], [gmp_],,
1.30 ++ [AC_DEFINE([NPRINTF_LL], 1, [gmp_printf cannot read long long int])])
1.31 ++
1.32 + MPFR_FUNC_PRINTF_SPEC([%.0Lf], [long double], [
1.33 + #include <gmp.h>
1.34 + ], [gmp_],,
1.35 +diff -Naurd mpfr-2.4.0-a/configure mpfr-2.4.0-b/configure
1.36 +--- mpfr-2.4.0-a/configure 2009-01-26 12:54:36.000000000 +0000
1.37 ++++ mpfr-2.4.0-b/configure 2009-02-20 17:38:36.000000000 +0000
1.38 +@@ -24874,6 +24874,170 @@
1.39 + fi
1.40 +
1.41 +
1.42 ++{ $as_echo "$as_me:$LINENO: checking if gmp_printf supports \"%hhd\"" >&5
1.43 ++$as_echo_n "checking if gmp_printf supports \"%hhd\"... " >&6; }
1.44 ++if test "$cross_compiling" = yes; then
1.45 ++ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
1.46 ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
1.47 ++{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
1.48 ++See \`config.log' for more details." >&5
1.49 ++$as_echo "$as_me: error: cannot run test program while cross compiling
1.50 ++See \`config.log' for more details." >&2;}
1.51 ++ { (exit 1); exit 1; }; }; }
1.52 ++else
1.53 ++ cat >conftest.$ac_ext <<_ACEOF
1.54 ++/* confdefs.h. */
1.55 ++_ACEOF
1.56 ++cat confdefs.h >>conftest.$ac_ext
1.57 ++cat >>conftest.$ac_ext <<_ACEOF
1.58 ++/* end confdefs.h. */
1.59 ++
1.60 ++#include <stdio.h>
1.61 ++
1.62 ++#include <gmp.h>
1.63 ++
1.64 ++
1.65 ++int
1.66 ++main ()
1.67 ++{
1.68 ++
1.69 ++ char s[256];
1.70 ++ char a = 0;
1.71 ++ return (gmp_sprintf (s, "%hhd", a) != 1) ? 1 : 0;
1.72 ++
1.73 ++ ;
1.74 ++ return 0;
1.75 ++}
1.76 ++_ACEOF
1.77 ++rm -f conftest$ac_exeext
1.78 ++if { (ac_try="$ac_link"
1.79 ++case "(($ac_try" in
1.80 ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1.81 ++ *) ac_try_echo=$ac_try;;
1.82 ++esac
1.83 ++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
1.84 ++$as_echo "$ac_try_echo") >&5
1.85 ++ (eval "$ac_link") 2>&5
1.86 ++ ac_status=$?
1.87 ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
1.88 ++ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
1.89 ++ { (case "(($ac_try" in
1.90 ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1.91 ++ *) ac_try_echo=$ac_try;;
1.92 ++esac
1.93 ++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
1.94 ++$as_echo "$ac_try_echo") >&5
1.95 ++ (eval "$ac_try") 2>&5
1.96 ++ ac_status=$?
1.97 ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
1.98 ++ (exit $ac_status); }; }; then
1.99 ++ { $as_echo "$as_me:$LINENO: result: yes" >&5
1.100 ++$as_echo "yes" >&6; }
1.101 ++
1.102 ++else
1.103 ++ $as_echo "$as_me: program exited with status $ac_status" >&5
1.104 ++$as_echo "$as_me: failed program was:" >&5
1.105 ++sed 's/^/| /' conftest.$ac_ext >&5
1.106 ++
1.107 ++( exit $ac_status )
1.108 ++{ $as_echo "$as_me:$LINENO: result: no" >&5
1.109 ++$as_echo "no" >&6; }
1.110 ++
1.111 ++cat >>confdefs.h <<\_ACEOF
1.112 ++#define NPRINTF_HH 1
1.113 ++_ACEOF
1.114 ++
1.115 ++fi
1.116 ++rm -rf conftest.dSYM
1.117 ++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
1.118 ++fi
1.119 ++
1.120 ++
1.121 ++
1.122 ++
1.123 ++
1.124 ++{ $as_echo "$as_me:$LINENO: checking if gmp_printf supports \"%lld\"" >&5
1.125 ++$as_echo_n "checking if gmp_printf supports \"%lld\"... " >&6; }
1.126 ++if test "$cross_compiling" = yes; then
1.127 ++ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
1.128 ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
1.129 ++{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
1.130 ++See \`config.log' for more details." >&5
1.131 ++$as_echo "$as_me: error: cannot run test program while cross compiling
1.132 ++See \`config.log' for more details." >&2;}
1.133 ++ { (exit 1); exit 1; }; }; }
1.134 ++else
1.135 ++ cat >conftest.$ac_ext <<_ACEOF
1.136 ++/* confdefs.h. */
1.137 ++_ACEOF
1.138 ++cat confdefs.h >>conftest.$ac_ext
1.139 ++cat >>conftest.$ac_ext <<_ACEOF
1.140 ++/* end confdefs.h. */
1.141 ++
1.142 ++#include <stdio.h>
1.143 ++
1.144 ++#include <gmp.h>
1.145 ++
1.146 ++
1.147 ++int
1.148 ++main ()
1.149 ++{
1.150 ++
1.151 ++ char s[256];
1.152 ++ long long int a = 0;
1.153 ++ return (gmp_sprintf (s, "%lld", a) != 1) ? 1 : 0;
1.154 ++
1.155 ++ ;
1.156 ++ return 0;
1.157 ++}
1.158 ++_ACEOF
1.159 ++rm -f conftest$ac_exeext
1.160 ++if { (ac_try="$ac_link"
1.161 ++case "(($ac_try" in
1.162 ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1.163 ++ *) ac_try_echo=$ac_try;;
1.164 ++esac
1.165 ++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
1.166 ++$as_echo "$ac_try_echo") >&5
1.167 ++ (eval "$ac_link") 2>&5
1.168 ++ ac_status=$?
1.169 ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
1.170 ++ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
1.171 ++ { (case "(($ac_try" in
1.172 ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1.173 ++ *) ac_try_echo=$ac_try;;
1.174 ++esac
1.175 ++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
1.176 ++$as_echo "$ac_try_echo") >&5
1.177 ++ (eval "$ac_try") 2>&5
1.178 ++ ac_status=$?
1.179 ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
1.180 ++ (exit $ac_status); }; }; then
1.181 ++ { $as_echo "$as_me:$LINENO: result: yes" >&5
1.182 ++$as_echo "yes" >&6; }
1.183 ++
1.184 ++else
1.185 ++ $as_echo "$as_me: program exited with status $ac_status" >&5
1.186 ++$as_echo "$as_me: failed program was:" >&5
1.187 ++sed 's/^/| /' conftest.$ac_ext >&5
1.188 ++
1.189 ++( exit $ac_status )
1.190 ++{ $as_echo "$as_me:$LINENO: result: no" >&5
1.191 ++$as_echo "no" >&6; }
1.192 ++
1.193 ++cat >>confdefs.h <<\_ACEOF
1.194 ++#define NPRINTF_LL 1
1.195 ++_ACEOF
1.196 ++
1.197 ++fi
1.198 ++rm -rf conftest.dSYM
1.199 ++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
1.200 ++fi
1.201 ++
1.202 ++
1.203 ++
1.204 ++
1.205 ++
1.206 + { $as_echo "$as_me:$LINENO: checking if gmp_printf supports \"%.0Lf\"" >&5
1.207 + $as_echo_n "checking if gmp_printf supports \"%.0Lf\"... " >&6; }
1.208 + if test "$cross_compiling" = yes; then
1.209 +diff -Naurd mpfr-2.4.0-a/mpfr.h mpfr-2.4.0-b/mpfr.h
1.210 +--- mpfr-2.4.0-a/mpfr.h 2009-01-26 12:52:01.000000000 +0000
1.211 ++++ mpfr-2.4.0-b/mpfr.h 2009-02-20 17:27:44.000000000 +0000
1.212 +@@ -27,7 +27,7 @@
1.213 + #define MPFR_VERSION_MAJOR 2
1.214 + #define MPFR_VERSION_MINOR 4
1.215 + #define MPFR_VERSION_PATCHLEVEL 0
1.216 +-#define MPFR_VERSION_STRING "2.4.0"
1.217 ++#define MPFR_VERSION_STRING "2.4.0-p1"
1.218 +
1.219 + /* Macros dealing with MPFR VERSION */
1.220 + #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
1.221 +diff -Naurd mpfr-2.4.0-a/tests/tfprintf.c mpfr-2.4.0-b/tests/tfprintf.c
1.222 +--- mpfr-2.4.0-a/tests/tfprintf.c 2009-01-26 12:52:00.000000000 +0000
1.223 ++++ mpfr-2.4.0-b/tests/tfprintf.c 2009-02-20 16:31:02.000000000 +0000
1.224 +@@ -146,6 +146,7 @@
1.225 + short sh = -1;
1.226 + unsigned short ush = 1;
1.227 + int i = -1;
1.228 ++ int j = 1;
1.229 + unsigned int ui = 1;
1.230 + long lo = -1;
1.231 + unsigned long ulo = 1;
1.232 +@@ -179,12 +180,11 @@
1.233 +
1.234 + limb[0] = limb[1] = limb[2] = ~ (mp_limb_t) 0;
1.235 +
1.236 +- check_vfprintf (fout, "a. %Ra, b. %hhu, c. %u, d. %lx%hhn", mpfr, uch, ui,
1.237 +- ulo, &uch);
1.238 +- check_length (1, uch, 28, hhu);
1.239 +- check_vfprintf (fout, "a. %hhi, b. %Rb, c. %u, d. %li%ln", sch, mpfr, i,
1.240 ++ check_vfprintf (fout, "a. %Ra, b. %u, c. %lx%n", mpfr, ui, ulo, &j);
1.241 ++ check_length (1, j, 22, d);
1.242 ++ check_vfprintf (fout, "a. %c, b. %Rb, c. %u, d. %li%ln", i, mpfr, i,
1.243 + lo, &ulo);
1.244 +- check_length (2, ulo, 37, lu);
1.245 ++ check_length (2, ulo, 36, lu);
1.246 + check_vfprintf (fout, "a. %hi, b. %*f, c. %Re%hn", ush, 3, f, mpfr, &ush);
1.247 + check_length (3, ush, 29, hu);
1.248 + check_vfprintf (fout, "a. %hi, b. %f, c. %#.2Rf%n", sh, d, mpfr, &i);
1.249 +@@ -208,13 +208,18 @@
1.250 + check_length (9, sz, 30, zu);
1.251 + #endif
1.252 +
1.253 ++#ifndef NPRINTF_HH
1.254 ++ check_vfprintf (fout, "a. %hhi, b.%RA, c. %hhu%hhn", sch, mpfr, uch, &uch);
1.255 ++ check_length (10, uch, 21, hhu);
1.256 ++#endif
1.257 ++
1.258 + #if (__GNU_MP_VERSION * 10 + __GNU_MP_VERSION_MINOR) >= 42
1.259 + /* The 'M' specifier was added in gmp 4.2.0 */
1.260 + check_vfprintf (fout, "a. %Mx b. %Re%Mn", limb[0], mpfr, &limb[0]);
1.261 + if (limb[0] != 14 + BITS_PER_MP_LIMB / 4 || limb[1] != ~ (mp_limb_t) 0
1.262 + || limb[2] != ~ (mp_limb_t) 0)
1.263 + {
1.264 +- printf ("Error in test #10: mpfr_vfprintf did not print %d characters"
1.265 ++ printf ("Error in test #11: mpfr_vfprintf did not print %d characters"
1.266 + " as expected\n", 14 + (int) BITS_PER_MP_LIMB / 4);
1.267 + exit (1);
1.268 + }
1.269 +@@ -227,13 +232,13 @@
1.270 + if (limb[0] != 14 + 3 * BITS_PER_MP_LIMB / 4 || limb[1] != (mp_limb_t) 0
1.271 + || limb[2] != ~ (mp_limb_t) 0)
1.272 + {
1.273 +- printf ("Error in test #11: mpfr_vfprintf did not print %d characters"
1.274 ++ printf ("Error in test #12: mpfr_vfprintf did not print %d characters"
1.275 + " as expected\n", 14 + (int) BITS_PER_MP_LIMB / 4);
1.276 + exit (1);
1.277 + }
1.278 + #endif
1.279 +
1.280 +-#ifdef HAVE_LONG_LONG
1.281 ++#if defined(HAVE_LONG_LONG) && !defined(NPRINTF_LL)
1.282 + {
1.283 + long long llo = -1;
1.284 + unsigned long long ullo = 1;
1.285 +diff -Naurd mpfr-2.4.0-a/tests/tprintf.c mpfr-2.4.0-b/tests/tprintf.c
1.286 +--- mpfr-2.4.0-a/tests/tprintf.c 2009-01-26 12:52:00.000000000 +0000
1.287 ++++ mpfr-2.4.0-b/tests/tprintf.c 2009-02-20 16:31:02.000000000 +0000
1.288 +@@ -150,6 +150,7 @@
1.289 + short sh = -1;
1.290 + unsigned short ush = 1;
1.291 + int i = -1;
1.292 ++ int j = 1;
1.293 + unsigned int ui = 1;
1.294 + long lo = -1;
1.295 + unsigned long ulo = 1;
1.296 +@@ -178,11 +179,10 @@
1.297 + mpfr_set_f (mpfr, mpf, GMP_RNDN);
1.298 + prec = mpfr_get_prec (mpfr);
1.299 +
1.300 +- check_vprintf ("a. %Ra, b. %hhu, c. %u, d. %lx%hhn", mpfr, uch, ui, ulo,
1.301 +- &uch);
1.302 +- check_length (1, uch, 28, hhu);
1.303 +- check_vprintf ("a. %hhi, b. %Rb, c. %u, d. %li%ln", sch, mpfr, i, lo, &ulo);
1.304 +- check_length (2, ulo, 37, lu);
1.305 ++ check_vprintf ("a. %Ra, b. %u, c. %lx%n", mpfr, ui, ulo, &j);
1.306 ++ check_length (1, j, 22, d);
1.307 ++ check_vprintf ("a. %c, b. %Rb, c. %u, d. %li%ln", i, mpfr, i, lo, &ulo);
1.308 ++ check_length (2, ulo, 36, lu);
1.309 + check_vprintf ("a. %hi, b. %*f, c. %Re%hn", ush, 3, f, mpfr, &ush);
1.310 + check_length (3, ush, 29, hu);
1.311 + check_vprintf ("a. %hi, b. %f, c. %#.2Rf%n", sh, d, mpfr, &i);
1.312 +@@ -204,7 +204,12 @@
1.313 + check_length (9, sz, 30, zu);
1.314 + #endif
1.315 +
1.316 +-#ifdef HAVE_LONG_LONG
1.317 ++#ifndef NPRINTF_HH
1.318 ++ check_vprintf ("a. %hhi, b. %Ra, c. %hhu%hhn", sch, mpfr, uch, &uch);
1.319 ++ check_length (10, uch, 22, hhu);
1.320 ++#endif
1.321 ++
1.322 ++#if defined(HAVE_LONG_LONG) && !defined(NPRINTF_LL)
1.323 + {
1.324 + long long llo = -1;
1.325 + unsigned long long ullo = 1;
1.326 +diff -Naurd mpfr-2.4.0-a/vasprintf.c mpfr-2.4.0-b/vasprintf.c
1.327 +--- mpfr-2.4.0-a/vasprintf.c 2009-01-26 12:52:01.000000000 +0000
1.328 ++++ mpfr-2.4.0-b/vasprintf.c 2009-02-20 16:31:02.000000000 +0000
1.329 +@@ -235,10 +235,14 @@
1.330 + break;
1.331 + case 'h':
1.332 + if (*++format == 'h')
1.333 ++#ifndef NPRINTF_HH
1.334 + {
1.335 + ++format;
1.336 + specinfo->arg_type = CHAR_ARG;
1.337 + }
1.338 ++#else
1.339 ++ specinfo->arg_type = UNSUPPORTED;
1.340 ++#endif
1.341 + else
1.342 + specinfo->arg_type = SHORT_ARG;
1.343 + break;
1.344 +@@ -246,7 +250,7 @@
1.345 + if (*++format == 'l')
1.346 + {
1.347 + ++format;
1.348 +-#ifdef HAVE_LONG_LONG
1.349 ++#if defined (HAVE_LONG_LONG) && !defined(NPRINTF_LL)
1.350 + specinfo->arg_type = LONG_LONG_ARG;
1.351 + #else
1.352 + specinfo->arg_type = UNSUPPORTED;
1.353 +diff -Naurd mpfr-2.4.0-a/version.c mpfr-2.4.0-b/version.c
1.354 +--- mpfr-2.4.0-a/version.c 2009-01-26 12:52:01.000000000 +0000
1.355 ++++ mpfr-2.4.0-b/version.c 2009-02-20 17:27:44.000000000 +0000
1.356 +@@ -25,5 +25,5 @@
1.357 + const char *
1.358 + mpfr_get_version (void)
1.359 + {
1.360 +- return "2.4.0";
1.361 ++ return "2.4.0-p1";
1.362 + }