From 89dc4c9488b01debe9c4b0e81fff09bdbd0bdb7b Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 27 Jan 2017 12:28:34 +0100 Subject: [PATCH] realmpfr.h: Poison MPFR_RND{N,Z,U,D}. * realmpfr.h: Poison MPFR_RND{N,Z,U,D}. * gimple-ssa-sprintf.c (format_floating_max): Use GMP_RNDN instead of MPFR_RNDN. From-SVN: r244966 --- gcc/ChangeLog | 6 ++++++ gcc/gimple-ssa-sprintf.c | 2 +- gcc/realmpfr.h | 7 ++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3ef51ca9e8a..2e52f20ecf7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-01-27 Jakub Jelinek + + * realmpfr.h: Poison MPFR_RND{N,Z,U,D}. + * gimple-ssa-sprintf.c (format_floating_max): Use GMP_RNDN + instead of MPFR_RNDN. + 2017-01-27 Richard Earnshaw PR target/79239 diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c index bd15a397ccf..8261a442282 100644 --- a/gcc/gimple-ssa-sprintf.c +++ b/gcc/gimple-ssa-sprintf.c @@ -1498,7 +1498,7 @@ format_floating_max (tree type, char spec, HOST_WIDE_INT prec) round-to-nearest mode. */ mpfr_t x; mpfr_init2 (x, rfmt->p); - mpfr_from_real (x, &rv, MPFR_RNDN); + mpfr_from_real (x, &rv, GMP_RNDN); /* Return a value one greater to account for the leading minus sign. */ return 1 + get_mpfr_format_length (x, "", prec, spec, 'D'); diff --git a/gcc/realmpfr.h b/gcc/realmpfr.h index 20c94eaf762..0ea36d2c9ce 100644 --- a/gcc/realmpfr.h +++ b/gcc/realmpfr.h @@ -32,5 +32,10 @@ extern void real_from_mpfr (REAL_VALUE_TYPE *, mpfr_srcptr, const real_format *, mp_rnd_t); extern void mpfr_from_real (mpfr_ptr, const REAL_VALUE_TYPE *, mp_rnd_t); -#endif /* ! GCC_REALGMP_H */ +#if (GCC_VERSION >= 3000) + /* For compatibility with mpfr 2.4 and earlier, we want to only use + GMP_RND*. */ + #pragma GCC poison MPFR_RNDN MPFR_RNDZ MPFR_RNDU MPFR_RNDD +#endif +#endif /* ! GCC_REALGMP_H */ -- 2.30.2