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: Duplicate GCC warnings


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


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