[packagechooser] Fix fallthrough situation
- Add a FALLTHRU macro to annotate fallthrough situations in both Clang and GCC, - Annotate intentional fallthroughs. - Add missing break which meant that the selection mode was always multiple-selection.
This commit is contained in:
parent
56db9e9341
commit
fee2297e67
@ -198,7 +198,7 @@ if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
)
|
||||
string( APPEND CMAKE_CXX_FLAGS " ${CLANG_WARNINGS}" )
|
||||
endforeach()
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTREACHED='//'" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTREACHED='//' -DFALLTHRU='[[clang::fallthrough]]'")
|
||||
|
||||
# Third-party code where we don't care so much about compiler warnings
|
||||
# (because it's uncomfortable to patch) get different flags; use
|
||||
@ -225,7 +225,7 @@ else()
|
||||
set( SUPPRESS_3RDPARTY_WARNINGS "" )
|
||||
set( SUPPRESS_BOOST_WARNINGS "" )
|
||||
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTREACHED='__builtin_unreachable();'" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTREACHED='__builtin_unreachable();' -DFALLTHRU='/* */'" )
|
||||
endif()
|
||||
|
||||
# Use mark_thirdparty_code() to reduce warnings from the compiler
|
||||
|
@ -41,9 +41,12 @@ PackageChooserPage::PackageChooserPage( PackageChooserMode mode, QWidget* parent
|
||||
switch ( mode )
|
||||
{
|
||||
case PackageChooserMode::Optional:
|
||||
FALLTHRU;
|
||||
case PackageChooserMode::Required:
|
||||
ui->products->setSelectionMode( QAbstractItemView::SingleSelection );
|
||||
break;
|
||||
case PackageChooserMode::OptionalMultiple:
|
||||
FALLTHRU;
|
||||
case PackageChooserMode::RequiredMultiple:
|
||||
ui->products->setSelectionMode( QAbstractItemView::ExtendedSelection );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user