Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to C++ 20 & switch to websocketpp develop branch #4252

Merged
merged 12 commits into from
Dec 24, 2022
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Bugfix: Fixed Reply window missing selection clear behaviour between chat and input box. (#4218)
- Bugfix: Fixed crash that could occur when changing Tab layout and utilizing multiple windows. (#4248)
- Dev: Ignore `WM_SHOWWINDOW` hide events, causing fewer attempted rescales. (#4198)
- Dev: Migrated to C++ 20 (#4252)

## 2.4.0

Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.12)
cmake_policy(SET CMP0087 NEW)
include(FeatureSummary)

Expand Down Expand Up @@ -143,7 +143,7 @@ else()
add_subdirectory("${CMAKE_SOURCE_DIR}/lib/settings" EXCLUDE_FROM_ALL)
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (BUILD_TESTS OR BUILD_BENCHMARKS)
Expand Down
2 changes: 1 addition & 1 deletion lib/websocketpp
Submodule websocketpp updated 101 files
4 changes: 2 additions & 2 deletions src/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ void Application::initPubSub()

this->twitch->pubsub->start();

auto RequestModerationActions = [=]() {
auto RequestModerationActions = [this]() {
this->twitch->pubsub->setAccount(
getApp()->accounts->twitch.getCurrent());
// TODO(pajlada): Unlisten to all authed topics instead of only
Expand All @@ -561,7 +561,7 @@ void Application::initPubSub()
};

this->accounts->twitch.currentUserChanged.connect(
[=] {
[this] {
this->twitch->pubsub->unlistenAllModerationActions();
this->twitch->pubsub->unlistenAutomod();
this->twitch->pubsub->unlistenWhispers();
Expand Down
36 changes: 20 additions & 16 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -788,28 +788,32 @@ if (MSVC)
# Someone adds /W3 before we add /W4.
# This makes sure, only /W4 is specified.
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# 4714 - function marked as __forceinline not inlined
# 4996 - occurs when the compiler encounters a function or variable that is marked as deprecated.
# These functions may have a different preferred name, may be insecure or have
# a more secure variant, or may be obsolete.
# 4505 - unreferenced local version has been removed
# 4127 - conditional expression is constant
# 4503 - decorated name length exceeded, name was truncated
# 4100 - unreferences formal parameter
# 4305 - possible truncation of data
# 4267 - possible loss of data in return
# 4505 - "unreferenced local version has been removed"
# Although this might give hints on dead code,
# there are some cases where it's distracting.
#
# 4100 - "unreferenced formal parameter"
# There are a lot of functions and methods where
# an argument was given a name but never used.
# There's a clang-tidy rule that will catch this
# for new/updated functions/methods.
#
# 4267 - "possible loss of data in return"
# These are implicit conversions from size_t to int/qsizetype.
# We don't use size_t in a lot of cases, since
# Qt doesn't use it - it uses int (or qsizetype in Qt6).
target_compile_options(${LIBRARY_PROJECT} PUBLIC
/W4
# Disable the following warnings
/wd4714
/wd4996
# 5038 - warnings about initialization order
/w15038
# 4855 - implicit capture of 'this' via '[=]' is deprecated
/w14855
# Disable the following warnings (see reasoning above)
/wd4505
/wd4127
/wd4503
/wd4100
/wd4305
/wd4267
)
target_compile_definitions(${LIBRARY_PROJECT} PUBLIC NOMINMAX)
else ()
target_compile_options(${LIBRARY_PROJECT} PUBLIC
-Wall
Expand Down
2 changes: 1 addition & 1 deletion src/common/CompletionModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void CompletionModel::refresh(const QString &prefix, bool isFirstWord)
// Twitch channel
auto *tc = dynamic_cast<TwitchChannel *>(&this->channel_);

auto addString = [=](const QString &str, TaggedString::Type type) {
auto addString = [=, this](const QString &str, TaggedString::Type type) {
// Special case for handling default Twitch commands
if (type == TaggedString::TwitchCommand)
{
Expand Down
2 changes: 1 addition & 1 deletion src/common/FlagsEnum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class FlagsEnum
return this->value_ == other.value_;
}

bool operator!=(const FlagsEnum &other)
bool operator!=(const FlagsEnum<T> &other)
{
return this->value_ != other.value_;
}
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/notifications/NotificationController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void NotificationController::initialize(Settings &settings, Paths &paths)

this->fetchFakeChannels();

QObject::connect(this->liveStatusTimer_, &QTimer::timeout, [=] {
QObject::connect(this->liveStatusTimer_, &QTimer::timeout, [this] {
this->fetchFakeChannels();
});
this->liveStatusTimer_->start(60 * 1000);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/layouts/MessageLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ void MessageLayout::paint(QPainter &painter, int width, int y, int messageIndex,
if (isLastReadMessage)
{
QColor color;
if (getSettings()->lastMessageColor != "")
if (getSettings()->lastMessageColor != QStringLiteral(""))
{
color = QColor(getSettings()->lastMessageColor.getValue());
}
Expand Down
4 changes: 2 additions & 2 deletions src/providers/liveupdates/BasicPubSubManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ class BasicPubSubManager

this->clients_.emplace(hdl, client);

auto pendingSubsToTake = (std::min)(this->pendingSubscriptions_.size(),
client->maxSubscriptions);
auto pendingSubsToTake = std::min(this->pendingSubscriptions_.size(),
client->maxSubscriptions);

qCDebug(chatterinoLiveupdates)
<< "LiveUpdate connection opened, subscribing to"
Expand Down
Loading