This is the mail archive of the
mailing list for the GCC project.
RE: undefined declaration in pre-processed generated C file
- From: "Dave Korn" <dave dot korn at artimi dot com>
- To: "'GALLEGGIANTI Bruno'" <bruno dot galleggianti at cea dot fr>, <gcc at gcc dot gnu dot org>
- Date: Thu, 30 Mar 2006 14:13:58 +0100
- Subject: RE: undefined declaration in pre-processed generated C file
On 30 March 2006 13:52, GALLEGGIANTI Bruno wrote:
> typedef __builtin_va_list __gnu_va_list;
> My problem is that __builtin_va_list is never declared/defined in the
> pre-processed file. I've no warning about that (-Wall option)
> Following this behaviour, I have 3 questions:
> 1) How does gcc compiler resolve this typedef (before link stage) ?
It's magic. Gcc knows about all builtins automatically because they are
implemented in code inside the compiler. For more details about how stdargs
work, run "info gccint" and browse the section about "Implementing the Varargs
Macros". If you're really curious, the __builtin_va_list struct is (IIRC)
generally the same struct as whatever the backend defines as CUMULATIVE_ARGS -
read the info page about "Passing Arguments in Registers".
> 2) Is there a gcc option that can remove this type of definition in
> pre-processed files? I think it's not possible before link stage.
Would "grep -v 'typedef __builtin' <sourcefile.i >newsourcefile.i" do the
job you're after?
The real question
> 3) Is there a possibility to obtain pre-processed C source file after
> link phase (without optimization)?
Nope, that doesn't make sense; first, by link time, the C has already been
turned into assembler long ago; second, optimisation is not applied to the C
source but to the internal representation.
What are you /actually/ trying to do?
Can't think of a witty .sigline today....