Red Hat Bugzilla – Bug 22913
gcc -traditional error on stdio.h
Last modified: 2016-11-24 10:00:41 EST
This problem lives in glibc-2.2-9 and also in earlier versions.
gcc -traditional does not like these recursive macros
/* C89/C99 say they're macros. Make them happy. */
#define stdin stdin
#define stdout stdout
#define stderr stderr
This results in a warning and the output is invalid C code.
Perhaps the above should be wraped with
#if defined __STDC__ ... #endif
This is also the cause of warnings from /usr/X11R6/bin/makedepend .
BTW: cpp from gcc-2.96-69 does not define the macro __STDC_VERSION__ !!
(when -traditional is not set, 'info cpp' sais it should!), I think
that should be a separate bug report.
I've added #ifdef __STDC__ around these defines.
As for why __STDC_VERSION__ is not defined, info cpp is wrong about
this. __STDC_VERSION__ is defined in ISO C94 and above, and as default
is -std=gnu89, it should not be defined. It will be only if
you request -std=c94, -std=c99 or -std=gnu99.