C++ Parser and gcc internal defines
Esben Mose Hansen
kde at mosehansen.dk
Fri May 28 20:28:56 BST 2010
On Friday 28 May 2010 17:40:05 Gunther Piez wrote:
> Eclipse does it this way: It invokes a "Generate scanner info command",
> which looks like "g++ -E -P -v ${COMPILE_FLAGS} empty.c" on an empty
> file. If you have eclipse installed you find it at
> "Project/Properties/Discovery Options" or you can simply try the command
> above to see what it yields.
Hm, that gives me the flags used, but no the defines.
g++ -E -dM ${COMPILE_FLAGS} empty.c
does give me most of the predefined macros, with notable exceptions of (from
memory)
__FUNC__
__LINE__
__FILE__
__FUNCTION__
__PRETTY_FUNCTION__
__func__
There might be more, but those are quite common and will all need special
handling. Some are even required by the standard, while others are gcc
extensions.
Example:__func__ is a standard identifier which expands to a const char*
const-typed variable that contains the function. __PRETTY_FUNCTION__ is almost
the same, but expands directly to e.g. "void foo(int)". Fun, right?
I'm not sure kdevelop needs to be able to actually expand these at first try;
merely making them mesh with the type system might be enough at first.
--
Kind regards, Esben
More information about the KDevelop
mailing list