PATCH RFC: stdio optimization [take 3]

Kaveh R. Ghazi
Thu Jan 6 11:36:00 GMT 2000

 > From: "Kaveh R. Ghazi" <>
 > 	Here is my latest version 3 of the stdio optimizations.
 > 2.  I still need to make stdio-opt.h get included automatically.
 > Jeff's approach seems right to me, I can handle that.

Okay got the above.  It was easy.

But I noticed a new problem.  There's always one more ... :-)

Here's a short list from a .i file:

 > extern int fprintf(FILE*, const char *, ...);
 > [...]
 > typedef FILE __gcc_builtin_FILE;
 > [...]
 >   __builtin_initialize_FILE ();

The builtin copy of fprintf is declared in __builtin_initialize_FILE().
When this sequence is compiled, the builtin definition for fprintf is
not activated.  If, in the .i file, I manually remove the fprintf decl
or move it after __builtin_initialize_FILE(), then the builtin decl

I think the problem is that when duplicate decls occur, pushdecl (or
really duplicate_decls) only accept the builtin one if it came first.

I'd like to seek suggestions on the best way to relax this condition
in the C & C++ front ends.  Given that I must have FILE declared
before the builtin decl of fprintf, and that the same header (stdio.h)
which declares FILE also declares fprintf, I must support having the
extern decl of fprintf appear before the builtin one.

Speak now, or risk having me come up with a bad hack. :-)

Kaveh R. Ghazi			Engagement Manager / Project Services		Qwest Internet Solutions

More information about the Gcc-patches mailing list