fixed #12042 - deprecated building with Qt5 / build with Qt6 in CI / updated latest Qt in CI to 6.5.3 (#4957)

Qt 5.15 will be EOL on May 26 so we should start switching away from it.
We already have issues with many of the previous versions and qmake on
legacy distros so we should cut that off.

I will add a Qt6 release build for Windows in another PR so it can be
tested. We should switch to it as the delivered build after the next
release and stop using Qt5 altogether in the CI in the release
afterwards (that would get rid of several build steps). We could leave
it so you could still try to build it but no longer support it so it is
up to the user to get it to work before removing it completely later on.
This commit is contained in:
Oliver Stöneberg 2023-10-26 14:55:59 +02:00 committed by GitHub
parent 5bebdf8b97
commit fdb3de708e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 95 additions and 51 deletions

View File

@ -44,7 +44,9 @@ Checks: >
-modernize-raw-string-literal, -modernize-raw-string-literal,
-modernize-replace-auto-ptr, -modernize-replace-auto-ptr,
-modernize-return-braced-init-list, -modernize-return-braced-init-list,
-modernize-type-traits,
-modernize-use-auto, -modernize-use-auto,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type, -modernize-use-trailing-return-type,
-performance-avoid-endl, -performance-avoid-endl,
-performance-inefficient-string-concatenation, -performance-inefficient-string-concatenation,

View File

@ -20,6 +20,10 @@ jobs:
strategy: strategy:
matrix: matrix:
image: ["centos:7", "ubuntu:14.04", "ubuntu:16.04", "ubuntu:18.04", "ubuntu:23.04"] 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 fail-fast: false # Prefer quick result
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
@ -48,11 +52,10 @@ jobs:
apt-get update apt-get update
apt-get install -y cmake g++ make libxml2-utils libpcre3-dev 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 23.04
- name: Install missing software on ubuntu 18.04 if: matrix.build_gui
if: false # matrix.os == 'ubuntu-18.04'
run: | 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 # needs to be called after the package installation since
# - it doesn't call "apt-get update" # - it doesn't call "apt-get update"
@ -82,13 +85,19 @@ jobs:
cmake --build . -- -j$(nproc) cmake --build . -- -j$(nproc)
- name: CMake build - 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: | run: |
mkdir cmake.output mkdir cmake.output
cd 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 -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) 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 - name: Run CMake test
if: matrix.image != 'centos:7' && matrix.image != 'ubuntu:14.04' && matrix.image != 'ubuntu:16.04' if: matrix.image != 'centos:7' && matrix.image != 'ubuntu:14.04' && matrix.image != 'ubuntu:16.04'
run: | run: |

View File

@ -20,6 +20,10 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12] 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 fail-fast: false # Prefer quick result
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -37,28 +41,36 @@ jobs:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
- name: Install missing software on ubuntu - name: Install missing software on ubuntu
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu') && matrix.use_qt6 == 'Off'
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install libxml2-utils libtinyxml2-dev qtbase5-dev qttools5-dev libqt5charts5-dev qtchooser 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" # coreutils contains "nproc"
- name: Install missing software on macos - name: Install missing software on macos
if: contains(matrix.os, 'macos') if: contains(matrix.os, 'macos')
run: | run: |
# pcre was removed from runner images in November 2022 # 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) - name: CMake build on ubuntu (with GUI / system tinyxml2)
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu')
run: | 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) cmake --build cmake.output.tinyxml2 -- -j$(nproc)
- name: CMake build on macos (with GUI / system tinyxml2) - name: CMake build on macos (with GUI / system tinyxml2)
if: contains(matrix.os, 'macos') if: contains(matrix.os, 'macos')
run: | 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) cmake --build cmake.output.tinyxml2 -- -j$(nproc)
- name: Run CMake test (system tinyxml2) - name: Run CMake test (system tinyxml2)
@ -70,6 +82,10 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12] 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 fail-fast: false # Prefer quick result
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -87,7 +103,7 @@ jobs:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
- name: Install missing software on ubuntu - name: Install missing software on ubuntu
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu') && matrix.use_qt6 == 'Off'
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install libxml2-utils qtbase5-dev qttools5-dev libqt5charts5-dev qtchooser sudo apt-get install libxml2-utils qtbase5-dev qttools5-dev libqt5charts5-dev qtchooser
@ -106,23 +122,31 @@ jobs:
run: | run: |
echo "CXX=g++-13" >> $GITHUB_ENV 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" # coreutils contains "nproc"
- name: Install missing software on macos - name: Install missing software on macos
if: contains(matrix.os, 'macos') if: contains(matrix.os, 'macos')
run: | run: |
# pcre was removed from runner images in November 2022 # 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) - name: CMake build on ubuntu (with GUI)
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu')
run: | 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) cmake --build cmake.output -- -j$(nproc)
- name: CMake build on macos (with GUI) - name: CMake build on macos (with GUI)
if: contains(matrix.os, 'macos') if: contains(matrix.os, 'macos')
run: | 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) cmake --build cmake.output -- -j$(nproc)
- name: Run CMake test - name: Run CMake test
@ -452,6 +476,7 @@ jobs:
# compile with verification and ast matchers # compile with verification and ast matchers
make -j$(nproc) -s CPPFLAGS="-DCHECK_INTERNAL" CXXFLAGS="-g -O2 -w -DHAVE_BOOST" MATCHCOMPILER=yes VERIFY=1 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 - name: Generate UI files
run: | run: |
pushd gui pushd gui

