From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1284 invoked by alias); 9 Jan 2008 18:31:40 -0000 Received: (qmail 1265 invoked by uid 22791); 9 Jan 2008 18:31:38 -0000 X-Spam-Check-By: sourceware.org Received: from igw1.br.ibm.com (HELO igw1.br.ibm.com) (32.104.18.24) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 09 Jan 2008 18:31:10 +0000 Received: from mailhub3.br.ibm.com (mailhub3 [9.18.232.110]) by igw1.br.ibm.com (Postfix) with ESMTP id 4426232C33F for ; Wed, 9 Jan 2008 16:10:22 -0200 (BRDT) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.18.232.46]) by mailhub3.br.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id m09IUlAj3481640 for ; Wed, 9 Jan 2008 16:30:57 -0200 Received: from d24av01.br.ibm.com (loopback [127.0.0.1]) by d24av01.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m09IUjcN010117 for ; Wed, 9 Jan 2008 16:30:45 -0200 Received: from [9.18.238.251] ([9.18.238.251]) by d24av01.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m09IUjXP010114; Wed, 9 Jan 2008 16:30:45 -0200 Subject: Re: DFP build failure From: Thiago Jung Bauermann To: Daniel Jacobowitz Cc: gdb-patches@sourceware.org In-Reply-To: <20080109164917.GA10333@caradoc.them.org> References: <20080109164917.GA10333@caradoc.them.org> Content-Type: multipart/mixed; boundary="=-UCZbRyzZ9AyUO0DZSmKK" Date: Wed, 09 Jan 2008 18:31:00 -0000 Message-Id: <1199903445.15225.50.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.12.2 X-IsSubscribed: yes 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 X-SW-Source: 2008-01/txt/msg00199.txt.bz2 --=-UCZbRyzZ9AyUO0DZSmKK Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 738 On Wed, 2008-01-09 at 11:49 -0500, Daniel Jacobowitz wrote: > void > decimal_from_floating (struct value *from, gdb_byte *to, int len) > { > char *buffer; > int ret; > > ret = asprintf (&buffer, "%.30Lg", value_as_double (from)); > ... > > value_as_double returns a DOUBLEST, not necessarily a long double as > specified by %Lg. And the system printf does not necessarily support > long double. Is there some other way to do this? > > (It failed to build on mingw32.) Mmmm.... sorry about that. What do you think of the attached fix (dangerous question to ask!)? DOUBLEST_PRINT_FORMAT is currently not used, so not a big deal to change it a bit. -- []'s Thiago Jung Bauermann Software Engineer IBM Linux Technology Center --=-UCZbRyzZ9AyUO0DZSmKK Content-Disposition: attachment; filename=dfp-mingw-build-fix.diff Content-Type: text/x-patch; name=dfp-mingw-build-fix.diff; charset=utf-8 Content-Transfer-Encoding: 7bit Content-length: 1091 diff --git a/gdb/dfp.c b/gdb/dfp.c index bf82114..4915543 100644 --- a/gdb/dfp.c +++ b/gdb/dfp.c @@ -237,7 +237,7 @@ decimal_from_floating (struct value *from, gdb_byte *to, int len) char *buffer; int ret; - ret = asprintf (&buffer, "%.30Lg", value_as_double (from)); + ret = asprintf (&buffer, "%.30"DOUBLEST_PRINT_FORMAT, value_as_double (from)); if (ret < 0) error (_("Error in memory allocation for conversion to decimal float.")); diff --git a/gdb/doublest.h b/gdb/doublest.h index f3ab619..52e28df 100644 --- a/gdb/doublest.h +++ b/gdb/doublest.h @@ -49,11 +49,11 @@ struct floatformat; #if (defined HAVE_LONG_DOUBLE && defined PRINTF_HAS_LONG_DOUBLE \ && defined SCANF_HAS_LONG_DOUBLE) typedef long double DOUBLEST; -# define DOUBLEST_PRINT_FORMAT "%Lg" +# define DOUBLEST_PRINT_FORMAT "Lg" # define DOUBLEST_SCAN_FORMAT "%Lg" #else typedef double DOUBLEST; -# define DOUBLEST_PRINT_FORMAT "%g" +# define DOUBLEST_PRINT_FORMAT "g" # define DOUBLEST_SCAN_FORMAT "%lg" /* If we can't scan or print long double, we don't want to use it anywhere. */ --=-UCZbRyzZ9AyUO0DZSmKK--