Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix compiler warnings
@ 2002-08-23 17:57 Mark Kettenis
  2002-08-25  6:48 ` Andrew Cagney
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Kettenis @ 2002-08-23 17:57 UTC (permalink / raw)
  To: gdb-patches

On the alpha LONGEST is symply a long.  Therefore, on alpha systems
that support long long, this will lead to a format string warning.
The attached patch fixes this.

Mark

Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* valprint.c (print_longest) [CC_HAS_LONG_LONG &&
	PRINTF_HAS_LONG_LONG]: Cast val_long to (long long) or (unsigned
	long long) to prevent compiler warning on 64-bit systems.

Index: valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/valprint.c,v
retrieving revision 1.27
diff -u -p -r1.27 valprint.c
--- valprint.c 29 Jul 2002 16:34:07 -0000 1.27
+++ valprint.c 24 Aug 2002 00:35:10 -0000
@@ -332,7 +332,7 @@ print_longest (struct ui_file *stream, i
       fprintf_filtered (stream,
 			use_local ? local_decimal_format_custom ("ll")
 			: "%lld",
-			val_long);
+			(long long) val_long);
       break;
     case 'u':
       fprintf_filtered (stream, "%llu", (long long) val_long);
@@ -341,13 +341,13 @@ print_longest (struct ui_file *stream, i
       fprintf_filtered (stream,
 			use_local ? local_hex_format_custom ("ll")
 			: "%llx",
-			val_long);
+			(unsigned long long) val_long);
       break;
     case 'o':
       fprintf_filtered (stream,
 			use_local ? local_octal_format_custom ("ll")
 			: "%llo",
-			val_long);
+			(unsigned long long) val_long);
       break;
     case 'b':
       fprintf_filtered (stream, local_hex_format_custom ("02ll"), val_long);


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix compiler warnings
  2002-08-23 17:57 [PATCH] Fix compiler warnings Mark Kettenis
@ 2002-08-25  6:48 ` Andrew Cagney
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 2002-08-25  6:48 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

> On the alpha LONGEST is symply a long.  Therefore, on alpha systems
> that support long long, this will lead to a format string warning.
> The attached patch fixes this.
> 
> Mark
> 
> Index: ChangeLog
> from  Mark Kettenis  <kettenis@gnu.org>
> 
> 	* valprint.c (print_longest) [CC_HAS_LONG_LONG &&
> 	PRINTF_HAS_LONG_LONG]: Cast val_long to (long long) or (unsigned
> 	long long) to prevent compiler warning on 64-bit systems.

Mumble something about wanting to eliminate #ifdef PRINTF_HAS_LONG_LONG :-)

Andrew



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-08-25 13:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-23 17:57 [PATCH] Fix compiler warnings Mark Kettenis
2002-08-25  6:48 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox