[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] build: avoid printf format mismatch warnings
From: |
Jim Meyering |
Subject: |
Re: [PATCH] build: avoid printf format mismatch warnings |
Date: |
Tue, 29 Sep 2009 20:09:18 +0200 |
Nicolas Joly wrote:
> On Tue, Sep 29, 2009 at 01:14:05PM -0400, Joel E. Denny wrote:
> [...]
>> With the following test program, I haven't persuaded gcc to give me a
>> warning or error:
>>
>> % cat >tmp.c <<EOF
>> #include <stdio.h>
>> int
>> main (void)
>> {
>> size_t i = 0;
>> printf ("%d\n", i);
>> return 0;
>> }
>> EOF
>> % gcc -std=gnu99 -Wall -Wextra -Wno-sign-compare -Wcast-align -Wcast-qual
>> -Wformat -Wpointer-arith -Wwrite-strings -Wbad-function-cast
>> -Wmissing-declarations -Wmissing-prototypes -Wshadow -Wstrict-prototypes
>> -Werror tmp.c
>>
>> Any ideas?
>
> You'll have a warning on archs where sizeof(size_t) != sizeof(int)
> such as x86_64 ...
I think you've nailed it.
That's definitely why it's happening for me. I'm using x86_64.
Mustn't forget that systems with 32-bit size_t still exist.
- [PATCH] build: avoid printf format mismatch warnings, Jim Meyering, 2009/09/29
- Re: [PATCH] build: avoid printf format mismatch warnings, Joel E. Denny, 2009/09/29
- Re: [PATCH] build: avoid printf format mismatch warnings, Jim Meyering, 2009/09/29
- Re: [PATCH] build: avoid printf format mismatch warnings, Joel E. Denny, 2009/09/29
- Re: [PATCH] build: avoid printf format mismatch warnings, Joel E. Denny, 2009/09/29
- Re: [PATCH] build: avoid printf format mismatch warnings, Jim Meyering, 2009/09/29
- Re: [PATCH] build: avoid printf format mismatch warnings, Joel E. Denny, 2009/09/29
- Re: [PATCH] build: avoid printf format mismatch warnings, Jim Meyering, 2009/09/29
- Re: [PATCH] build: avoid printf format mismatch warnings, Nicolas Joly, 2009/09/29
- Re: [PATCH] build: avoid printf format mismatch warnings,
Jim Meyering <=
- Re: [PATCH] build: avoid printf format mismatch warnings, Joel E. Denny, 2009/09/29
Re: [PATCH] build: avoid printf format mismatch warnings, Eric Blake, 2009/09/29