View File

@ -28,7 +28,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [windows-2019, windows-2022] 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 fail-fast: false
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -67,7 +67,7 @@ jobs:
- name: Build GUI release (CMake) - name: Build GUI release (CMake)
if: startsWith(matrix.qt_ver, '6') if: startsWith(matrix.qt_ver, '6')
run: | 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! cmake --build build --target cppcheck-gui || exit /b !errorlevel!
# TODO: deploy with CMake/Qt6 # TODO: deploy with CMake/Qt6

View File

@ -95,7 +95,7 @@ jobs:
ec=0 ec=0
./cmake.output/bin/cppcheck $selfcheck_options externals/simplecpp || ec=1 ./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 --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 -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 exit $ec

View File

@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
env: env:
QT_VERSION: 5.15.2 QT_VERSION: 6.5.3
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -53,7 +53,7 @@ jobs:
- name: Prepare CMake - name: Prepare CMake
run: | 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: env:
CC: clang-17 CC: clang-17
CXX: clang++-17 CXX: clang++-17

View File

@ -57,6 +57,7 @@ jobs:
ln -s iwyu_tool.py /usr/bin/iwyu_tool ln -s iwyu_tool.py /usr/bin/iwyu_tool
ln -s qt5 /usr/include/qt ln -s qt5 /usr/include/qt
# TODO: switch to Qt 6 after we enabled the Qt mappings again
- name: Prepare CMake - name: Prepare CMake
run: | 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 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

View File

@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
env: env:
QT_VERSION: 5.15.2 QT_VERSION: 6.5.3
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -60,7 +60,7 @@ jobs:
- name: CMake - name: CMake
run: | 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 - name: Generate dependencies
run: | run: |
@ -75,7 +75,7 @@ jobs:
- name: Self check (unusedFunction) - name: Self check (unusedFunction)
if: false # TODO: fails with preprocessorErrorDirective - see #10667 if: false # TODO: fails with preprocessorErrorDirective - see #10667
run: | 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: env:
DISABLE_VALUEFLOW: 1 DISABLE_VALUEFLOW: 1
UNUSEDFUNCTION_ONLY: 1 UNUSEDFUNCTION_ONLY: 1
@ -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 # 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) - name: CMake (no test)
run: | 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) - name: Generate dependencies (no test)
run: | run: |
@ -96,7 +96,7 @@ jobs:
# TODO: find a way to report unmatched suppressions without need to add information checks # TODO: find a way to report unmatched suppressions without need to add information checks
- name: Self check (unusedFunction / no test) - name: Self check (unusedFunction / no test)
run: | 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: env:
DISABLE_VALUEFLOW: 1 DISABLE_VALUEFLOW: 1
UNUSEDFUNCTION_ONLY: 1 UNUSEDFUNCTION_ONLY: 1
@ -108,7 +108,7 @@ jobs:
- name: CMake (corpus / no test) - name: CMake (corpus / no test)
run: | 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) - name: Generate dependencies (corpus)
run: | run: |
@ -122,7 +122,7 @@ jobs:
- name: Self check (unusedFunction / corpus / no test / callgrind) - name: Self check (unusedFunction / corpus / no test / callgrind)
run: | run: |
# TODO: fix -rp so the suppressions actually work # 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 cat callgrind.log
callgrind_annotate --auto=no > callgrind.annotated.log callgrind_annotate --auto=no > callgrind.annotated.log
head -50 callgrind.annotated.log head -50 callgrind.annotated.log

