From 9a2fca7f5b0126cf22ad15f3be288e39ccc243d9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 24 Oct 2020 17:20:23 +0200 Subject: [PATCH] CMake: prefer normal C++17 [[fallthrough]] annotation --- CMakeLists.txt | 4 ++-- src/libcalamaresui/viewpages/ExecutionViewStep.cpp | 2 +- src/modules/packagechooser/PackageChooserPage.cpp | 4 ++-- src/modules/tracking/Config.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 67d7637f8..193de8c1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -228,7 +228,7 @@ if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) ) string( APPEND CMAKE_CXX_FLAGS " ${CLANG_WARNINGS}" ) endforeach() - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTREACHED='//' -DFALLTHRU='[[clang::fallthrough]]'") + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTREACHED='//'") # Third-party code where we don't care so much about compiler warnings # (because it's uncomfortable to patch) get different flags; use @@ -247,7 +247,7 @@ else() set( SUPPRESS_3RDPARTY_WARNINGS "" ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTREACHED='__builtin_unreachable();' -DFALLTHRU='/* */'" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTREACHED='__builtin_unreachable();'" ) endif() # Use mark_thirdparty_code() to reduce warnings from the compiler diff --git a/src/libcalamaresui/viewpages/ExecutionViewStep.cpp b/src/libcalamaresui/viewpages/ExecutionViewStep.cpp index e3498c62d..bb629b217 100644 --- a/src/libcalamaresui/viewpages/ExecutionViewStep.cpp +++ b/src/libcalamaresui/viewpages/ExecutionViewStep.cpp @@ -42,7 +42,7 @@ makeSlideshow( QWidget* parent ) return new Calamares::SlideshowPictures( parent ); #ifdef WITH_QML case 1: - FALLTHRU; + [[fallthrough]]; case 2: return new Calamares::SlideshowQML( parent ); #endif diff --git a/src/modules/packagechooser/PackageChooserPage.cpp b/src/modules/packagechooser/PackageChooserPage.cpp index 0d5df8177..e46809fdd 100644 --- a/src/modules/packagechooser/PackageChooserPage.cpp +++ b/src/modules/packagechooser/PackageChooserPage.cpp @@ -33,12 +33,12 @@ PackageChooserPage::PackageChooserPage( PackageChooserMode mode, QWidget* parent switch ( mode ) { case PackageChooserMode::Optional: - FALLTHRU; + [[fallthrough]]; case PackageChooserMode::Required: ui->products->setSelectionMode( QAbstractItemView::SingleSelection ); break; case PackageChooserMode::OptionalMultiple: - FALLTHRU; + [[fallthrough]]; case PackageChooserMode::RequiredMultiple: ui->products->setSelectionMode( QAbstractItemView::ExtendedSelection ); } diff --git a/src/modules/tracking/Config.cpp b/src/modules/tracking/Config.cpp index f1f61edfd..0d9778c6a 100644 --- a/src/modules/tracking/Config.cpp +++ b/src/modules/tracking/Config.cpp @@ -182,10 +182,10 @@ enableLevelsBelow( Config* config, TrackingType level ) { case TrackingType::UserTracking: config->userTracking()->setTracking( TrackingStyleConfig::TrackingState::EnabledByUser ); - FALLTHRU; + [[fallthrough]]; case TrackingType::MachineTracking: config->machineTracking()->setTracking( TrackingStyleConfig::TrackingState::EnabledByUser ); - FALLTHRU; + [[fallthrough]]; case TrackingType::InstallTracking: config->installTracking()->setTracking( TrackingStyleConfig::TrackingState::EnabledByUser ); break;