Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
Qt Creator 4.2.0
-
None
Description
In one of the recent versions of Qt (5.5 I think) the issue of Clang compiler warning about missing override specifier in Q_OBJECT macro has been resolved by disabling said warning for the macro. The defines rely on the information about used compiler and thus the fix does not work when using only the Clang Code Model through Qt Creator plugin and not the Clang compiler itself.
Steps to reproduce:
1. Open Qt Creator and use non-Clang compiler
1. Enable Clang Code Model plugin in Qt Creator
2. Create a project and derive a class from QObject (include Q_OBJECT macro)
3. Create another class that derives from the class created in step 2.
Clang Code Model will issue warning about the override specifiers missing in the Q_OBJECT macro.
Suggested solution:
Since Q_OBJECT is only used in QObject class and in classes derived from it I would suggest creating a separate macro for QObject class (e.g. Q_OBJECT_BASE without any specifiers) and adding Q_DECL_OVERRIDE to the virtual methods in Q_OBJECT macro (used by subclasses). That will satisfy the Clang static analysis and it would not be even needed to use Q_OBJECT_NO_OVERRIDE_WARNING I believe.
Attachments
Issue Links
- is replaced by
-
QTCREATORBUG-18621 Clang: Q_OBJECT generates override warnings (-Winconsistent-missing-override)
- Closed
- relates to
-
QTCREATORBUG-17460 Clang: Need to suppress warnings about warnings not suppressed
- Closed