Bug 355486 - Qt classes false positives
Summary: Qt classes false positives
Status: RESOLVED FIXED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Other
: NOR minor
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-17 11:20 UTC by eric.lemanissier
Modified: 2015-11-18 15:46 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description eric.lemanissier 2015-11-17 11:20:52 UTC
I spotted the following warning for Qt classes. Can they be blacklisted ?

for rule-of : QTypedArrayData::iterator, QTypedArrayData::const_iterator, QBasicTimer, QItemSelectionRange, QJsonValueRef, QPointer, QQueue, QSet, QSet::iterato, QSet::const_iterator, QtSharedPointer::ExternalRefCountDat, QEnableSharedFromThis, QStack, QStandardPaths, QStringBuilder, QXmlStreamStringRef, QMatrix, QPolygon, QPolygonF, QTextFrame::iterator, QTextBlock, QTextFragment, QTouchDevice, QTransform, a great number of QStyleOption*** classes, QStyleHintReturnMask, QStyleHintReturnVariant 

for function-args-by-ref : QDate, QTime, QElapsedTimer, QPoint, QPointF, QLine, QRect  QSize, QSizeF , QSizePolicy, QTextItem, QTextLength, QTextOption::Tab, QVector2D, QJsonObject::iterator, QJsonObject::const_iterator, QMargins, QMetaMethod, QUuid 

Reproducible: Always
Comment 1 Sergio Martins 2015-11-17 19:47:39 UTC
We can blacklist some, others we should fix in Qt.

Which warning do you get with: QSizeF, and with QSize ?
Comment 2 eric.lemanissier 2015-11-18 06:22:58 UTC
Shall I report all these warnings on the qt bug tracker then ?

examples of QSize and QSizef function-args-by-ref warning:

../../../../Qt/5.5/gcc_64/include/QtCore/qsize.h:134:26: warning: Pass small and trivially-copyable type by value (const class QSize &) [-Wclazy-function-args-by-ref]
inline void QSize::scale(const QSize &s, Qt::AspectRatioMode mode) Q_DECL_NOTHROW

../../../../Qt/5.5/gcc_64/include/QtCore/qsize.h:299:27: warning: Pass small and trivially-copyable type by value (const class QSizeF &) [-Wclazy-function-args-by-ref]
inline void QSizeF::scale(const QSizeF &s, Qt::AspectRatioMode mode) Q_DECL_NOTHROW
Comment 3 Sergio Martins 2015-11-18 12:09:25 UTC
no need to report, I'll fix them eventually in Qt.

can you use -isystem instead of -I to include Qt headers ? That will silence those warnings for you
Comment 4 Sergio Martins 2015-11-18 12:59:34 UTC
Git commit 928ccc306223a38505a68f30ee9e81479674a336 by Sergio Martins.
Committed on 18/11/2015 at 12:59.
Pushed by smartins into branch 'master'.

README: Explain how to suppress warnings from Qt/3rdparty headers

M  +6    -0    README

http://commits.kde.org/clazy/928ccc306223a38505a68f30ee9e81479674a336
Comment 5 eric.lemanissier 2015-11-18 14:23:14 UTC
Thanks, but there is something I can't get right with -isystem, because I always get warnings regarding Qt classes:

clang++-3.6 -stdlib=libc++ -std=c++14 -Qunused-arguments -Xclang -load -Xclang ../installclazy/lib/x86_64-linux-gnu/ClangLazy.so -Xclang -add-plugin -Xclang clang-lazy -isystem../../../../Qt/5.5/gcc_64/include/QtCore (...) -I../../../../Qt/5.5/gcc_64/include/QtCore -I. -I. -I../../../../Qt/5.5/gcc_64/mkspecs/linux-g++ -o XXX.o XXX.cpp
In file included from XXX.cpp:2:
In file included from ../../../../Qt/5.5/gcc_64/include/QtWidgets/QHeaderView:1:
In file included from ../../../../Qt/5.5/gcc_64/include/QtWidgets/qheaderview.h:37:
In file included from ../../../../Qt/5.5/gcc_64/include/QtWidgets/qabstractitemview.h:39:
In file included from ../../../../Qt/5.5/gcc_64/include/QtCore/qitemselectionmodel.h:37:
../../../../Qt/5.5/gcc_64/include/QtCore/qset.h:46:1: warning: QSet has copy-ctor, copy-assignment but not dtor [-Wclazy-rule-of-three]
class QSet


I am using standard qmake to generate makefiles, and then invoking clazy with the following line:
make -k -s "CXX=clang++-3.6 -stdlib=libc++ -std=c++14 -Qunused-arguments -Xclang -load -Xclang ../installclazy/lib/x86_64-linux-gnu/ClangLazy.so -Xclang -add-plugin -Xclang clang-lazy -isystem$INC_PATH/QtCore -isystem$INC_PATH/QtGui -isystem$INC_PATH/QtWidgets"
Comment 6 Sergio Martins 2015-11-18 15:16:59 UTC
No idea about isystem, maybe because you also have -I ?
Anyway, re-opening because QSet doesn't have copy-ctor, so it shouldn't warn
Comment 7 Sergio Martins 2015-11-18 15:46:05 UTC
Git commit 870a3b1256a6fefa1c1978e527528938d1edca90 by Sergio Martins.
Committed on 18/11/2015 at 15:45.
Pushed by smartins into branch 'master'.

rule-of-three: Blacklist QSet. It's fixed in Qt 5.7

M  +2    -1    checks/ruleofbase.cpp

http://commits.kde.org/clazy/870a3b1256a6fefa1c1978e527528938d1edca90