From 5bac56935c2ed02c4fd4fbf5ea3ca993c3967457 Mon Sep 17 00:00:00 2001 From: firewave Date: Mon, 27 Feb 2023 16:07:45 +0100 Subject: [PATCH 1/8] ThreadResult: replaced unnecessary `QMutex` usage with `std::mutex` - also avoids `-Wctad-maybe-unsupported` Clang compiler warnings with Qt6 --- gui/threadresult.cpp | 16 ++++++++-------- gui/threadresult.h | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gui/threadresult.cpp b/gui/threadresult.cpp index 52d683414a8..8eb625e2e52 100644 --- a/gui/threadresult.cpp +++ b/gui/threadresult.cpp @@ -35,7 +35,7 @@ void ThreadResult::reportOut(const std::string &outmsg, Color /*c*/) void ThreadResult::fileChecked(const QString &file) { - QMutexLocker locker(&mutex); + std::lock_guard locker(mutex); mProgress += QFile(file).size(); mFilesChecked++; @@ -50,7 +50,7 @@ void ThreadResult::fileChecked(const QString &file) void ThreadResult::reportErr(const ErrorMessage &msg) { - QMutexLocker locker(&mutex); + std::lock_guard locker(mutex); const ErrorItem item(msg); if (msg.severity != Severity::debug) emit error(item); @@ -60,7 +60,7 @@ void ThreadResult::reportErr(const ErrorMessage &msg) QString ThreadResult::getNextFile() { - QMutexLocker locker(&mutex); + std::lock_guard locker(mutex); if (mFiles.isEmpty()) { return QString(); } @@ -70,7 +70,7 @@ QString ThreadResult::getNextFile() ImportProject::FileSettings ThreadResult::getNextFileSettings() { - QMutexLocker locker(&mutex); + std::lock_guard locker(mutex); if (mFileSettings.empty()) { return ImportProject::FileSettings(); } @@ -81,7 +81,7 @@ ImportProject::FileSettings ThreadResult::getNextFileSettings() void ThreadResult::setFiles(const QStringList &files) { - QMutexLocker locker(&mutex); + std::lock_guard locker(mutex); mFiles = files; mProgress = 0; mFilesChecked = 0; @@ -97,7 +97,7 @@ void ThreadResult::setFiles(const QStringList &files) void ThreadResult::setProject(const ImportProject &prj) { - QMutexLocker locker(&mutex); + std::lock_guard locker(mutex); mFiles.clear(); mFileSettings = prj.fileSettings; mProgress = 0; @@ -113,7 +113,7 @@ void ThreadResult::setProject(const ImportProject &prj) void ThreadResult::clearFiles() { - QMutexLocker locker(&mutex); + std::lock_guard locker(mutex); mFiles.clear(); mFileSettings.clear(); mFilesChecked = 0; @@ -122,6 +122,6 @@ void ThreadResult::clearFiles() int ThreadResult::getFileCount() const { - QMutexLocker locker(&mutex); + std::lock_guard locker(mutex); return mFiles.size() + mFileSettings.size(); } diff --git a/gui/threadresult.h b/gui/threadresult.h index 4e32a1cbef2..80ef39b6376 100644 --- a/gui/threadresult.h +++ b/gui/threadresult.h @@ -25,9 +25,9 @@ #include "importproject.h" #include +#include #include -#include #include #include #include @@ -127,7 +127,7 @@ public slots: * @brief Mutex * */ - mutable QMutex mutex; + mutable std::mutex mutex; /** * @brief List of files to check From 76b4009a821ab010d76e1a3e99296c0905152718 Mon Sep 17 00:00:00 2001 From: firewave Date: Mon, 27 Feb 2023 16:13:46 +0100 Subject: [PATCH 2/8] switched CMake GUI builds in CI to Qt6 --- .github/workflows/CI-unixish.yml | 40 +++++++++++++++++++++++++------- .github/workflows/CI-windows.yml | 2 +- .github/workflows/clang-tidy.yml | 4 ++-- .github/workflows/iwyu.yml | 1 + .github/workflows/selfcheck.yml | 8 +++---- 5 files changed, 40 insertions(+), 15 deletions(-) diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml index c5f29ff73fd..a8a9b42cf17 100644 --- a/.github/workflows/CI-unixish.yml +++ b/.github/workflows/CI-unixish.yml @@ -20,6 +20,10 @@ jobs: strategy: matrix: os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12] + include: + - use_qt6: On + - os: ubuntu-20.04 + use_qt6: Off fail-fast: false # Prefer quick result runs-on: ${{ matrix.os }} @@ -37,28 +41,36 @@ jobs: key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} - name: Install missing software on ubuntu - if: contains(matrix.os, 'ubuntu') + if: contains(matrix.os, 'ubuntu') && matrix.use_qt6 == 'Off' run: | sudo apt-get update sudo apt-get install libxml2-utils libtinyxml2-dev qtbase5-dev qttools5-dev libqt5charts5-dev qtchooser + - name: Install missing software on ubuntu + if: contains(matrix.os, 'ubuntu') && matrix.use_qt6 == 'On' + run: | + sudo apt-get update + # qt6-tools-dev-tools for lprodump + # qt6-l10n-tools for lupdate + sudo apt-get install libxml2-utils libtinyxml2-dev qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev + # coreutils contains "nproc" - name: Install missing software on macos if: contains(matrix.os, 'macos') run: | # pcre was removed from runner images in November 2022 - brew install coreutils qt@5 tinyxml2 pcre + brew install coreutils qt@6 tinyxml2 pcre - name: CMake build on ubuntu (with GUI / system tinyxml2) if: contains(matrix.os, 'ubuntu') run: | - cmake -S . -B cmake.output.tinyxml2 -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + cmake -S . -B cmake.output.tinyxml2 -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=${{ matrix.use_qt6 }} -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache cmake --build cmake.output.tinyxml2 -- -j$(nproc) - name: CMake build on macos (with GUI / system tinyxml2) if: contains(matrix.os, 'macos') run: | - cmake -S . -B cmake.output.tinyxml2 -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt5_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5 + cmake -S . -B cmake.output.tinyxml2 -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt6_DIR=$(brew --prefix qt@6)/lib/cmake/Qt6 cmake --build cmake.output.tinyxml2 -- -j$(nproc) - name: Run CMake test (system tinyxml2) @@ -70,6 +82,10 @@ jobs: strategy: matrix: os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12] + include: + - use_qt6: On + - os: ubuntu-20.04 + use_qt6: Off fail-fast: false # Prefer quick result runs-on: ${{ matrix.os }} @@ -87,7 +103,7 @@ jobs: key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} - name: Install missing software on ubuntu - if: contains(matrix.os, 'ubuntu') + if: contains(matrix.os, 'ubuntu') && matrix.use_qt6 == 'Off' run: | sudo apt-get update sudo apt-get install libxml2-utils qtbase5-dev qttools5-dev libqt5charts5-dev qtchooser @@ -106,23 +122,31 @@ jobs: run: | echo "CXX=g++-13" >> $GITHUB_ENV + - name: Install missing software on ubuntu + if: contains(matrix.os, 'ubuntu') && matrix.use_qt6 == 'On' + run: | + sudo apt-get update + # qt6-tools-dev-tools for lprodump + # qt6-l10n-tools for lupdate + sudo apt-get install libxml2-utils qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev + # coreutils contains "nproc" - name: Install missing software on macos if: contains(matrix.os, 'macos') run: | # pcre was removed from runner images in November 2022 - brew install coreutils qt@5 pcre + brew install coreutils qt@6 pcre - name: CMake build on ubuntu (with GUI) if: contains(matrix.os, 'ubuntu') run: | - cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=${{ matrix.use_qt6 }} -DWITH_QCHART=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache cmake --build cmake.output -- -j$(nproc) - name: CMake build on macos (with GUI) if: contains(matrix.os, 'macos') run: | - cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt5_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5 + cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt6_DIR=$(brew --prefix qt@6)/lib/cmake/Qt6 cmake --build cmake.output -- -j$(nproc) - name: Run CMake test diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index be203c093f9..ed4612efbf0 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -67,7 +67,7 @@ jobs: - name: Build GUI release (CMake) if: startsWith(matrix.qt_ver, '6') run: | - cmake -S . -B build -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_QT6=On || exit /b !errorlevel! + cmake -S . -B build -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On || exit /b !errorlevel! cmake --build build --target cppcheck-gui || exit /b !errorlevel! # TODO: deploy with CMake/Qt6 diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 3eda1954994..f31e799f6fd 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-22.04 env: - QT_VERSION: 5.15.2 + QT_VERSION: 6.5.0 steps: - uses: actions/checkout@v3 @@ -53,7 +53,7 @@ jobs: - name: Prepare CMake run: | - cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCPPCHK_GLIBCXX_DEBUG=Off + cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCPPCHK_GLIBCXX_DEBUG=Off env: CC: clang-17 CXX: clang++-17 diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index abba6f32b3f..6dfd0b70739 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -57,6 +57,7 @@ jobs: ln -s iwyu_tool.py /usr/bin/iwyu_tool ln -s qt5 /usr/include/qt + # TODO: switch to Qt 6 after we enabled the Qt mappings again - name: Prepare CMake run: | cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off diff --git a/.github/workflows/selfcheck.yml b/.github/workflows/selfcheck.yml index 70cc147c40f..e59bd67b232 100644 --- a/.github/workflows/selfcheck.yml +++ b/.github/workflows/selfcheck.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-22.04 env: - QT_VERSION: 5.15.2 + QT_VERSION: 6.5.0 steps: - uses: actions/checkout@v3 @@ -60,7 +60,7 @@ jobs: - name: CMake run: | - cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=ON -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On + cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=ON -DUSE_QT6=On -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On - name: Generate dependencies run: | @@ -83,7 +83,7 @@ jobs: # the following steps are duplicated from above since setting up the build node in a parallel step takes longer than the actual steps - name: CMake (no test) run: | - cmake -S . -B cmake.output.notest -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=Off -DBUILD_GUI=ON -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On + cmake -S . -B cmake.output.notest -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=Off -DBUILD_GUI=ON -DUSE_QT6=On -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On - name: Generate dependencies (no test) run: | @@ -108,7 +108,7 @@ jobs: - name: CMake (corpus / no test) run: | - cmake -S cppcheck-2.8 -B cmake.output.corpus -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=Off -DBUILD_GUI=ON -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On + cmake -S cppcheck-2.8 -B cmake.output.corpus -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=Off -DBUILD_GUI=ON -DUSE_QT6=On -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On - name: Generate dependencies (corpus) run: | From b67321747c2f8e71efb791443981c6d4f5b19898 Mon Sep 17 00:00:00 2001 From: firewave Date: Mon, 27 Feb 2023 16:19:01 +0100 Subject: [PATCH 3/8] CI-unixish-docker.yml: include GUI in CMake build on latest ubuntu --- .github/workflows/CI-unixish-docker.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CI-unixish-docker.yml b/.github/workflows/CI-unixish-docker.yml index c8095c54a2b..d6489f1918b 100644 --- a/.github/workflows/CI-unixish-docker.yml +++ b/.github/workflows/CI-unixish-docker.yml @@ -20,6 +20,10 @@ jobs: strategy: matrix: image: ["centos:7", "ubuntu:14.04", "ubuntu:16.04", "ubuntu:18.04", "ubuntu:23.04"] + include: + - build_gui: false + - image: "ubuntu:23.04" + build_gui: true fail-fast: false # Prefer quick result runs-on: ubuntu-22.04 @@ -48,11 +52,10 @@ jobs: apt-get update apt-get install -y cmake g++ make libxml2-utils libpcre3-dev - # required so a default Qt installation is configured - - name: Install missing software on ubuntu 18.04 - if: false # matrix.os == 'ubuntu-18.04' + - name: Install missing software on ubuntu 23.04 + if: matrix.build_gui run: | - sudo apt-get install qt5-default + apt-get install -y qt6-base-dev qt6-charts-dev qt6-tools-dev # needs to be called after the package installation since # - it doesn't call "apt-get update" @@ -82,13 +85,19 @@ jobs: cmake --build . -- -j$(nproc) - name: CMake build - if: matrix.image != 'centos:7' && matrix.image != 'ubuntu:14.04' && matrix.image != 'ubuntu:16.04' + if: ${{ !matrix.build_gui && matrix.image != 'centos:7' && matrix.image != 'ubuntu:14.04' && matrix.image != 'ubuntu:16.04' }} run: | mkdir cmake.output cd cmake.output cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .. cmake --build . -- -j$(nproc) + - name: CMake build (with GUI) + if: matrix.build_gui + run: | + cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + cmake --build cmake.output -- -j$(nproc) + - name: Run CMake test if: matrix.image != 'centos:7' && matrix.image != 'ubuntu:14.04' && matrix.image != 'ubuntu:16.04' run: | From 0550377f42ccd36a7add3327f8095509bfa25788 Mon Sep 17 00:00:00 2001 From: firewave Date: Sat, 18 Feb 2023 13:27:02 +0100 Subject: [PATCH 4/8] deprecated building with Qt5 --- cmake/findDependencies.cmake | 1 + releasenotes.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake index 90b7c137e75..5cab7009e2f 100644 --- a/cmake/findDependencies.cmake +++ b/cmake/findDependencies.cmake @@ -24,6 +24,7 @@ if (BUILD_GUI) set(DISABLE_CRTDBG_MAP_ALLOC ON) endif() else() + message(WARNING "Building with Qt5 is deprecated (it went EOL in May 2023) and will be removed in a future release - please use Qt6 instead") find_package(Qt5 COMPONENTS ${qt_components} REQUIRED) set(QT_VERSION "${Qt5Core_VERSION_STRING}") endif() diff --git a/releasenotes.txt b/releasenotes.txt index 99fa49afde4..51ee1d68197 100644 --- a/releasenotes.txt +++ b/releasenotes.txt @@ -14,6 +14,7 @@ Changed interface: Deprecations: - "--showtime=top5" has been deprecated and will be removed in Cppcheck 2.14. Please use --showtime=top5_file or --showtime=top5_summary instead. +- Building with Qt5 has been deprecated (it went EOL in May 2023) and will be removed in a future version - please use Qt6 instead. Other: - Windows builds now default to the `native` platform instead of `win32A` or `win64`. Please specify it explicitly if you depend on it. From 0418bc31d924472b858a7206ecbb8a27b1199ede Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 2 May 2023 21:48:50 +0200 Subject: [PATCH 5/8] updated Qt defines for selfchecks --- .github/workflows/CI-unixish.yml | 1 + .github/workflows/asan.yml | 4 ++-- .github/workflows/selfcheck.yml | 6 +++--- .github/workflows/tsan.yml | 4 ++-- .github/workflows/ubsan.yml | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml index a8a9b42cf17..d21e71d23b9 100644 --- a/.github/workflows/CI-unixish.yml +++ b/.github/workflows/CI-unixish.yml @@ -476,6 +476,7 @@ jobs: # compile with verification and ast matchers make -j$(nproc) -s CPPFLAGS="-DCHECK_INTERNAL" CXXFLAGS="-g -O2 -w -DHAVE_BOOST" MATCHCOMPILER=yes VERIFY=1 + # TODO: update to Qt6 - name: Generate UI files run: | pushd gui diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml index 13c838c337b..d0a1c29c32a 100644 --- a/.github/workflows/asan.yml +++ b/.github/workflows/asan.yml @@ -95,7 +95,7 @@ jobs: ec=0 ./cmake.output/bin/cppcheck $selfcheck_options externals/simplecpp || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json cli lib || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1 + ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli test/*.cpp tools/*.cpp || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1 + ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1 exit $ec diff --git a/.github/workflows/selfcheck.yml b/.github/workflows/selfcheck.yml index e59bd67b232..d861124ae41 100644 --- a/.github/workflows/selfcheck.yml +++ b/.github/workflows/selfcheck.yml @@ -75,7 +75,7 @@ jobs: - name: Self check (unusedFunction) if: false # TODO: fails with preprocessorErrorDirective - see #10667 run: | - ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --enable=unusedFunction --exception-handling -rp=. --project=cmake.output/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr + ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --enable=unusedFunction --exception-handling -rp=. --project=cmake.output/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr env: DISABLE_VALUEFLOW: 1 UNUSEDFUNCTION_ONLY: 1 @@ -96,7 +96,7 @@ jobs: # TODO: find a way to report unmatched suppressions without need to add information checks - name: Self check (unusedFunction / no test) run: | - ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.notest/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr + ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.notest/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr env: DISABLE_VALUEFLOW: 1 UNUSEDFUNCTION_ONLY: 1 @@ -122,7 +122,7 @@ jobs: - name: Self check (unusedFunction / corpus / no test / callgrind) run: | # TODO: fix -rp so the suppressions actually work - valgrind --tool=callgrind ./cppcheck --template=selfcheck --error-exitcode=0 --library=cppcheck-lib --library=qt -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.corpus/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr 2>callgrind.log || (cat callgrind.log && false) + valgrind --tool=callgrind ./cppcheck --template=selfcheck --error-exitcode=0 --library=cppcheck-lib --library=qt -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.corpus/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr 2>callgrind.log || (cat callgrind.log && false) cat callgrind.log callgrind_annotate --auto=no > callgrind.annotated.log head -50 callgrind.annotated.log diff --git a/.github/workflows/tsan.yml b/.github/workflows/tsan.yml index c841da9c3d1..fdb17dae7a1 100644 --- a/.github/workflows/tsan.yml +++ b/.github/workflows/tsan.yml @@ -94,7 +94,7 @@ jobs: ec=0 ./cmake.output/bin/cppcheck $selfcheck_options externals/simplecpp || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json -DCHECK_INTERNAL cli lib || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1 + ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli test/*.cpp tools/*.cpp || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1 + ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1 exit $ec diff --git a/.github/workflows/ubsan.yml b/.github/workflows/ubsan.yml index 8596f3009c4..65444898737 100644 --- a/.github/workflows/ubsan.yml +++ b/.github/workflows/ubsan.yml @@ -91,7 +91,7 @@ jobs: ec=0 ./cmake.output/bin/cppcheck $selfcheck_options externals/simplecpp || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json cli lib || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1 + ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli test/*.cpp tools/*.cpp || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1 + ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1 exit $ec From 6121243844188a949d6aec73b61b286a0055d319 Mon Sep 17 00:00:00 2001 From: firewave Date: Fri, 6 Oct 2023 06:28:04 +0200 Subject: [PATCH 6/8] disabled some clang-tidy checks which only apply to standards newer than C++11 --- .clang-tidy | 2 ++ clang-tidy.md | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/.clang-tidy b/.clang-tidy index 7617f792e03..7088c1b7a77 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -44,7 +44,9 @@ Checks: > -modernize-raw-string-literal, -modernize-replace-auto-ptr, -modernize-return-braced-init-list, + -modernize-type-traits, -modernize-use-auto, + -modernize-use-nodiscard, -modernize-use-trailing-return-type, -performance-avoid-endl, -performance-inefficient-string-concatenation, diff --git a/clang-tidy.md b/clang-tidy.md index ba7c7d6113d..4bc5c5954f7 100644 --- a/clang-tidy.md +++ b/clang-tidy.md @@ -155,6 +155,11 @@ To be evaluated (need to remove exclusion). To be evaluated (need to enable explicitly). +`modernize-type-traits`
+`modernize-use-nodiscard`
+ +These apply to codebases which use later standards then C++11 (C++17 is used when building with Qt6) so we cannot simply apply them. + `portability-std-allocator-const`
Only necessary for code which is exclusively compiled with `libc++`. Also disabled for performance reasons - see https://github.com/llvm/llvm-project/issues/57527#issuecomment-1237935132. From ba3d8460b3c5de866886139eec3216d8f538e8b6 Mon Sep 17 00:00:00 2001 From: firewave Date: Fri, 6 Oct 2023 06:36:05 +0200 Subject: [PATCH 7/8] updated latest Qt in CI to 6.5.3 --- .github/workflows/CI-windows.yml | 2 +- .github/workflows/clang-tidy.yml | 2 +- .github/workflows/selfcheck.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index ed4612efbf0..56bf24998ef 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -28,7 +28,7 @@ jobs: strategy: matrix: os: [windows-2019, windows-2022] - qt_ver: [5.15.2, 6.2.4, 6.5.0] + qt_ver: [5.15.2, 6.2.4, 6.5.3] fail-fast: false runs-on: ${{ matrix.os }} diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index f31e799f6fd..5d50459a0a7 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-22.04 env: - QT_VERSION: 6.5.0 + QT_VERSION: 6.5.3 steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/selfcheck.yml b/.github/workflows/selfcheck.yml index d861124ae41..efaceb36704 100644 --- a/.github/workflows/selfcheck.yml +++ b/.github/workflows/selfcheck.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-22.04 env: - QT_VERSION: 6.5.0 + QT_VERSION: 6.5.3 steps: - uses: actions/checkout@v3 From 371119c3f7448254dd23f31b90f8ac1d20fd31c8 Mon Sep 17 00:00:00 2001 From: firewave Date: Fri, 6 Oct 2023 07:36:06 +0200 Subject: [PATCH 8/8] codeeditorstyle.cpp: fixed `performance-move-const-arg` clang-tidy warnings --- gui/codeeditorstyle.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/gui/codeeditorstyle.cpp b/gui/codeeditorstyle.cpp index 509a9570b28..8ec1b1345c7 100644 --- a/gui/codeeditorstyle.cpp +++ b/gui/codeeditorstyle.cpp @@ -43,21 +43,21 @@ CodeEditorStyle::CodeEditorStyle( QColor SymbFGColor, QColor SymbBGColor, // cppcheck-suppress naming-varname - TODO: fix this QFont::Weight SymbWeight) : - widgetFGColor(std::move(CtrlFGColor)), - widgetBGColor(std::move(CtrlBGColor)), - highlightBGColor(std::move(HiLiBGColor)), - lineNumFGColor(std::move(LnNumFGColor)), - lineNumBGColor(std::move(LnNumBGColor)), - keywordColor(std::move(KeyWdFGColor)), + widgetFGColor(CtrlFGColor), + widgetBGColor(CtrlBGColor), + highlightBGColor(HiLiBGColor), + lineNumFGColor(LnNumFGColor), + lineNumBGColor(LnNumBGColor), + keywordColor(KeyWdFGColor), keywordWeight(KeyWdWeight), - classColor(std::move(ClsFGColor)), + classColor(ClsFGColor), classWeight(ClsWeight), - quoteColor(std::move(QteFGColor)), + quoteColor(QteFGColor), quoteWeight(QteWeight), - commentColor(std::move(CmtFGColor)), + commentColor(CmtFGColor), commentWeight(CmtWeight), - symbolFGColor(std::move(SymbFGColor)), - symbolBGColor(std::move(SymbBGColor)), + symbolFGColor(SymbFGColor), + symbolBGColor(SymbBGColor), symbolWeight(SymbWeight) {}