Bug 216935 - Q_OBJECT macro parse error while code import process.
Summary: Q_OBJECT macro parse error while code import process.
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Ralf Habacker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-01 14:13 UTC by Eugene Rudenko
Modified: 2014-01-29 06:28 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.12.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Rudenko 2009-12-01 14:13:20 UTC
Version:           2.3.2 (using KDE 4.3.2)
OS:                Linux
Installed from:    Ubuntu Packages

Hello.
There are problem while importing Qt-based sources.
Umbrello parse Q_OBJECT macro incorrect. For example such code:

class MyClass: public QObject
{
    Q_OBJECT
public:
    void method1();
...................

While parsing I got "Q_OBJECTpublic" class in my tree and method1 is private of course, because "public" directive was incorrectly translated.

Also It will be good to understand base Qt's macros while importing the source code, such as Q_DECLARE_PUBLIC, Q_DECLARE_PRIVATE, Q_Q, Q_D, SIGNALS, SLOTS, QFLAG, QPROPERTY and so on.
Comment 1 Ralf Habacker 2011-12-27 06:55:43 UTC
The bug is also present on windows in recent svn code, which means that umbrello is currently unusable for importing any qt based code. This includes the whole kde base.
Comment 2 Ralf Habacker 2011-12-27 07:29:17 UTC
This bug is fixed in the kdevelop4 cpp parser.
Comment 3 Ralf Habacker 2012-01-04 11:02:03 UTC
Further analysis shows that the lexer, which is based on boost::spirit, returned  'Q_OBJECT' concated with the following term 'public:'.

I tried to follow the calls into the boost spirit library, but get lost in the very deep call tree. 

When this worked before (which I assume) I guess that the problem is caused by a bug or internal change in newer versions of the boost::spirit parser. 

In case of an internal change it may be that there is a different or additional boost::spirit setup required, which umbrello does not follow.
Comment 4 Ralf Habacker 2012-01-04 11:05:35 UTC
To be complete: 

I also tried to add Q_OBJECT to the "lexer should skip word" list, but this do not fix the problem. 

In the lexer code there are also some hardcoded checks for Q_.. related stuff, where I added Q_OBJECT; unfortunally without any success.
Comment 5 Ralf Habacker 2014-01-21 20:47:35 UTC
Git commit 959e40b8e0de02af21ccb93b77b2cde39dda81db by Ralf Habacker.
Committed on 20/01/2014 at 21:31.
Pushed by habacker into branch 'master'.

Add debug support to class Parser, Lexer and PreprocessLexer.

This should help to find cpp parse problems easier.

Debug support can be enabled for several classes through the debug window (STRG-D).

M  +2    -0    umbrello/codeimport/kdevcppparser/lexer.cpp
M  +2    -1    umbrello/codeimport/kdevcppparser/lexer.h
M  +113  -111  umbrello/codeimport/kdevcppparser/parser.cpp
M  +2    -1    umbrello/codeimport/kdevcppparser/parser.h
M  +2    -0    umbrello/codeimport/kdevcppparser/preprocesslexer.cpp
M  +2    -1    umbrello/codeimport/kdevcppparser/preprocesslexer.h

http://commits.kde.org/umbrello/959e40b8e0de02af21ccb93b77b2cde39dda81db
Comment 6 Ralf Habacker 2014-01-21 20:47:36 UTC
Git commit fa356a629dbef8b352d9d3d71a5df830454a7c38 by Ralf Habacker.
Committed on 21/01/2014 at 20:30.
Pushed by habacker into branch 'master'.

Fix Q_OBJECT macro parse error.
FIXED-IN:2.12.2,4.11.6

M  +6    -1    umbrello/codeimport/kdevcppparser/preprocesslexer.cpp

http://commits.kde.org/umbrello/fa356a629dbef8b352d9d3d71a5df830454a7c38
Comment 7 Ralf Habacker 2014-01-22 17:46:00 UTC
Git commit 0047de9c3e3767c7dd159de7e626f3daf1eb16f0 by Ralf Habacker.
Committed on 21/01/2014 at 20:30.
Pushed by habacker into branch 'KDE/4.12'.

Fix Q_OBJECT macro parse error.
FIXED-IN:2.12.2,4.11.6
(cherry picked from commit fa356a629dbef8b352d9d3d71a5df830454a7c38)

M  +6    -1    umbrello/codeimport/kdevcppparser/preprocesslexer.cpp

http://commits.kde.org/umbrello/0047de9c3e3767c7dd159de7e626f3daf1eb16f0
Comment 8 Ralf Habacker 2014-01-22 19:57:53 UTC
Git commit e1b421517ec1825b7c822c04c761adc789d91e38 by Ralf Habacker.
Committed on 21/01/2014 at 20:30.
Pushed by habacker into branch 'KDE/4.11'.

Fix Q_OBJECT macro parse error.
FIXED-IN:4.11.6
(cherry picked from commit fa356a629dbef8b352d9d3d71a5df830454a7c38)

M  +6    -1    umbrello/codeimport/kdevcppparser/preprocesslexer.cpp

http://commits.kde.org/umbrello/e1b421517ec1825b7c822c04c761adc789d91e38