Preprocessor and parsing

Shashank Chintalagiri shashank at chintal.in
Fri Feb 6 17:29:47 UTC 2015


Hi,

I've recently been trying to use kdevelop to build some embedded code, and
seem to have run into a rather trying glitch.

A lot of the code, both within the header files and libraries that I intend
to use and the code that I intend to write, depends heavily on preprocessor
directives - most importantly the -mmcu compiler flag and the directives it
generates. In the absence of this directive, the preprocessor dumps out of
most of the header files because it doesn't know which processor it should
set up the defines for.

Some very old posts on the internets suggested that kdevelop 3.x did, at
some point, have the ability to add extra preprocessor directives to the
parser. Try as I might, I can't find anything like that on 4.6.0, which
makes using kdevelop for this disturbing.

So here's what I would like to know / request :

* Is there a way to specify custom preprocessor defines for the parser in
kdevelop? During the build cmake provides the necessary flags to the
compiler and the build works fine - I just need to be able to set some
relatively sane default during development to make autocomplete and
crossreferencing work within the editor and kdevelop.

* If not, is there some way a custom environment setting could be used to
achieve the same effect?

* Is there any way in which kdevelop's parser announces itself to the
preprocessor? While not ideal (since it'll probably need to go into
multiple files), it should be fundamentally sufficient if I could do
something like :

#ifdef KDEVELOP_PARSER
#define __MSP4305529__ (or what have you)
#endif

This would allow the code to compile fine while being compatible with the
IDE.

Thanks
Shashank
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20150206/d51af406/attachment.html>


More information about the KDevelop-devel mailing list