/* Floating point routines for GDB, the GNU debugger.
- Copyright (C) 2017 Free Software Foundation, Inc.
+ Copyright (C) 2017-2019 Free Software Foundation, Inc.
This file is part of GDB.
}
unsigned char *ufrom = (unsigned char *) from;
- T dto;
long exponent;
unsigned long mant;
unsigned int mant_bits, mant_off;
mant_bits_left = fmt->man_len;
mant_off = fmt->man_start;
- dto = 0.0;
+ T dto = 0.0;
special_exponent = exponent == 0 || exponent == fmt->exp_nan;
T host_float;
from_target (type, addr, &host_float);
+
+ DIAGNOSTIC_PUSH
+ DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
return string_printf (host_format.c_str (), host_float);
+ DIAGNOSTIC_POP
}
/* Parse string IN into a target floating-number of type TYPE and
scan_format += scanf_length_modifier<T>::value;
scan_format += "g%n";
+ DIAGNOSTIC_PUSH
+ DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
num = sscanf (in.c_str (), scan_format.c_str(), &host_float, &n);
+ DIAGNOSTIC_POP
/* The sscanf man page suggests not making any assumptions on the effect
of %n on the result, so we don't.
mant = get_field (from, order, fmt->totalsize, mant_off, mant_bits);
- mpfr_set_si (tmp.val, mant, MPFR_RNDN);
+ mpfr_set_ui (tmp.val, mant, MPFR_RNDN);
mpfr_mul_2si (tmp.val, tmp.val, exponent - mant_bits, MPFR_RNDN);
mpfr_add (to.val, to.val, tmp.val, MPFR_RNDN);
exponent -= mant_bits;