Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/CI-unixish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,16 @@ jobs:
strategy:
matrix:
os: [ubuntu-22.04, macos-15]
cxxstd: [14, 17]
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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/CI-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
5 changes: 3 additions & 2 deletions gui/resultstree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "applicationlist.h"
#include "checkers.h"
#include "common.h"
#include "config.h"
#include "erroritem.h"
#include "errorlogger.h"
#include "errortypes.h"
Expand Down Expand Up @@ -713,15 +714,15 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
{
auto *action = new QAction(tr("No tag"), tagMenu);
tagMenu->addAction(action);
connect(action, &QAction::triggered, [=]() {
connect(action, &QAction::triggered, [EXPLICIT_THIS]() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't this be rewritten so it's compatible both with c++20 and c++14 ? [this] ?

tagSelectedItems(QString());
});
}

for (const QString& tagstr : currentProject->getTags()) {
auto *action = new QAction(tagstr, tagMenu);
tagMenu->addAction(action);
connect(action, &QAction::triggered, [=]() {
connect(action, &QAction::triggered, [EXPLICIT_THIS]() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would [tagstr, this] work?

tagSelectedItems(tagstr);
});
}
Expand Down
6 changes: 6 additions & 0 deletions lib/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@
# define RET_NONNULL
#endif

#if __cplusplus >= 202002L
# define EXPLICIT_THIS =, this
#else
# define EXPLICIT_THIS =
#endif

#define REQUIRES(msg, ...) class=typename std::enable_if<__VA_ARGS__::value>::type

// Use the nonneg macro when you want to assert that a variable/argument is not negative
Expand Down
2 changes: 1 addition & 1 deletion lib/pathmatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ PathMatch::PathMatch(std::vector<std::string> 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);
});
}
Expand Down
Loading