Fix clang warning -Wmissing-noreturn

This commit is contained in:
Roelf-Jilling 2018-11-16 10:17:40 +01:00
parent 6fe1a42035
commit 1b15a73942
2 changed files with 9 additions and 18 deletions

View File

@ -14,21 +14,17 @@
// //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include <cstdlib> // for std::exit #include <cstdlib> // for std::exit
#include <gsl/span> // for span #include <gsl/span> // for span
int operator_subscript_no_throw() noexcept int operator_subscript_no_throw() noexcept
{ {
int arr[10]; int arr[10];
const gsl::span<int> sp { arr }; const gsl::span<int> sp{arr};
return sp[11]; return sp[11];
} }
[[noreturn]] void test_terminate() { std::exit(0); }
void test_terminate()
{
std::exit(0);
}
void setup_termination_handler() noexcept void setup_termination_handler() noexcept
{ {
@ -44,7 +40,6 @@ void setup_termination_handler() noexcept
#endif #endif
} }
int main() noexcept int main() noexcept
{ {
setup_termination_handler(); setup_termination_handler();

View File

@ -14,20 +14,17 @@
// //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include <cstdlib> // for std::exit #include <cstdlib> // for std::exit
#include <gsl/gsl_util> // for narrow
#include <gsl/gsl_assert> // for get_terminate #include <gsl/gsl_assert> // for get_terminate
#include <gsl/gsl_util> // for narrow
int narrow_no_throw() int narrow_no_throw()
{ {
const long long bigNumber = 0x0fffffffffffffff; const long long bigNumber = 0x0fffffffffffffff;
return gsl::narrow<int>(bigNumber); return gsl::narrow<int>(bigNumber);
} }
void test_terminate() [[noreturn]] void test_terminate() { std::exit(0); }
{
std::exit(0);
}
void setup_termination_handler() noexcept void setup_termination_handler() noexcept
{ {
@ -43,7 +40,6 @@ void setup_termination_handler() noexcept
#endif #endif
} }
int main() int main()
{ {
setup_termination_handler(); setup_termination_handler();