C++ Parser and gcc internal defines

Gunther Piez gpiez at web.de
Fri May 28 16:40:05 BST 2010

On Friday 28 May 2010 16:50:19 Jonathan Schmidt-Dominé - Developer wrote:
> Hi!
> I think KDevelop does not know about all these flags.
> But if you would create a list (it can be incomplete ;)) of such flags, it
> should not be too complicate to handle that in the cmake-support and we
> could easily fix it. It would be enough to pass the definitions to kdev's
> preprocessor if the flag occurs in cmake's add_definitions?

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.

The output are all the macros defined by the preprocessor, which are then used 
in the parser.  You get all the include/linker paths this way too, which is 
probably useful for the parser too.

This way you don't need to know anything about special flags or paths. This 
would probably be a cleaner solution. But I could provide a list of flags too, 
if you prefer - but they are subject to change as the compiler versions go 
by... ;-) How are the internal defines currently handled? There are many, and 
they are used in many different ways in many header files ;-)

- Gunther

More information about the KDevelop mailing list