Hi,
with this code-snippet below, some gcc's emit printf-format
warnings twice when including <stdio.h>, but don't do so when
not including <stdio.h>:
Example:
# i386-rtems4.10-gcc -Wall -c -o tmp.o tmp.c
tmp.c: In function 'main':
tmp.c:9: warning: format '%d' expects type 'int', but argument 2 has
type 'char *'
tmp.c:9: warning: format '%d' expects type 'int', but argument 2 has
type 'char *'
tmp.c:10: warning: control reaches end of non-void function
# i386-rtems4.10-gcc -Wall -c -o tmp.o tmp.c -DNOSTDIO
tmp.c: In function 'main':
tmp.c:9: warning: format '%d' expects type 'int', but argument 2 has
type 'char *'
tmp.c:10: warning: control reaches end of non-void function
# cat tmp.c
-- snip --
#ifndef NOSTDIO
#include <stdio.h>
#else
extern int printf(const char *format, ...);
#endif
int main(void)
{
printf ("%d", "hello");
}
-- snip --
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.
Any hint for what to look into, rsp. what might be wrong with these
toolchains?
TIA,
Ralf