This is the mail archive of the
mailing list for the GCC project.
RE: undefined declaration in pre-processed generated C file
- From: "GALLEGGIANTI Bruno" <bruno dot galleggianti at cea dot fr>
- To: "Dave Korn" <dave dot korn at artimi dot com>, <gcc at gcc dot gnu dot org>
- Date: Fri, 31 Mar 2006 09:57:36 +0200
- Subject: RE: undefined declaration in pre-processed generated C file
In fact, I'm working on the development of a concept validation tools, based on the source code (static approach).
I use a parser to read the pre-processed files, but I've found problem due to the __builtin_* declarations.
I though about grep action on preprocessed file, but this solution isn't completely agree with some cases that I encountered: I have the case where this type is used (such as in vsnprintf function).
But I think to have another solution that will work with my problematic.
I need to realize more tests to see all special cases like builtin case.
Thank you for your fast answer. It will help me for my development.
De?: Dave Korn [mailto:firstname.lastname@example.org]
Envoyé?: jeudi 30 mars 2006 15:14
À?: GALLEGGIANTI Bruno; email@example.com
Objet?: 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....