From f69fdf9bca80ac703890a51e124e408cbccbb743 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Mon, 6 Nov 2017 15:56:35 +0100 Subject: Target FP: Add string routines to target-float.{c,h} This adds target_float_to_string and target_float_from_string, which dispatch to the corresponding floatformat_ or decimal_ routines. Existing users of those routines are changed to use the new target-float routines instead (most of those places already handle both binary and decimal FP). In addition, two other places are changes to use target_float_from_string: - define_symbol in stabsread.c, when parsing a floating-point literal from stabs debug info - gdbarch-selftest.c when initializing a target format values (to eliminate use of DOUBLEST there). gdb/ChangeLog: 2017-11-06 Ulrich Weigand * target-float.c (target_float_to_string): New function. (target_float_from_string): New function. * target-float.h (target_float_to_string): Add prototype. (target_float_from_string): Add prototype. * valprint.c: Include "target-float.h". Do not include "doublest.h" and "dfp.h". (print_floating): Use target_float_to_string. * printcmd.c: Include "target-float.h". Do not include "dfp.h". (printf_floating): Use target_float_to_string. * i387-tdep.c: Include "target-float.h". Do not include "doublest.h". (print_i387_value): Use target_float_to_string. * mips-tdep.c: Include "target-float.h". (mips_print_fp_register): Use target_float_to_string. * sh64-tdep.c: Include "target-float.h". (sh64_do_fp_register): Use target_float_to_string. * parse.c: Include "target-float.h". Do not include "doublest.h" and "dfp.h". (parse_float): Use target_float_from_string. * stabsread.c: Include "target-float.h". Do not include "doublest.h". (define_symbol): Use target_float_from_string. * gdbarch-selftests.c: Include "target-float.h". (register_to_value_test): Use target_float_from_string. --- gdb/gdbarch-selftests.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'gdb/gdbarch-selftests.c') diff --git a/gdb/gdbarch-selftests.c b/gdb/gdbarch-selftests.c index 58ed11287a0..c748fcc6606 100644 --- a/gdb/gdbarch-selftests.c +++ b/gdb/gdbarch-selftests.c @@ -24,6 +24,7 @@ #include "inferior.h" #include "gdbthread.h" #include "target.h" +#include "target-float.h" namespace selftests { @@ -178,11 +179,8 @@ register_to_value_test (struct gdbarch *gdbarch) if (TYPE_CODE (type) == TYPE_CODE_FLT) { - DOUBLEST d = 1.25; - /* Generate valid float format. */ - floatformat_from_doublest (floatformat_from_type (type), - &d, expected.data ()); + target_float_from_string (expected.data (), type, "1.25"); } else { -- cgit v1.2.1