This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC v2][2/2] Target FP: Make use of MPFR if available
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: jhb at freebsd dot org (John Baldwin)
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 29 Nov 2017 18:55:36 +0100 (CET)
- Subject: Re: [RFC v2][2/2] Target FP: Make use of MPFR if available
- Authentication-results: sourceware.org; auth=none
John Baldwin wrote:
> FreeBSD's stdint.h uses _SYS_STDINT_H_ as it's include guard for <stdint.h>,
> so this check doesn't work. Perhaps GDB's sources should just define
> MPFR_USE_INTMAX_T explicitly after ensuring <stdint.h> is included? That
> would seem to be the most portable approach and I think is what the
> "Portable software should not rely on these tests" implies.
I agree. GDB now requires C++11, which always has intmax_t, so it should
be fine to simply always require this.
> target-float.c always includes <stdint.h> via "defs.h" ->
> "common/common-defs.h", so just adding the #define should be sufficient.
>
> Indeed, this does fix the build on FreeBSD:
>
> diff --git a/gdb/target-float.c b/gdb/target-float.c
> index 32237ec9d9..b40b6416c1 100644
> --- a/gdb/target-float.c
> +++ b/gdb/target-float.c
> @@ -1147,6 +1147,8 @@ host_float_ops<T>::compare (const gdb_byte *x, const
> struct type *type_x,
>
> #ifdef HAVE_LIBMPFR
>
> +#define MPFR_USE_INTMAX_T
> +
> #include <mpfr.h>
>
> class mpfr_float_ops : public target_float_ops
This looks good to me. Can you check this in?
Thanks,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com