From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8289 invoked by alias); 23 Feb 2006 23:48:55 -0000 Received: (qmail 8278 invoked by uid 22791); 23 Feb 2006 23:48:51 -0000 X-Spam-Check-By: sourceware.org Received: from ip127.bb146.pacific.net.hk (HELO mailhub.stlglobal.com) (202.64.146.127) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 23 Feb 2006 23:48:50 +0000 Received: from localhost ([127.0.0.1]) by mailhub.stlglobal.com with esmtp (Exim 4.50) id 1FCQCV-0002NC-3G for gdb-patches@sources.redhat.com; Fri, 24 Feb 2006 07:48:47 +0800 Message-ID: <43FE49DF.8010101@tausq.org> Date: Thu, 23 Feb 2006 23:55:00 -0000 From: Randolph Chung User-Agent: Debian Thunderbird 1.0.2 (X11/20051002) MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: Fix DOUBLEST build warnings Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-02/txt/msg00447.txt.bz2 Building the latest gdb on hppa-linux, I found some warnings when DOUBLEST is double instead of long double (we have some long double issues on this platform at the moment, may also affect hppa-bsd) The attached patch fixes these. Tested with no regressions on hppa-linux, and it now builds with -Werror. OK to apply? One thing to note - DOUBLEST_FORMAT is only used in scanf format strings at the moment - for double args, the format string is different for scanf and printf, which may lead to some confusion. randolph 2006-02-23 Randolph Chung * doublest.h (DOUBLEST_FORMAT) [!HAVE_LONG_DOUBLE || !SCANF_HAS_LONG_DOUBLE]: Correct format string. * ada-lex.l (processReal): Use DOUBLEST-dependent format string. * valprint.c (print_floating): Cast long double argument to match format string. Index: doublest.h =================================================================== RCS file: /cvs/src/src/gdb/doublest.h,v retrieving revision 1.17 diff -u -p -r1.17 doublest.h --- doublest.h 14 Feb 2006 19:05:40 -0000 1.17 +++ doublest.h 23 Feb 2006 15:30:38 -0000 @@ -53,7 +53,7 @@ typedef long double DOUBLEST; # define DOUBLEST_FORMAT "%Lg" #else typedef double DOUBLEST; -# define DOUBLEST_FORMAT "%g" +# define DOUBLEST_FORMAT "%lg" /* If we can't scan or print long double, we don't want to use it anywhere. */ # undef HAVE_LONG_DOUBLE Index: ada-lex.l =================================================================== RCS file: /cvs/src/src/gdb/ada-lex.l,v retrieving revision 1.14 diff -u -p -r1.14 ada-lex.l --- ada-lex.l 8 Jan 2006 07:19:40 -0000 1.14 +++ ada-lex.l 23 Feb 2006 15:30:38 -0000 @@ -444,7 +444,7 @@ processReal (const char *num0) { #if defined (PRINTF_HAS_LONG_DOUBLE) if (sizeof (DOUBLEST) > sizeof (double)) - sscanf (num0, "%Lg", &yylval.typed_val_float.dval); + sscanf (num0, DOUBLEST_FORMAT, &yylval.typed_val_float.dval); else #endif { Index: valprint.c =================================================================== RCS file: /cvs/src/src/gdb/valprint.c,v retrieving revision 1.59 diff -u -p -r1.59 valprint.c --- valprint.c 18 Jan 2006 21:24:19 -0000 1.59 +++ valprint.c 23 Feb 2006 15:30:38 -0000 @@ -476,7 +476,7 @@ print_floating (const gdb_byte *valaddr, fprintf_filtered (stream, "%.17g", (double) doub); else #ifdef PRINTF_HAS_LONG_DOUBLE - fprintf_filtered (stream, "%.35Lg", doub); + fprintf_filtered (stream, "%.35Lg", (long double) doub); #else /* This at least wins with values that are representable as doubles. */