gdb: Move value_from_host_double into value.c and make more use of it

The function value_from_host_double can be moved from f-lang.c into
value.c as a generally useful function, and then used more widely.

Tested on X86-64/GNU Linux with no regressions.

gdb/ChangeLog:

	* f-lang.c (value_from_host_double): Moved to...
	* value.c (value_from_host_double): ...here.
	* value.h (value_from_host_double): Declare.
	* guile/scm-math.c (vlscm_convert_typed_number): Use
	value_from_host_double.
	(vlscm_convert_number): Likewise.
	* guile/scm-value.c (gdbscm_value_to_real): Likewise.
	* python/py-value.c (convert_value_from_python): Likewise.
This commit is contained in:
Andrew Burgess 2019-03-07 14:53:37 +00:00
parent 2c5ebf1239
commit 7584bb30cf
7 changed files with 29 additions and 35 deletions

View file

@ -1739,11 +1739,7 @@ convert_value_from_python (PyObject *obj)
double d = PyFloat_AsDouble (obj);
if (! PyErr_Occurred ())
{
value = allocate_value (builtin_type_pyfloat);
target_float_from_host_double (value_contents_raw (value),
value_type (value), d);
}
value = value_from_host_double (builtin_type_pyfloat, d);
}
else if (gdbpy_is_string (obj))
{