View File

@ -94,7 +94,7 @@ jobs:
ec=0 ec=0
./cmake.output/bin/cppcheck $selfcheck_options externals/simplecpp || ec=1 ./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 --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 -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 exit $ec

View File

@ -91,7 +91,7 @@ jobs:
ec=0 ec=0
./cmake.output/bin/cppcheck $selfcheck_options externals/simplecpp || ec=1 ./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 --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 -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 exit $ec

View File

@ -155,6 +155,11 @@ To be evaluated (need to remove exclusion).
To be evaluated (need to enable explicitly). To be evaluated (need to enable explicitly).
`modernize-type-traits`</br>
`modernize-use-nodiscard`</br>
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`<br/> `portability-std-allocator-const`<br/>
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. 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.

View File

@ -24,6 +24,7 @@ if (BUILD_GUI)
set(DISABLE_CRTDBG_MAP_ALLOC ON) set(DISABLE_CRTDBG_MAP_ALLOC ON)
endif() endif()
else() 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) find_package(Qt5 COMPONENTS ${qt_components} REQUIRED)
set(QT_VERSION "${Qt5Core_VERSION_STRING}") set(QT_VERSION "${Qt5Core_VERSION_STRING}")
endif() endif()

View File

@ -43,21 +43,21 @@ CodeEditorStyle::CodeEditorStyle(
QColor SymbFGColor, QColor SymbBGColor, QColor SymbFGColor, QColor SymbBGColor,
// cppcheck-suppress naming-varname - TODO: fix this // cppcheck-suppress naming-varname - TODO: fix this
QFont::Weight SymbWeight) : QFont::Weight SymbWeight) :
widgetFGColor(std::move(CtrlFGColor)), widgetFGColor(CtrlFGColor),
widgetBGColor(std::move(CtrlBGColor)), widgetBGColor(CtrlBGColor),
highlightBGColor(std::move(HiLiBGColor)), highlightBGColor(HiLiBGColor),
lineNumFGColor(std::move(LnNumFGColor)), lineNumFGColor(LnNumFGColor),
lineNumBGColor(std::move(LnNumBGColor)), lineNumBGColor(LnNumBGColor),
keywordColor(std::move(KeyWdFGColor)), keywordColor(KeyWdFGColor),
keywordWeight(KeyWdWeight), keywordWeight(KeyWdWeight),
classColor(std::move(ClsFGColor)), classColor(ClsFGColor),
classWeight(ClsWeight), classWeight(ClsWeight),
quoteColor(std::move(QteFGColor)), quoteColor(QteFGColor),
quoteWeight(QteWeight), quoteWeight(QteWeight),
commentColor(std::move(CmtFGColor)), commentColor(CmtFGColor),
commentWeight(CmtWeight), commentWeight(CmtWeight),
symbolFGColor(std::move(SymbFGColor)), symbolFGColor(SymbFGColor),
symbolBGColor(std::move(SymbBGColor)), symbolBGColor(SymbBGColor),
symbolWeight(SymbWeight) symbolWeight(SymbWeight)
{} {}

View File

@ -35,7 +35,7 @@ void ThreadResult::reportOut(const std::string &outmsg, Color /*c*/)
void ThreadResult::fileChecked(const QString &file) void ThreadResult::fileChecked(const QString &file)
{ {
QMutexLocker locker(&mutex); std::lock_guard<std::mutex> locker(mutex);
mProgress += QFile(file).size(); mProgress += QFile(file).size();
mFilesChecked++; mFilesChecked++;
@ -50,7 +50,7 @@ void ThreadResult::fileChecked(const QString &file)
void ThreadResult::reportErr(const ErrorMessage &msg) void ThreadResult::reportErr(const ErrorMessage &msg)
{ {
QMutexLocker locker(&mutex); std::lock_guard<std::mutex> locker(mutex);
const ErrorItem item(msg); const ErrorItem item(msg);
if (msg.severity != Severity::debug) if (msg.severity != Severity::debug)
emit error(item); emit error(item);
@ -60,7 +60,7 @@ void ThreadResult::reportErr(const ErrorMessage &msg)
QString ThreadResult::getNextFile() QString ThreadResult::getNextFile()
{ {
QMutexLocker locker(&mutex); std::lock_guard<std::mutex> locker(mutex);
if (mFiles.isEmpty()) { if (mFiles.isEmpty()) {
return QString(); return QString();
} }
@ -70,7 +70,7 @@ QString ThreadResult::getNextFile()
ImportProject::FileSettings ThreadResult::getNextFileSettings() ImportProject::FileSettings ThreadResult::getNextFileSettings()
{ {
QMutexLocker locker(&mutex); std::lock_guard<std::mutex> locker(mutex);
if (mFileSettings.empty()) { if (mFileSettings.empty()) {
return ImportProject::FileSettings(); return ImportProject::FileSettings();
} }
@ -81,7 +81,7 @@ ImportProject::FileSettings ThreadResult::getNextFileSettings()
void ThreadResult::setFiles(const QStringList &files) void ThreadResult::setFiles(const QStringList &files)
{ {
QMutexLocker locker(&mutex); std::lock_guard<std::mutex> locker(mutex);
mFiles = files; mFiles = files;
mProgress = 0; mProgress = 0;
mFilesChecked = 0; mFilesChecked = 0;
@ -97,7 +97,7 @@ void ThreadResult::setFiles(const QStringList &files)
void ThreadResult::setProject(const ImportProject &prj) void ThreadResult::setProject(const ImportProject &prj)
{ {
QMutexLocker locker(&mutex); std::lock_guard<std::mutex> locker(mutex);
mFiles.clear(); mFiles.clear();
mFileSettings = prj.fileSettings; mFileSettings = prj.fileSettings;
mProgress = 0; mProgress = 0;
@ -113,7 +113,7 @@ void ThreadResult::setProject(const ImportProject &prj)
void ThreadResult::clearFiles() void ThreadResult::clearFiles()
{ {
QMutexLocker locker(&mutex); std::lock_guard<std::mutex> locker(mutex);
mFiles.clear(); mFiles.clear();
mFileSettings.clear(); mFileSettings.clear();
mFilesChecked = 0; mFilesChecked = 0;
@ -122,6 +122,6 @@ void ThreadResult::clearFiles()
int ThreadResult::getFileCount() const int ThreadResult::getFileCount() const
{ {
QMutexLocker locker(&mutex); std::lock_guard<std::mutex> locker(mutex);
return mFiles.size() + mFileSettings.size(); return mFiles.size() + mFileSettings.size();
} }

View File

@ -25,9 +25,9 @@
#include "importproject.h" #include "importproject.h"
#include <list> #include <list>
#include <mutex>
#include <string> #include <string>
#include <QMutex>
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
@ -127,7 +127,7 @@ protected:
* @brief Mutex * @brief Mutex
* *
*/ */
mutable QMutex mutex; mutable std::mutex mutex;
/** /**
* @brief List of files to check * @brief List of files to check

View File

@ -14,6 +14,7 @@ Changed interface:
Deprecations: Deprecations:
- "--showtime=top5" has been deprecated and will be removed in Cppcheck 2.14. Please use --showtime=top5_file or --showtime=top5_summary instead. - "--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: Other:
- Windows builds now default to the `native` platform instead of `win32A` or `win64`. Please specify it explicitly if you depend on it. - Windows builds now default to the `native` platform instead of `win32A` or `win64`. Please specify it explicitly if you depend on it.