This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Duplicate GCC warnings
- From: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- To: Ralf CorsÃpius <corsepiu at gcc dot gnu dot org>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, Joel Sherrill <Joel dot Sherrill at oarcorp dot com>
- Date: Sat, 24 Oct 2009 09:18:20 +0100
- Subject: Re: Duplicate GCC warnings
- References: <4AE28B33.9020405@gcc.gnu.org>
Ralf CorsÃpius wrote:
> I am observing this behavior with
> * all linux->rtems4.9/newlib (gcc-4.3.2/newlib-1.16.x) cross gccs
> * all linux->rtems4.10/newlib (gcc-4.4.2/newlib-1.17.x) cross gccs
> * linux->cygwin/newlib cross gccs (gcc 3.4.4; built from cygwin sources)
>
> I am not observing this behavior for linux->rtems4.8/newlib
> (gcc-4.2.x/newlib-1.15.x) cross gccs,
> nor for other (non-newlib-based) Linux-cross gccs.
I see it on Cygwin HEAD native.
> Any hint for what to look into, rsp. what might be wrong with these
> toolchains?
One of those warning lines is generated when the arguments fail to match
against the format attributes on the prototype from stdio.h, and the other is
generated when the arguments fail to match against the format attributes on
the printf builtin. You can get rid of the first warning by using your
NOSTDIO define (or just not including stdio.h), and you can get rid of the
second by -fno-builtin:
> $ /gnu/gcc/install-tsaware/opt/gcc-tools/bin/gcc-4.exe -Wall -c -o tmp.o tmp.c
> --save-temps
> tmp.c: In function 'main':
> tmp.c:9:3: warning: format '%d' expects type 'int', but argument 2 has type 'cha
> r *'
> tmp.c:9:3: warning: format '%d' expects type 'int', but argument 2 has type 'cha
> r *'
> tmp.c:10:1: warning: control reaches end of non-void function
>
> admin@ubik ~
> $ /gnu/gcc/install-tsaware/opt/gcc-tools/bin/gcc-4.exe -Wall -c -o tmp.o tmp.c
> --save-temps -DNOSTDIO
> tmp.c: In function 'main':
> tmp.c:9:3: warning: format '%d' expects type 'int', but argument 2 has type 'cha
> r *'
> tmp.c:10:1: warning: control reaches end of non-void function
>
> admin@ubik ~
> $ /gnu/gcc/install-tsaware/opt/gcc-tools/bin/gcc-4.exe -Wall -c -o tmp.o tmp.c
> --save-temps -fno-builtin
> tmp.c: In function 'main':
> tmp.c:9:3: warning: format '%d' expects type 'int', but argument 2 has type 'cha
> r *'
> tmp.c:10:1: warning: control reaches end of non-void function
>
> admin@ubik ~
> $ /gnu/gcc/install-tsaware/opt/gcc-tools/bin/gcc-4.exe -Wall -c -o tmp.o tmp.c
> --save-temps -DNOSTDIO -fno-builtin
> tmp.c: In function 'main':
> tmp.c:10:1: warning: control reaches end of non-void function
>
> admin@ubik ~
> $
This is kinda vaguely like the trouble we're having with the prototypes for
builtins disagreeing from user prototypes in pr41020.
cheers,
DaveK