This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix warning in ggc-page about printf format


Andreas Jaeger <aj@suse.de> writes:

|> On a 64-bit host I get this warning:
|> /sources/gcc/gcc/gcc/ggc-page.c:1506: warning: int format, different type arg (arg 3)
|> 
|> The problem is that we're printing an entry of this array:
|> static size_t object_size_table[NUM_ORDERS];
|> 
|> with "%-5d".
|> 
|> Here's a patch.  Bootstrapped/regtested on i686-linux-gnu.
|> 
|> Ok to commit?
|> 
|> Andreas
|> 
|> 2002-05-21  Andreas Jaeger  <aj@suse.de>
|> 
|> 	* ggc-page.c (ggc_print_statistics): Avoid printf mismatch warnings.
|> 
|> 
|> ============================================================
|> Index: gcc/ggc-page.c
|> --- gcc/ggc-page.c	3 Mar 2002 14:07:19 -0000	1.49
|> +++ gcc/ggc-page.c	21 May 2002 07:17:23 -0000
|> @@ -1500,7 +1500,7 @@ ggc_print_statistics ()
|>  	  overhead += (sizeof (page_entry) - sizeof (long)
|>  		       + BITMAP_SIZE (OBJECTS_PER_PAGE (i) + 1));
|>  	}
|> -      fprintf (stderr, "%-5d %10ld%c %10ld%c %10ld%c\n", OBJECT_SIZE (i),
|> +      fprintf (stderr, "%-5ld %10ld%c %10ld%c %10ld%c\n", (long)OBJECT_SIZE (i),

IMHO this should rather use %lu and unsigned long, since size_t is an
unsigned type.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]