Bug 329788 - Ability to define macros manually for the code parser.
Summary: Ability to define macros manually for the code parser.
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: 4.6.0
Platform: Kubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks: 324260
  Show dependency treegraph
 
Reported: 2014-01-10 00:46 UTC by Thiago Jung Bauermann
Modified: 2014-03-21 15:58 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thiago Jung Bauermann 2014-01-10 00:46:17 UTC
There are many projects which define important macros on the compiler's command line. KDevelop needs to provide a way for the user to specify these macros so that the parsed code makes sense.

Sometimes one can work around the problem by manually defining those macros in a header file that is included by every file in the project (if there is such a file). That is inconvenient though (you'll have to be careful not to commit those defines to the repository, and you'll have to unapply/apply again when moving to a different branch).

Besides, sometimes luck is not on your side and there is no such fortuitous file. I am currently struggling with a project like that. The only way I can think of overcoming this problem is to manually add an "#include kdev-macros.h" to every file in the project, which I'd rather not do.

Implementing the feature in bug 315705 would provide a workaround while this feature is not implemented.

This is point 1 in bug 324260.

Reproducible: Always
Comment 1 Daniel Santos 2014-03-03 23:07:56 UTC
Since the implementation of bug #315705, we may have a temporary work-around. By adding a header file that contains the macros we need defined we can now have that included auto-included. I haven't seen the patch that adds a GUI interface to manipulate this parentJob()->masterJob()->indexedIncludePaths() mentioned in the patch (https://projects.kde.org/projects/extragear/kdevelop/kdevelop/repository/revisions/236dbb9eea46f2f1e297dbd443e05fe7288b073b/diff), but I'm presuming it exists.  This doesn't completely resolve this issue, because there are other problems it may still not solve or leave very cumbersome, but it's a nice step forward.
Comment 2 Sergey Kalinichev 2014-03-21 15:58:06 UTC
Git commit 75170596d827cc150752b59b473e7046d1010dcf by Sergey Kalinichev.
Committed on 21/03/2014 at 13:58.
Pushed by skalinichev into branch 'master'.

Break Custom Buildsystem Plugin apart into 2 pieces.

Features:
*Now it's possible to define macros and add include directories/files through GUI.
*The GUI is always accessible by clicking on Project->Open Configuration.

Note that there is no relation between this plugin and .kdev_include_paths.
That is include directories from .kdev_include_paths are not accessible
from Custom defines and includes plugin and vice versa.
In future .kdev_include_paths file will be used only for out-of-project files.

Known shortcomings:
*After includes/defines modification, the project must be reloaded manually to apply the changes.
*Include files assistant stores data in .kdev_include_paths, but it should in .kdev4 file for in-project files.
*It's difficult to add many include directories at a time.
*...

Don't forget to run kbuildsycoca4.
Related: bug 254662
REVIEW: 115696


http://commits.kde.org/kdevelop/75170596d827cc150752b59b473e7046d1010dcf