diff --git a/CMakeLists.txt b/CMakeLists.txt index 843e8bc69..a4571efba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -193,6 +193,7 @@ if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) ) string( APPEND CMAKE_CXX_FLAGS " ${CLANG_WARNINGS}" ) endforeach() + 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 @@ -218,6 +219,8 @@ else() set( SUPPRESS_3RDPARTY_WARNINGS "" ) set( SUPPRESS_BOOST_WARNINGS "" ) + + 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/libcalamares/geoip/Handler.cpp b/src/libcalamares/geoip/Handler.cpp index 60404c2d6..192ab1a7c 100644 --- a/src/libcalamares/geoip/Handler.cpp +++ b/src/libcalamares/geoip/Handler.cpp @@ -113,6 +113,7 @@ create_interface( Handler::Type t, const QString& selector ) return nullptr; #endif } + NOTREACHED return nullptr; } static RegionZonePair diff --git a/src/libcalamares/partition/PartitionSize.cpp b/src/libcalamares/partition/PartitionSize.cpp index 8eb399585..750f75393 100644 --- a/src/libcalamares/partition/PartitionSize.cpp +++ b/src/libcalamares/partition/PartitionSize.cpp @@ -166,6 +166,7 @@ PartitionSize::toBytes() const case SizeUnit::GiB: return CalamaresUtils::GiBtoBytes( static_cast( value() ) ); } + NOTREACHED return -1; } bool @@ -186,6 +187,7 @@ PartitionSize::operator< ( const PartitionSize& other ) const case SizeUnit::GiB: return ( toBytes() < other.toBytes () ); } + NOTREACHED return false; } bool @@ -206,6 +208,7 @@ PartitionSize::operator> ( const PartitionSize& other ) const case SizeUnit::GiB: return ( toBytes() > other.toBytes () ); } + NOTREACHED return false; } bool @@ -226,6 +229,7 @@ PartitionSize::operator== ( const PartitionSize& other ) const case SizeUnit::GiB: return ( toBytes() == other.toBytes () ); } + NOTREACHED return false; } } // namespace Calamares