mirror of https://gerrit.osmocom.org/libosmocore
osmo_panic(): Annotate as __attribute__ ((noreturn))
In Change-Id I5a70eb65952cbc329bf96eacb428b07a9da32433 we redirected all OSMO_ASSERT() via osmo_panic(). However, this caused various applications to have build failures, as OSMO_ASSERT() now appeared to be able to return to the call site. Let's inform the compiler explicitly that there's no return from osmo_panic(). Change-Id: I8adf4c7b0ee6a4581cef8dd4e9f6a1dfde70ee55
This commit is contained in:
parent
459a180877
commit
bc568d0b9f
|
@ -9,7 +9,7 @@
|
|||
/*! panic handler callback function type */
|
||||
typedef void (*osmo_panic_handler_t)(const char *fmt, va_list args);
|
||||
|
||||
extern void osmo_panic(const char *fmt, ...);
|
||||
extern void osmo_panic(const char *fmt, ...) __attribute__ ((noreturn));
|
||||
extern void osmo_set_panic_handler(osmo_panic_handler_t h);
|
||||
|
||||
/*! @} */
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
* @{
|
||||
* \file panic.c */
|
||||
|
||||
#include <unistd.h>
|
||||
#include <osmocom/core/panic.h>
|
||||
#include <osmocom/core/backtrace.h>
|
||||
|
||||
|
@ -83,8 +84,14 @@ void osmo_panic(const char *fmt, ...)
|
|||
osmo_panic_default(fmt, args);
|
||||
|
||||
va_end(args);
|
||||
|
||||
/* not reached, but make compiler believe we really never return */
|
||||
#ifndef PANIC_INFLOOP
|
||||
exit(2342);
|
||||
#else
|
||||
while (1) ;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*! Set the panic handler
|
||||
* \param[in] h New panic handler function
|
||||
|
|
Loading…
Reference in New Issue