From bdc089290d2a24fd6d31d2993c537e202ce8c641 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Mon, 16 Sep 2019 21:20:12 +0200 Subject: [PATCH] Add fallthrough comments and remove -Wimplicit-fallthrough=0 Signed-off-by: Jonas Kvinge --- 3rdparty/singleapplication/CMakeLists.txt | 2 +- ext/gstmoodbar/CMakeLists.txt | 2 +- ext/libstrawberry-common/CMakeLists.txt | 2 +- ext/libstrawberry-tagreader/CMakeLists.txt | 2 +- ext/strawberry-tagreader/CMakeLists.txt | 2 +- src/CMakeLists.txt | 2 +- src/collection/collectionmodel.cpp | 15 +++++++++++---- src/context/contextview.cpp | 1 + src/core/player.cpp | 1 + src/scrobbler/scrobblingapi20.cpp | 1 + src/tidal/tidalrequest.cpp | 3 ++- 11 files changed, 22 insertions(+), 11 deletions(-) diff --git a/3rdparty/singleapplication/CMakeLists.txt b/3rdparty/singleapplication/CMakeLists.txt index ed56a317..8519ac9c 100644 --- a/3rdparty/singleapplication/CMakeLists.txt +++ b/3rdparty/singleapplication/CMakeLists.txt @@ -8,7 +8,7 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wimplicit-fallthrough=0 -Wpedantic") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wpedantic") endif() if(CMAKE_VERSION VERSION_GREATER 3.0) diff --git a/ext/gstmoodbar/CMakeLists.txt b/ext/gstmoodbar/CMakeLists.txt index e3851300..8e20aeea 100644 --- a/ext/gstmoodbar/CMakeLists.txt +++ b/ext/gstmoodbar/CMakeLists.txt @@ -5,7 +5,7 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wimplicit-fallthrough=0 -Wpedantic") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wpedantic") endif() include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/ext/libstrawberry-common/CMakeLists.txt b/ext/libstrawberry-common/CMakeLists.txt index bdad98de..e684348a 100644 --- a/ext/libstrawberry-common/CMakeLists.txt +++ b/ext/libstrawberry-common/CMakeLists.txt @@ -8,7 +8,7 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wimplicit-fallthrough=0 -Wpedantic") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wpedantic") endif() set(SOURCES diff --git a/ext/libstrawberry-tagreader/CMakeLists.txt b/ext/libstrawberry-tagreader/CMakeLists.txt index 5fd7ff59..de86a7c4 100644 --- a/ext/libstrawberry-tagreader/CMakeLists.txt +++ b/ext/libstrawberry-tagreader/CMakeLists.txt @@ -10,7 +10,7 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wimplicit-fallthrough=0 -Wpedantic") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wpedantic") endif() set(MESSAGES diff --git a/ext/strawberry-tagreader/CMakeLists.txt b/ext/strawberry-tagreader/CMakeLists.txt index 97198f97..274706bc 100644 --- a/ext/strawberry-tagreader/CMakeLists.txt +++ b/ext/strawberry-tagreader/CMakeLists.txt @@ -12,7 +12,7 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wimplicit-fallthrough=0 -Wpedantic") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wpedantic") endif() set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2d69a5c0..fbe3d9ea 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,7 +19,7 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wimplicit-fallthrough=0 -Wpedantic") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wpedantic") endif() option(BUILD_WERROR "Build with -Werror" OFF) diff --git a/src/collection/collectionmodel.cpp b/src/collection/collectionmodel.cpp index 00f0b024..5e89a830 100644 --- a/src/collection/collectionmodel.cpp +++ b/src/collection/collectionmodel.cpp @@ -1239,10 +1239,17 @@ CollectionItem *CollectionModel::ItemFromSong(GroupBy type, bool signal, bool cr item->sort_text = SortTextForNumber(year) + " "; break; } - case GroupBy_Composer: if (item->key.isNull()) item->key = s.composer(); - case GroupBy_Performer: if (item->key.isNull()) item->key = s.performer(); - case GroupBy_Grouping: if (item->key.isNull()) item->key = s.grouping(); - case GroupBy_Genre: if (item->key.isNull()) item->key = s.genre(); + case GroupBy_Composer: + if (item->key.isNull()) item->key = s.composer(); + // fallthrough + case GroupBy_Performer: + if (item->key.isNull()) item->key = s.performer(); + // fallthrough + case GroupBy_Grouping: + if (item->key.isNull()) item->key = s.grouping(); + // fallthrough + case GroupBy_Genre: + if (item->key.isNull()) item->key = s.genre(); item->display_text = TextOrUnknown(item->key); item->sort_text = SortTextForArtist(item->key); break; diff --git a/src/context/contextview.cpp b/src/context/contextview.cpp index ee778866..6cb7ba4d 100644 --- a/src/context/contextview.cpp +++ b/src/context/contextview.cpp @@ -514,6 +514,7 @@ bool ContextView::eventFilter(QObject *object, QEvent *event) { case QEvent::Paint:{ handlePaintEvent(object, event); } + // fallthrough default:{ return QObject::eventFilter(object, event); } diff --git a/src/core/player.cpp b/src/core/player.cpp index 7c40901a..a600404c 100644 --- a/src/core/player.cpp +++ b/src/core/player.cpp @@ -552,6 +552,7 @@ void Player::EngineStateChanged(Engine::State state) { break; case Engine::Error: emit Error(); + // fallthrough case Engine::Empty: case Engine::Idle: emit Stopped(); diff --git a/src/scrobbler/scrobblingapi20.cpp b/src/scrobbler/scrobblingapi20.cpp index 0d283c93..1083154f 100644 --- a/src/scrobbler/scrobblingapi20.cpp +++ b/src/scrobbler/scrobblingapi20.cpp @@ -150,6 +150,7 @@ void ScrobblingAPI20::Authenticate(const bool https) { messagebox_error.setTextFormat(Qt::RichText); messagebox_error.exec(); } + // fallthrough case QMessageBox::Save: QApplication::clipboard()->setText(url.toString()); break; diff --git a/src/tidal/tidalrequest.cpp b/src/tidal/tidalrequest.cpp index 342a8ecb..5c94e3e3 100644 --- a/src/tidal/tidalrequest.cpp +++ b/src/tidal/tidalrequest.cpp @@ -867,11 +867,12 @@ void TidalRequest::SongsFinishCheck(const qint64 artist_id, const qint64 album_i AddSongsRequest(offset_next); break; case QueryType_SearchSongs: - // If artist_id and album_id isn't zero it means that it's a songs search where we fetch all albums too. So pass through. + // If artist_id and album_id isn't zero it means that it's a songs search where we fetch all albums too. So fallthrough. if (artist_id == 0 && album_id == 0) { AddSongsSearchRequest(offset_next); break; } + // fallthrough case QueryType_Artists: case QueryType_SearchArtists: case QueryType_Albums: