Semantic C preprocessor and Qt

Michael Kuryshev <[email protected]> Thu, 22 Jan 2015 06:52:28 +0300
Newsgroups gmane.emacs.cedet
Message-ID <[email protected]>
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"))

And simple file with Qt includes, same as in Alex Ott's posts:

    #include <QApplication>
    #include <QPushButton>

    int main(int argc, char *argv[])
    {
      QApplication app(argc, argv);
      QPushButton quit("Quit");
      quit.
      return 0;
    }

After parsing all include files, I'm issuing
`M-x semantic-ia-complete-tip' and getting this in *Messages* buffer:

    semantic-analyze-possible-completions-default: Cannot find types for `QPushButton quit ()'

`M-x semantic-analyze-debug-assist' yields:

    Unable to find datatype for: "class QPushButton quit ()".
    Declared type is: "class QPushButton {}"
    Raw data type is: ("QPushButton" type (:type "class") nil nil)

    Semantic could not find this data type in any of its global tables.

    Semantic locates datatypes through either the local scope, or the global
    typecache.

    Local Scope Information:
     * Tag Class Constraint against SCOPE: (type)
     * No known parents in current scope.
     * No known symbols currently in scope.
     * No known symbols declared locally.
    Semantic creates and maintains a type cache for each buffer.
    If the type is a global type, then it should appear in they typecache.
    To examine the typecache, type:

      M-x semanticdb-typecache-dump RET   [ Do It ]

    Current typecache Statistics:
        0 types global in this file
        350 types from includes.

    If the datatype is not in the typecache, then your include
    path may be incorrect.
    ---cut---

There is indeed no QPushButton in semanticdb-typecache-dump, only
QPushButtonPrivate.

Here is excerpt from /usr/include/QtGui/qpushbutton.h

    class QPushButtonPrivate;
    class QMenu;
    class QStyleOptionButton;

    class Q_GUI_EXPORT QPushButton : public QAbstractButton
    {

And when I'm looking at `M-x semantic-c-describe-environment' macro
`Q_GUI_EXPORT = nil' is present here. Maybe Semantic doesn't have
access to that table whenever it's parsing system headers? It's in
place right after opening main.cc file, EDE project definition is
working fine. I just have no idea what is wrong.

And everytime I'm starting with blank SemanticDB.

--
with best regards,
Michael Kuryshev.

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet