Re: Semantic preprocessor and Qt
Eric Ludlam <[email protected]> Thu, 29 Jan 2015 19:46:37 -0500
| Newsgroups | gmane.emacs.cedet |
|---|---|
| Message-ID | <[email protected]> |
On 01/21/2015 10:21 PM, Michael Kuryshev wrote:
> I know this topic has been discussed too many times, but please bear
> with me.
>
> I have trouble with setting up Semantic and Qt sources. I've read
> mails here regarding this matter, there were some very useful insights
> regarding Semantics internals, but nothing works, thought it
> shoud(?).
> I'm using Fedora 21 with Emacs-24.4.1 (but can compile and test any
> version, if needed) and cedet from git repository
> (6a5701d76932259311ef412285ccd0701b5b31e5 commit, current HEAD).
>
> Here is my minimal .emacs:
>
> (load "~/.emacs.d/cedet/cedet-devel-load")
> (semantic-mode 1)
> (semantic-load-enable-excessive-code-helpers)
> (add-to-list 'auto-mode-alist '("/usr/include" . c++-mode))
> (global-ede-mode t)
> (require 'semantic/ia)
> (require 'semantic/bovine/gcc)
> (require 'semantic/analyze/debug)
> (ede-cpp-root-project "test-cedet"
> :file "/tmp/test-cedet/main.cc"
> :spp-files '("/usr/include/Qt/qconfig.h"
> "/usr/include/Qt/qconfig-dist.h"
> "/usr/include/Qt/qglobal.h"))
Hi,
I'm pretty sure you need to add those Qt headers to the GLOBAL list of
files in semantic-lex-c-preprocessor-symbol-file. They are certainly
handy in your project, but the headers need these symbols when they are
parsed too.
Since the headers are not in your project, they get parsed differently.
This is very unlike how the compiler does it because we only parse
headers once for all locations they are included from, not once every
time they are included. This is for performance reasons, and because it
usually doesn't matter.
I suppose if you don't want those symbols in your global tables, you
could create an ede-cpp-root-project in /usr/include/Qt too. I hadn't
thought of that trick before. Worth a shot.
From Alex's article, it says to use:
(setq qt4-base-dir "/usr/include/qt4")
(semantic-add-system-include qt4-base-dir 'c++-mode)
(add-to-list 'auto-mode-alist (cons qt4-base-dir 'c++-mode))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat
qt4-base-dir "/Qt/qconfig.h"))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat
qt4-base-dir "/Qt/qconfig-dist.h"))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat
qt4-base-dir "/Qt/qglobal.h"))
Did you find reference somewhere suggesting the project idea you used
above would work?
I don't have Qt installed here so I don't have a good way to try things
out. Sorry.
I hope this helps.
Eric
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/