This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Avoid implicit float <-> integer conversion warnings
- From: Pedro Alves <palves at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 14 Apr 2016 12:00:22 -0000
- Subject: [binutils-gdb] Avoid implicit float <-> integer conversion warnings
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=aebf07fc1483b0bda9bbc1c0b7d7184b7e840677
commit aebf07fc1483b0bda9bbc1c0b7d7184b7e840677
Author: Pedro Alves <palves@redhat.com>
Date: Thu Apr 14 12:58:03 2016 +0100
Avoid implicit float <-> integer conversion warnings
On:
$ uname -a
NetBSD gcc70.fsffrance.org 5.1 NetBSD 5.1 (GENERIC) #0: Sat Nov 6 13:19:33 UTC 2010 builds@b6.netbsd.org:/home/builds/ab/netbsd-5-1-RELEASE/amd64/201011061943Z-obj/home/builds/ab/netbsd-5-1-RELEASE/src/sys/arch/amd64/compile/GENERIC amd64
With:
$ g++ -v
Using built-in specs.
Target: x86_64--netbsd
Configured with: /usr/src/tools/gcc/../../gnu/dist/gcc4/configure --enable-long-long --disable-multilib --enable-threads --disable-symvers --build=x86_64-unknown-netbsd4.99.72 --host=x86_64--netbsd --target=x86_64--netbsd --enable-__cxa_atexit
Thread model: posix
gcc version 4.1.3 20080704 prerelease (NetBSD nb2 20081120)
I saw:
../../src/gdb/ada-typeprint.c: In function 'void print_fixed_point_type(type*, ui_file*)':
../../src/gdb/ada-typeprint.c:366: warning: passing 'float' for argument 2 to 'DOUBLEST ada_fixed_to_float(type*, LONGEST)'
../../src/gdb/value.c: In function 'LONGEST unpack_long(type*, const gdb_byte*)':
../../src/gdb/value.c:2833: warning: converting to 'LONGEST' from 'DOUBLEST'
../../src/gdb/value.c:2838: warning: converting to 'LONGEST' from 'DOUBLEST'
gdb/ChangeLog:
2016-04-14 Pedro Alves <palves@redhat.com>
* ada-typeprint.c (print_fixed_point_type): Don't pass float as
argument to function expecting LONGEST.
* value.c (unpack_long): Add casts to LONGEST.
Diff:
---
gdb/ChangeLog | 6 ++++++
gdb/ada-typeprint.c | 2 +-
gdb/value.c | 4 ++--
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ad74df6..bf7937f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2016-04-14 Pedro Alves <palves@redhat.com>
+
+ * ada-typeprint.c (print_fixed_point_type): Don't pass float as
+ argument to function expecting LONGEST.
+ * value.c (unpack_long): Add casts to LONGEST.
+
2016-04-13 Luis Machado <lgustavo@codesourcery.com>
* exec.c (exec_file_locate_attach): Guard a couple functions
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index 065fbd3..d7a8360 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -363,7 +363,7 @@ static void
print_fixed_point_type (struct type *type, struct ui_file *stream)
{
DOUBLEST delta = ada_delta (type);
- DOUBLEST small = ada_fixed_to_float (type, 1.0);
+ DOUBLEST small = ada_fixed_to_float (type, 1);
if (delta < 0.0)
fprintf_filtered (stream, "delta ??");
diff --git a/gdb/value.c b/gdb/value.c
index 5aeed02..9657b89 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2914,12 +2914,12 @@ unpack_long (struct type *type, const gdb_byte *valaddr)
return extract_signed_integer (valaddr, len, byte_order);
case TYPE_CODE_FLT:
- return extract_typed_floating (valaddr, type);
+ return (LONGEST) extract_typed_floating (valaddr, type);
case TYPE_CODE_DECFLOAT:
/* libdecnumber has a function to convert from decimal to integer, but
it doesn't work when the decimal number has a fractional part. */
- return decimal_to_doublest (valaddr, len, byte_order);
+ return (LONGEST) decimal_to_doublest (valaddr, len, byte_order);
case TYPE_CODE_PTR:
case TYPE_CODE_REF: