Re: [PUSHED 10/11] gdb/fortran: Add support for the ABS intrinsic function

Tom Tromey
2019-03-06T19:11:52Z

>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:

Andrew> Adds support for the abs intrinsic function, this requires adding a
Andrew> new pattern to the Fortran parser. Currently only float and integer
Andrew> argument types are supported to ABS, complex is still not supported,
Andrew> this can be added later if needed.

Sorry for not looking at these earlier...

Andrew> +/* Create and return a value object of TYPE containing the value D. The
Andrew> + TYPE must be of TYPE_CODE_FLT, and must be large enough to hold D once
Andrew> + it is converted to target format. */
Andrew> +
Andrew> +static struct value *
Andrew> +value_from_host_double (struct type *type, double d)
Andrew> +{
Andrew> + struct value *value = allocate_value (type);
Andrew> + gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
Andrew> + target_float_from_host_double (value_contents_raw (value),
Andrew> + value_type (value), d);
Andrew> + return value;

This seems reasonable to move to value.c. At least py-value.c could use it.
I can do that if you also think it's worthwhile.

Tom