diff --git a/CMakeLists.txt b/CMakeLists.txt index ffde008c025..5481496c1bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,7 +139,7 @@ endif() ####################################################################### -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) if(MSVC) # Ensure MSVC populates __cplusplus correctly. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus") diff --git a/lib/benchmark/CMakeLists.txt b/lib/benchmark/CMakeLists.txt index 49f2ae2a0f9..a1ae2c3e03c 100644 --- a/lib/benchmark/CMakeLists.txt +++ b/lib/benchmark/CMakeLists.txt @@ -160,9 +160,12 @@ else() add_cxx_compiler_flag(-Wall) add_cxx_compiler_flag(-Wextra) add_cxx_compiler_flag(-Wshadow) - add_cxx_compiler_flag(-Werror RELEASE) - add_cxx_compiler_flag(-Werror RELWITHDEBINFO) - add_cxx_compiler_flag(-Werror MINSIZEREL) + # Disable -Werror because of gcc bug + # https://github.com/google/benchmark/issues/1398 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329 + # add_cxx_compiler_flag(-Werror RELEASE) + # add_cxx_compiler_flag(-Werror RELWITHDEBINFO) + # add_cxx_compiler_flag(-Werror MINSIZEREL) if (NOT BENCHMARK_ENABLE_TESTING) # Disable warning when compiling tests as gtest does not use 'override'. add_cxx_compiler_flag(-Wsuggest-override) diff --git a/src/controllers/dlgprefcontrollers.cpp b/src/controllers/dlgprefcontrollers.cpp index 5947a6af1ca..6e5a04b17c2 100644 --- a/src/controllers/dlgprefcontrollers.cpp +++ b/src/controllers/dlgprefcontrollers.cpp @@ -23,7 +23,7 @@ DlgPrefControllers::DlgPrefControllers(DlgPreferences* pPreferences, createLinkColor(); setupControllerWidgets(); - connect(btnOpenUserMappings, &QPushButton::clicked, [=]() { + connect(btnOpenUserMappings, &QPushButton::clicked, [=, this]() { QString mappingsPath = userMappingsPath(m_pConfig); openLocalFile(mappingsPath); }); @@ -132,8 +132,8 @@ void DlgPrefControllers::destroyControllerWidgets() { // to keep this dialog and the controllermanager consistent. QList controllerList = m_pControllerManager->getControllerList(false, true); - for (auto controller : controllerList) { - controller->disconnect(this); + for (auto* pController : controllerList) { + pController->disconnect(this); } while (!m_controllerPages.isEmpty()) { DlgPrefController* pControllerDlg = m_controllerPages.takeLast(); diff --git a/src/effects/effectchain.cpp b/src/effects/effectchain.cpp index 14e052d1ab5..7d29850fea2 100644 --- a/src/effects/effectchain.cpp +++ b/src/effects/effectchain.cpp @@ -82,7 +82,7 @@ EffectChain::EffectChain(const QString& group, connect(m_pControlChainSuperParameter.get(), &ControlObject::valueChanged, this, - [=](double value) { slotControlChainSuperParameter(value, false); }); + [=, this](double value) { slotControlChainSuperParameter(value, false); }); m_pControlChainSuperParameter->set(0.0); m_pControlChainSuperParameter->setDefaultValue(0.0); diff --git a/src/effects/effectslot.cpp b/src/effects/effectslot.cpp index 506f202c99b..1833da1fbc2 100644 --- a/src/effects/effectslot.cpp +++ b/src/effects/effectslot.cpp @@ -123,7 +123,7 @@ EffectSlot::EffectSlot(const QString& group, connect(m_pControlMetaParameter.get(), &ControlObject::valueChanged, this, - [=](double value) { slotEffectMetaParameter(value); }); + [=, this](double value) { slotEffectMetaParameter(value); }); m_pControlMetaParameter->set(0.0); m_pControlMetaParameter->setDefaultValue(0.0); diff --git a/src/engine/channels/enginechannel.cpp b/src/engine/channels/enginechannel.cpp index 3756f341c44..3ff74f2c54a 100644 --- a/src/engine/channels/enginechannel.cpp +++ b/src/engine/channels/enginechannel.cpp @@ -96,13 +96,20 @@ void EngineChannel::slotOrientationCenter(double v) { } EngineChannel::ChannelOrientation EngineChannel::getOrientation() const { - double dOrientation = m_pOrientation->get(); - if (dOrientation == LEFT) { + const double dOrientation = m_pOrientation->get(); + const int iOrientation = static_cast(dOrientation); + if (dOrientation != iOrientation) { + return CENTER; + } + switch (iOrientation) { + case LEFT: return LEFT; - } else if (dOrientation == CENTER) { + case CENTER: return CENTER; - } else if (dOrientation == RIGHT) { + case RIGHT: return RIGHT; + default: + return CENTER; } return CENTER; } diff --git a/src/engine/controls/loopingcontrol.cpp b/src/engine/controls/loopingcontrol.cpp index 7e2507ed8ce..7ad8812aa75 100644 --- a/src/engine/controls/loopingcontrol.cpp +++ b/src/engine/controls/loopingcontrol.cpp @@ -128,8 +128,12 @@ LoopingControl::LoopingControl(const QString& group, // DEPRECATED: Use beatloop_size and beatloop_set instead. // Activates a beatloop of a specified number of beats. m_pCOBeatLoop = new ControlObject(ConfigKey(group, "beatloop"), false); - connect(m_pCOBeatLoop, &ControlObject::valueChanged, this, - [=](double value){slotBeatLoop(value);}, Qt::DirectConnection); + connect( + m_pCOBeatLoop, + &ControlObject::valueChanged, + this, + [=, this](double value) { slotBeatLoop(value); }, + Qt::DirectConnection); m_pCOBeatLoopSize = new ControlObject(ConfigKey(group, "beatloop_size"), true, false, false, 4.0); diff --git a/src/engine/enginebuffer.cpp b/src/engine/enginebuffer.cpp index 7fc73494723..fbd22235b21 100644 --- a/src/engine/enginebuffer.cpp +++ b/src/engine/enginebuffer.cpp @@ -263,7 +263,7 @@ EngineBuffer::EngineBuffer(const QString& group, m_pScaleLinear = new EngineBufferScaleLinear(m_pReadAheadManager); m_pScaleST = new EngineBufferScaleST(m_pReadAheadManager); m_pScaleRB = new EngineBufferScaleRubberBand(m_pReadAheadManager); - if (m_pKeylockEngine->get() == SOUNDTOUCH) { + if (m_pKeylockEngine->get() == static_cast(SOUNDTOUCH)) { m_pScaleKeylock = m_pScaleST; } else { m_pScaleKeylock = m_pScaleRB; diff --git a/src/library/analysisfeature.cpp b/src/library/analysisfeature.cpp index ea3a470b2e5..b81cd3146ec 100644 --- a/src/library/analysisfeature.cpp +++ b/src/library/analysisfeature.cpp @@ -81,7 +81,7 @@ void AnalysisFeature::bindLibraryWidget(WLibrary* libraryWidget, connect(m_pAnalysisView, &DlgAnalysis::loadTrackToPlayer, this, - [=](TrackPointer track, const QString& group) { + [=, this](TrackPointer track, const QString& group) { emit loadTrackToPlayer(track, group, false); }); connect(m_pAnalysisView, diff --git a/src/library/autodj/autodjprocessor.cpp b/src/library/autodj/autodjprocessor.cpp index e7070a95973..2f5e71c1f90 100644 --- a/src/library/autodj/autodjprocessor.cpp +++ b/src/library/autodj/autodjprocessor.cpp @@ -116,7 +116,6 @@ AutoDJProcessor::AutoDJProcessor( int iAutoDJPlaylistId) : QObject(pParent), m_pConfig(pConfig), - m_pPlayerManager(pPlayerManager), m_pAutoDJTableModel(nullptr), m_eState(ADJ_DISABLED), m_transitionProgress(0.0), diff --git a/src/library/autodj/autodjprocessor.h b/src/library/autodj/autodjprocessor.h index fe9c90b477a..0c5578ba3bd 100644 --- a/src/library/autodj/autodjprocessor.h +++ b/src/library/autodj/autodjprocessor.h @@ -25,11 +25,11 @@ class DeckAttributes : public QObject { virtual ~DeckAttributes(); bool isLeft() const { - return m_orientation.get() == EngineChannel::LEFT; + return m_orientation.get() == static_cast(EngineChannel::LEFT); } bool isRight() const { - return m_orientation.get() == EngineChannel::RIGHT; + return m_orientation.get() == static_cast(EngineChannel::RIGHT); } bool isPlaying() const { @@ -278,7 +278,6 @@ class AutoDJProcessor : public QObject { bool removeTrackFromTopOfQueue(TrackPointer pTrack); void maybeFillRandomTracks(); UserSettingsPointer m_pConfig; - PlayerManagerInterface* m_pPlayerManager; PlaylistTableModel* m_pAutoDJTableModel; AutoDJState m_eState; diff --git a/src/network/jsonwebtask.h b/src/network/jsonwebtask.h index 916be0cc991..0b83c3e8d60 100644 --- a/src/network/jsonwebtask.h +++ b/src/network/jsonwebtask.h @@ -13,11 +13,11 @@ namespace network { struct JsonWebRequest final { public: JsonWebRequest() = delete; - JsonWebRequest(const JsonWebRequest&) = default; - JsonWebRequest(JsonWebRequest&&) = default; - - JsonWebRequest& operator=(const JsonWebRequest&) = default; - JsonWebRequest& operator=(JsonWebRequest&&) = default; + JsonWebRequest(HttpRequestMethod method, QString path, QUrlQuery query, QJsonDocument content) + : method(std::move(method)), + path(std::move(path)), + query(std::move(query)), + content(std::move(content)){}; HttpRequestMethod method; QString path; diff --git a/src/preferences/dialog/dlgprefdeck.cpp b/src/preferences/dialog/dlgprefdeck.cpp index 4424e6d4a89..73ab9c39988 100644 --- a/src/preferences/dialog/dlgprefdeck.cpp +++ b/src/preferences/dialog/dlgprefdeck.cpp @@ -52,10 +52,11 @@ DlgPrefDeck::DlgPrefDeck(QWidget* parent, // Create text color for the cue mode link "?" to the manual createLinkColor(); - m_pNumDecks->connectValueChanged(this, [=](double value){slotNumDecksChanged(value);}); + m_pNumDecks->connectValueChanged(this, [=, this](double value) { slotNumDecksChanged(value); }); slotNumDecksChanged(m_pNumDecks->get(), true); - m_pNumSamplers->connectValueChanged(this, [=](double value){slotNumSamplersChanged(value);}); + m_pNumSamplers->connectValueChanged( + this, [=, this](double value) { slotNumSamplersChanged(value); }); slotNumSamplersChanged(m_pNumSamplers->get(), true); // Set default value in config file and control objects, if not present diff --git a/src/util/class.h b/src/util/class.h index ad313c561fd..793a7726faa 100644 --- a/src/util/class.h +++ b/src/util/class.h @@ -3,5 +3,5 @@ // A macro to disallow the copy constructor and operator= functions // This should be used in the private: declarations for a class #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&); \ - void operator=(const TypeName&) + TypeName(const TypeName&) = delete; \ + void operator=(const TypeName&) = delete; diff --git a/src/util/fifo.h b/src/util/fifo.h index 4e919ba9515..e0a37b05748 100644 --- a/src/util/fifo.h +++ b/src/util/fifo.h @@ -66,5 +66,5 @@ class FIFO { private: std::vector m_data; PaUtilRingBuffer m_ringBuffer; - DISALLOW_COPY_AND_ASSIGN(FIFO); + DISALLOW_COPY_AND_ASSIGN(FIFO); }; diff --git a/src/util/messagepipe.h b/src/util/messagepipe.h index b1c478c803a..d784b7fd0e5 100644 --- a/src/util/messagepipe.h +++ b/src/util/messagepipe.h @@ -50,9 +50,7 @@ class MessagePipe { rigtorp::SPSCQueue& m_sender_messages; QScopedPointer m_pTwoWayMessagePipeReference; -#define COMMA , - DISALLOW_COPY_AND_ASSIGN(MessagePipe); -#undef COMMA + DISALLOW_COPY_AND_ASSIGN(MessagePipe); }; // TwoWayMessagePipe is a bare-bones wrapper around the above rigtorp::SPSCQueue class that @@ -106,9 +104,5 @@ class TwoWayMessagePipe { // Messages waiting to be delivered to the sender. rigtorp::SPSCQueue m_sender_messages; - // This #define is because the macro gets confused by the template - // parameters. -#define COMMA , - DISALLOW_COPY_AND_ASSIGN(TwoWayMessagePipe); -#undef COMMA + DISALLOW_COPY_AND_ASSIGN(TwoWayMessagePipe); }; diff --git a/src/widget/wtrackmenu.cpp b/src/widget/wtrackmenu.cpp index 49af1ce56b1..6a4e2dcaad0 100644 --- a/src/widget/wtrackmenu.cpp +++ b/src/widget/wtrackmenu.cpp @@ -188,7 +188,9 @@ void WTrackMenu::createMenus() { void WTrackMenu::createActions() { const auto hideRemoveKeySequence = - QKeySequence(kHideRemoveShortcutModifier | kHideRemoveShortcutKey); + // TODO(XXX): Qt6 replace enum | with QKeyCombination + QKeySequence(static_cast(kPropertiesShortcutModifier) | + kPropertiesShortcutKey); if (featureIsEnabled(Feature::AutoDJ)) { m_pAutoDJBottomAct = new QAction(tr("Add to Auto DJ Queue (bottom)"), this); @@ -253,7 +255,10 @@ void WTrackMenu::createActions() { // The keypress is caught in WTrackTableView::keyPressEvent if (m_pTrackModel) { m_pPropertiesAct->setShortcut( - QKeySequence(kPropertiesShortcutModifier | kPropertiesShortcutKey)); + // TODO(XXX): Qt6 replace enum | with QKeyCombination + QKeySequence( + static_cast(kPropertiesShortcutModifier) | + kPropertiesShortcutKey)); } connect(m_pPropertiesAct, &QAction::triggered, this, &WTrackMenu::slotShowDlgTrackInfo); }