Annotate assert failure functions with [[noreturn]] to disable compiler warnings on ASSERT(false, msg)

This commit is contained in:
Sebastian Messmer 2015-07-24 20:27:46 +02:00
parent 50503d9ce0
commit 9299d035df

View File

@ -18,11 +18,11 @@ namespace cpputils {
return std::string()+"Assertion ["+expr+"] failed in "+file+":"+std::to_string(line)+": "+message;
}
inline void assert_fail_release(const char *expr, const char *message, const char *file, int line) {
inline void assert_fail_release [[noreturn]] (const char *expr, const char *message, const char *file, int line) {
throw AssertFailed(format(expr, message, file, line));
}
inline void assert_fail_debug(const char *expr, const char *message, const char *file, int line) {
inline void assert_fail_debug [[noreturn]] (const char *expr, const char *message, const char *file, int line) {
std::cerr << format(expr, message, file, line) << std::endl;
abort();
}