[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 19:18:28 +0200 |
Joel E. Denny wrote:
> On Tue, 29 Sep 2009, Jim Meyering wrote:
>
>> Joel E. Denny wrote:
>>
>> > On Tue, 29 Sep 2009, Jim Meyering wrote:
>> >
>> >> Joel E. Denny wrote:
>> >> > On Tue, 29 Sep 2009, Jim Meyering wrote:
>> >> >> I tried to bootstrap/build "master" today, without
>> >> >> success, so switched to branch-2.5. There, ./bootstrap
>> >> >> succeeded, but the build failed with two like this:
>> >> >>
>> >> >> Sbitset.c: In function 'Sbitset__fprint':
>> >> >> Sbitset.c:75: error: format '%d' expects type 'int', but argument 3
>> >> >> has type 'Sbitset__Index
>> >> >
>> >> > Thanks for the report. I'm not seeing those failures with either gcc
>> >> > 4.2.4 or 4.3.4. Which gcc are you using?
>> >>
>> >> Hi Joel,
>> >>
>> >> I'm using the stock gcc on an up-to-date Fedora 11 system:
>> >>
>> >> gcc version 4.4.1 20090725 (Red Hat 4.4.1-2) (GCC)
>> >
>> > I built gcc 4.4.1 from source. I built Bison master and branch-2.5
>> > (before applying the Sbitset patch) with it, but I did not see any
>> > failures.
>> >
>> > Is there anything else in your environment that might matter? Do you set
>> > CFLAGS, for example?
>> >
>> > It would be nice to know where this is coming from so we can catch future
>> > problems.
>>
>> I configured with --enable-gcc-warnings (of course! doesn't everybody? ;-)
>
> I always do too, but I still didn't see the failures.
>
> Also, it looks like you got a hard error instead of a warning being
> treated as an error, so I'm not completely sure that --enable-gcc-warnings
> matters.
>
> 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
That works as expected for me.
Here's the output I get:
cc1: warnings being treated as errors
tmp.c: In function ‘main’:
tmp.c:6: error: format ‘%d’ expects type ‘int’, but argument 2 has type
‘size_t’
> Any ideas?
Upgrade to Fedora 11? ;-)
If you built gcc from source, did you run "make check"
and ensure that all of the tests passed?
- [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 <=
- Re: [PATCH] build: avoid printf format mismatch warnings, Nicolas Joly, 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, Eric Blake, 2009/09/29