Bug 355496 - No old-style-connect anywhere in Qt Creator
Summary: No old-style-connect anywhere in Qt Creator
Status: RESOLVED NOT A BUG
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-17 14:43 UTC by Tobias Hunger
Modified: 2015-11-19 11:01 UTC (History)
2 users (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 Tobias Hunger 2015-11-17 14:43:18 UTC
We have lots of old-style connects in Qt Creator (git clone git://code.qt.io/qt-creator/qt-creator.git). 

So I though I set CLAZY_CHECKS=old-style-connect CLAZY_FIXIT=fix-old-style-connects, add QMAKE_CXX=/full/path/to/clazy to my qmake call and run the whole thing. The whole qmake line is this: 'qmake /home/code/src/creator/qtcreator.pro -r -spec linux-clang QMAKE_CFLAGS+="-Qunused-arguments" QMAKE_CXX="/home/code/installed/clazy/bin/clazy"' adopted from my normal clang build.

There is no warning whatsoever and git diff is empty for the project after the built is done.

What am I doing wrong?

PS: That it is "old-style-connect" and "fix-old-style-connects" must be the work of an evil master mind!

Reproducible: Always
Comment 1 Sergio Martins 2015-11-17 20:02:00 UTC
Git commit fbc60ace96ad267ad35fb7487a60ea890d9d3b90 by Sergio Martins.
Committed on 17/11/2015 at 19:59.
Pushed by smartins into branch 'master'.

s/fix-old-style-connects/fix-old-style-connect

The check name is also singular.

M  +1    -1    README
M  +1    -1    checks/oldstyleconnect.cpp
M  +4    -4    tests/clazy/test_requested_checks.sh

http://commits.kde.org/clazy/fbc60ace96ad267ad35fb7487a60ea890d9d3b90
Comment 2 Sergio Martins 2015-11-18 14:15:51 UTC
Can you test:

mkdir /tmp/clazy
cd <clazy_src_dir>
git clean -fdx
git pull
cmake -DCMAKE_INSTALL_PREFIX=/tmp/clazy/
make && make install

export PATH=/tmp/clazy/bin/:$PATH
export LD_LIBRARY_PATH=/tmp/clazy/lib64/:$LD_LIBRARY_PATH

cd <some_other folder>

Create a .pro and a main.cpp with this contents:
TEMPLATE = app
TARGET = test
INCLUDEPATH += .
SOURCES += main.cpp
CONFIG += C++11

main.cpp:

#include <QObject>

int main()
{
    QObject *o = nullptr;
    QObject::connect(o, SIGNAL(destroyed()), o, SLOT(deleteLater()));
}

qmake -spec linux-clang QMAKE_CXX=/tmp/clazy/bin/clazy
make
Comment 3 Sergio Martins 2015-11-18 15:51:32 UTC
be sure to start with a new terminal
unset CLAZY_FIXIT
unset CLAZY_CHECKS

if needed

old-style-connect is a level1 check, so runs by default if no checks are specified
Comment 4 Tobias Hunger 2015-11-18 16:01:25 UTC
Your test produces a warning.

Running qmake as I do within Qt Creator (qmake -r -spec linux-clang 'QMAKE_CXXFLAGS=-Xclang -load -Xclang /home/code/installed/clazy/lib64/ClangLazy.so -Xclang -add-plugin -Xclang clang-lazy -Xclang -plugin-arg-clang-lazy -Xclang "old-style-connect,fix-old-style-connect"') also produces a warning with your example, but it does not change the code.

Qt Creator itself is still totally without any old style connects according to clazy.
Comment 5 Tobias Hunger 2015-11-18 16:16:10 UTC
Running e.g.

clang++ -c -Xclang -load -Xclang /home/code/installed/clazy/lib64/ClangLazy.so -Xclang -add-plugin -Xclang clang-lazy -Xclang -plugin-arg-clang-lazy -Xclang old-style-connect,fix-old-style-connect -g -std=gnu++11 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DEXTENSIONSYSTEM_LIBRARY -DWITH_TESTS -DIDE_LIBRARY_BASENAME=\"lib\" -DQT_CREATOR -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_USE_FAST_OPERATOR_PLUS -DQT_USE_FAST_CONCATENATION -DIDE_TEST_DIR=\"/home/code/src/creator/qtcreator\" -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_TESTLIB_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR='"/home/code/build/creator-clang-no-asan-clazy/qtcreator/src/libs/extensionsystem"' -I../../../src -I/home/code/src/creator/qtcreator/src/libs -I/home/code/src/creator/qtcreator/tools -I/home/code/src/creator/licensechecker/plugins -I/home/code/src/creator/perfprofiler/plugins -I/home/code/src/creator/qtcreator/src/plugins -I/home/code/src/qt5-dev-build/qtbase/include -I/home/code/src/qt5-dev-build/qtbase/include/QtWidgets -I/home/code/src/qt5-dev-build/qtbase/include/QtGui -I/home/code/src/qt5-dev-build/qtbase/include/QtTest -I/home/code/src/qt5-dev-build/qtbase/include/QtConcurrent -I/home/code/src/qt5-dev-build/qtbase/include/QtCore -I.moc/debug-shared -I.uic -I/home/code/src/qt5-dev/qtbase/mkspecs/linux-clang -o .obj/debug-shared/pluginmanager.o src/libs/extensionsystem/pluginmanager.cpp

(which is what I run in Qt Creator) does *also* produce the expected warning output on the command line... Now what is different between QtC and the terminal?!
Comment 6 Tobias Hunger 2015-11-18 16:23:03 UTC
Running inside Qt Creator with out giving any checks does get me lots of reports like "warning: QString(QLatin1String) being called [-Wclazy-qstring-uneeded-heap-allocations]", but not a single one about out-style-connects.

What is different between old-style-connect and the other checks?
Comment 7 Tobias Hunger 2015-11-19 09:56:07 UTC
Adding "-Xclang -plugin-arg-clang-lazy -Xclang print-requested-checks" to my qmake call gets me this:

Requested checks: auto-unexpected-qstringbuilder, detaching-temporary, foreach, non-pod-global-static, old-style-connect, qdatetime-utc, qdeleteall, qgetenv, qmap-with-key-pointer, qstring-arg, qstring-ref, qstring-uneeded-heap-allocations, range-loop, temporary-iterator, variant-sanitizer, writing-to-temporary

I do get several thousand warnings, from clazy, but nothing about old-style-connects when running the build in Qt Creator.
Comment 8 Tobias Hunger 2015-11-19 09:57:36 UTC
The additional arguments I pass on to clang for clazy from Qt Creator are these now: 'QMAKE_CXXFLAGS=-Xclang -load -Xclang /home/code/installed/clazy/lib64/ClangLazy.so -Xclang -add-plugin -Xclang clang-lazy -Xclang -plugin-arg-clang-lazy -Xclang print-requested-checks'
Comment 9 Sergio Martins 2015-11-19 10:12:33 UTC
Does it make any difference with:
 -DLLVM_VERSION_MAJOR=3  -DLLVM_VERSION_MINOR=7
Comment 10 Tobias Hunger 2015-11-19 11:01:12 UTC
Aaaarggg! I found it: ccache kept the no-output version cached. Sorry for the unnecessary noise.