From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 51686 invoked by alias); 13 Apr 2016 19:50:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 51673 invoked by uid 89); 13 Apr 2016 19:50:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy= X-HELO: usplmg21.ericsson.net Received: from usplmg21.ericsson.net (HELO usplmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 13 Apr 2016 19:50:10 +0000 Received: from EUSAAHC004.ericsson.se (Unknown_Domain [147.117.188.84]) by usplmg21.ericsson.net (Symantec Mail Security) with SMTP id 44.5F.03614.7C2AE075; Wed, 13 Apr 2016 21:49:27 +0200 (CEST) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.86) with Microsoft SMTP Server id 14.3.248.2; Wed, 13 Apr 2016 15:50:07 -0400 Subject: Re: [PATCH] Avoid implicit float <-> integer conversion warnings To: Pedro Alves , References: <1460574354-21671-1-git-send-email-palves@redhat.com> From: Simon Marchi Message-ID: <570EA2EE.5040605@ericsson.com> Date: Wed, 13 Apr 2016 19:50:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1460574354-21671-1-git-send-email-palves@redhat.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-04/txt/msg00301.txt.bz2 On 16-04-13 03:05 PM, Pedro Alves wrote: > 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: > yyyy-mm-yy Pedro Alves > > * 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. > --- > gdb/ada-typeprint.c | 2 +- > gdb/value.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > 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: > LGTM.