From 59bacf4ad67b389ba9fa82a310e0401397463765 Mon Sep 17 00:00:00 2001 From: firewave Date: Mon, 8 Dec 2025 02:37:49 +0100 Subject: [PATCH 1/3] fixed `-Wdeprecated-this-capture` Clang C++20 warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit example: ``` /home/user/CLionProjects/cppcheck/lib/pathmatch.cpp:37:37: warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture] 37 | return match(pattern, path, mBasepath, mode, mSyntax); | ^ /home/user/CLionProjects/cppcheck/lib/pathmatch.cpp:36:63: note: add an explicit capture of 'this' to capture '*this' by reference 36 | return std::any_of(mPatterns.cbegin(), mPatterns.cend(), [=] (const std::string &pattern) { | ^ | , this ``` Co-authored-by: Daniel Marjamäki --- gui/resultstree.cpp | 4 ++-- lib/pathmatch.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index ed4cc8b0535..0c8ee2e3101 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -713,7 +713,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e) { auto *action = new QAction(tr("No tag"), tagMenu); tagMenu->addAction(action); - connect(action, &QAction::triggered, [=]() { + connect(action, &QAction::triggered, [this]() { tagSelectedItems(QString()); }); } @@ -721,7 +721,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e) for (const QString& tagstr : currentProject->getTags()) { auto *action = new QAction(tagstr, tagMenu); tagMenu->addAction(action); - connect(action, &QAction::triggered, [=]() { + connect(action, &QAction::triggered, [tagstr, this]() { tagSelectedItems(tagstr); }); } diff --git a/lib/pathmatch.cpp b/lib/pathmatch.cpp index b7d78f048df..5dd11e1d755 100644 --- a/lib/pathmatch.cpp +++ b/lib/pathmatch.cpp @@ -33,7 +33,7 @@ PathMatch::PathMatch(std::vector patterns, std::string basepath, Sy bool PathMatch::match(const std::string &path, Filemode mode) const { - return std::any_of(mPatterns.cbegin(), mPatterns.cend(), [=] (const std::string &pattern) { + return std::any_of(mPatterns.cbegin(), mPatterns.cend(), [&] (const std::string &pattern) { return match(pattern, path, mBasepath, mode, mSyntax); }); } From 5cf7e7f10cbfaf43df6ab9eb9c675cbd07833e5c Mon Sep 17 00:00:00 2001 From: firewave Date: Mon, 29 Dec 2025 20:17:07 +0100 Subject: [PATCH 2/3] added C++20 builds to CI --- .github/workflows/CI-unixish.yml | 2 +- .github/workflows/CI-windows.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml index 68d4c867367..2f7f19d2928 100644 --- a/.github/workflows/CI-unixish.yml +++ b/.github/workflows/CI-unixish.yml @@ -196,7 +196,7 @@ jobs: strategy: matrix: os: [ubuntu-22.04, macos-15] - cxxstd: [14, 17] + cxxstd: [14, 17, 20] fail-fast: false # Prefer quick result runs-on: ${{ matrix.os }} diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index 1c572a9dc3d..2b08f18bbf5 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -75,7 +75,7 @@ jobs: strategy: matrix: os: [windows-2022, windows-2025] - cxxstd: [14, 17] + cxxstd: [14, 17, 20] fail-fast: false runs-on: ${{ matrix.os }} From 1f43ec5cb598b60e511510606668ff9bc1988514 Mon Sep 17 00:00:00 2001 From: firewave Date: Mon, 12 Jan 2026 02:23:54 +0100 Subject: [PATCH 3/3] Ci-unixish.yml: exclude macOS build with C++20 for now --- .github/workflows/CI-unixish.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml index 2f7f19d2928..e37d88767ec 100644 --- a/.github/workflows/CI-unixish.yml +++ b/.github/workflows/CI-unixish.yml @@ -197,6 +197,15 @@ jobs: matrix: os: [ubuntu-22.04, macos-15] cxxstd: [14, 17, 20] + # FIXME: macos-15 fails to compile with C++20 + # + # /Users/runner/work/cppcheck/cppcheck/cmake.output/gui/test/projectfile/moc_testprojectfile.cpp:84:1: error: 'constinit' specifier is incompatible with C++ standards before C++20 [-Werror,-Wc++20-compat] + # 84 | Q_CONSTINIT const QMetaObject TestProjectFile::staticMetaObject = { { + # | ^ + # /opt/homebrew/opt/qt/lib/QtCore.framework/Headers/qcompilerdetection.h:1409:23: note: expanded from macro 'Q_CONSTINIT' + exclude: + - os: macos-15 + cxxstd: 20 fail-fast: false # Prefer quick result runs-on: ${{ matrix.os }}