CMake: drop the NOTREACHED macro
- both clang and g++ support __builtin_unreachable(); (as Kevin Kofler pointed out) so we don't need the macro to do different things; - the compilers have gotten better at detecting unreachable code, so instead of inserting macros or fiddly bits, just drop them and the unreachable code they comment.
This commit is contained in:
parent
9a2fca7f5b
commit
2b9fa0f982
@ -228,7 +228,6 @@ if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
|||||||
)
|
)
|
||||||
string( APPEND CMAKE_CXX_FLAGS " ${CLANG_WARNINGS}" )
|
string( APPEND CMAKE_CXX_FLAGS " ${CLANG_WARNINGS}" )
|
||||||
endforeach()
|
endforeach()
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTREACHED='//'")
|
|
||||||
|
|
||||||
# Third-party code where we don't care so much about compiler warnings
|
# Third-party code where we don't care so much about compiler warnings
|
||||||
# (because it's uncomfortable to patch) get different flags; use
|
# (because it's uncomfortable to patch) get different flags; use
|
||||||
@ -246,8 +245,6 @@ else()
|
|||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual" )
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual" )
|
||||||
|
|
||||||
set( SUPPRESS_3RDPARTY_WARNINGS "" )
|
set( SUPPRESS_3RDPARTY_WARNINGS "" )
|
||||||
|
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTREACHED='__builtin_unreachable();'" )
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Use mark_thirdparty_code() to reduce warnings from the compiler
|
# Use mark_thirdparty_code() to reduce warnings from the compiler
|
||||||
|
@ -271,7 +271,6 @@ flavoredWidget( Calamares::Branding::PanelFlavor flavor,
|
|||||||
case Calamares::Branding::PanelFlavor::None:
|
case Calamares::Branding::PanelFlavor::None:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
NOTREACHED return nullptr; // All enum values handled above
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Adds widgets to @p layout if they belong on this @p side
|
/** @brief Adds widgets to @p layout if they belong on this @p side
|
||||||
|
@ -101,7 +101,6 @@ create_interface( Handler::Type t, const QString& selector )
|
|||||||
case Handler::Type::Fixed:
|
case Handler::Type::Fixed:
|
||||||
return std::make_unique< GeoIPFixed >( selector );
|
return std::make_unique< GeoIPFixed >( selector );
|
||||||
}
|
}
|
||||||
NOTREACHED return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static RegionZonePair
|
static RegionZonePair
|
||||||
|
@ -139,9 +139,6 @@ PartitionSize::toBytes( qint64 totalSectors, qint64 sectorSize ) const
|
|||||||
case SizeUnit::GiB:
|
case SizeUnit::GiB:
|
||||||
return toBytes();
|
return toBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
// notreached
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64
|
qint64
|
||||||
@ -179,8 +176,6 @@ PartitionSize::toBytes( qint64 totalBytes ) const
|
|||||||
return toBytes();
|
return toBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
// notreached
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64
|
qint64
|
||||||
@ -211,7 +206,6 @@ PartitionSize::toBytes() const
|
|||||||
case SizeUnit::GiB:
|
case SizeUnit::GiB:
|
||||||
return CalamaresUtils::GiBtoBytes( static_cast< unsigned long long >( value() ) );
|
return CalamaresUtils::GiBtoBytes( static_cast< unsigned long long >( value() ) );
|
||||||
}
|
}
|
||||||
NOTREACHED return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -237,7 +231,6 @@ PartitionSize::operator<( const PartitionSize& other ) const
|
|||||||
case SizeUnit::GiB:
|
case SizeUnit::GiB:
|
||||||
return ( toBytes() < other.toBytes() );
|
return ( toBytes() < other.toBytes() );
|
||||||
}
|
}
|
||||||
NOTREACHED return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -263,7 +256,6 @@ PartitionSize::operator>( const PartitionSize& other ) const
|
|||||||
case SizeUnit::GiB:
|
case SizeUnit::GiB:
|
||||||
return ( toBytes() > other.toBytes() );
|
return ( toBytes() > other.toBytes() );
|
||||||
}
|
}
|
||||||
NOTREACHED return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -289,7 +281,6 @@ PartitionSize::operator==( const PartitionSize& other ) const
|
|||||||
case SizeUnit::GiB:
|
case SizeUnit::GiB:
|
||||||
return ( toBytes() == other.toBytes() );
|
return ( toBytes() == other.toBytes() );
|
||||||
}
|
}
|
||||||
NOTREACHED return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Partition
|
} // namespace Partition
|
||||||
|
@ -52,9 +52,6 @@ yamlToVariant( const YAML::Node& node )
|
|||||||
case YAML::NodeType::Undefined:
|
case YAML::NodeType::Undefined:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTREACHED
|
|
||||||
return QVariant();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,7 +43,6 @@ Config::status() const
|
|||||||
case Status::FailedNetworkError:
|
case Status::FailedNetworkError:
|
||||||
return tr( "Network Installation. (Disabled: Unable to fetch package lists, check your network connection)" );
|
return tr( "Network Installation. (Disabled: Unable to fetch package lists, check your network connection)" );
|
||||||
}
|
}
|
||||||
NOTREACHED return QString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ NetInstallViewStep::prettyName() const
|
|||||||
return m_sidebarLabel ? m_sidebarLabel->get() : tr( "Package selection" );
|
return m_sidebarLabel ? m_sidebarLabel->get() : tr( "Package selection" );
|
||||||
|
|
||||||
#if defined( TABLE_OF_TRANSLATIONS )
|
#if defined( TABLE_OF_TRANSLATIONS )
|
||||||
NOTREACHED
|
__builtin_unreachable();
|
||||||
// This is a table of "standard" labels for this module. If you use them
|
// This is a table of "standard" labels for this module. If you use them
|
||||||
// in the label: sidebar: section of the config file, the existing
|
// in the label: sidebar: section of the config file, the existing
|
||||||
// translations can be used.
|
// translations can be used.
|
||||||
|
@ -110,8 +110,6 @@ PackageChooserViewStep::isNextEnabled() const
|
|||||||
// exactly one OR one or more
|
// exactly one OR one or more
|
||||||
return m_widget->hasSelection();
|
return m_widget->hasSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
NOTREACHED return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user