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:
Adriaan de Groot 2020-10-25 12:48:12 +01:00
parent 9a2fca7f5b
commit 2b9fa0f982
8 changed files with 1 additions and 21 deletions

View File

@ -228,7 +228,6 @@ 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
@ -246,8 +245,6 @@ else()
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual" )
set( SUPPRESS_3RDPARTY_WARNINGS "" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTREACHED='__builtin_unreachable();'" )
endif()
# Use mark_thirdparty_code() to reduce warnings from the compiler

View File

@ -271,7 +271,6 @@ flavoredWidget( Calamares::Branding::PanelFlavor flavor,
case Calamares::Branding::PanelFlavor::None:
return nullptr;
}
NOTREACHED return nullptr; // All enum values handled above
}
/** @brief Adds widgets to @p layout if they belong on this @p side

View File

@ -101,7 +101,6 @@ create_interface( Handler::Type t, const QString& selector )
case Handler::Type::Fixed:
return std::make_unique< GeoIPFixed >( selector );
}
NOTREACHED return nullptr;
}
static RegionZonePair

View File

@ -139,9 +139,6 @@ PartitionSize::toBytes( qint64 totalSectors, qint64 sectorSize ) const
case SizeUnit::GiB:
return toBytes();
}
// notreached
return -1;
}
qint64
@ -179,8 +176,6 @@ PartitionSize::toBytes( qint64 totalBytes ) const
return toBytes();
}
// notreached
return -1;
}
qint64
@ -211,7 +206,6 @@ PartitionSize::toBytes() const
case SizeUnit::GiB:
return CalamaresUtils::GiBtoBytes( static_cast< unsigned long long >( value() ) );
}
NOTREACHED return -1;
}
bool
@ -237,7 +231,6 @@ PartitionSize::operator<( const PartitionSize& other ) const
case SizeUnit::GiB:
return ( toBytes() < other.toBytes() );
}
NOTREACHED return false;
}
bool
@ -263,7 +256,6 @@ PartitionSize::operator>( const PartitionSize& other ) const
case SizeUnit::GiB:
return ( toBytes() > other.toBytes() );
}
NOTREACHED return false;
}
bool
@ -289,7 +281,6 @@ PartitionSize::operator==( const PartitionSize& other ) const
case SizeUnit::GiB:
return ( toBytes() == other.toBytes() );
}
NOTREACHED return false;
}
} // namespace Partition

View File

@ -52,9 +52,6 @@ yamlToVariant( const YAML::Node& node )
case YAML::NodeType::Undefined:
return QVariant();
}
// NOTREACHED
return QVariant();
}

View File

@ -43,7 +43,6 @@ Config::status() const
case Status::FailedNetworkError:
return tr( "Network Installation. (Disabled: Unable to fetch package lists, check your network connection)" );
}
NOTREACHED return QString();
}

View File

@ -47,7 +47,7 @@ NetInstallViewStep::prettyName() const
return m_sidebarLabel ? m_sidebarLabel->get() : tr( "Package selection" );
#if defined( TABLE_OF_TRANSLATIONS )
NOTREACHED
__builtin_unreachable();
// 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
// translations can be used.

View File

@ -110,8 +110,6 @@ PackageChooserViewStep::isNextEnabled() const
// exactly one OR one or more
return m_widget->hasSelection();
}
NOTREACHED return true;
}