Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9788 )

Change subject: osmo_panic(): Annotate as __attribute__ ((noreturn))
......................................................................

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
---
M include/osmocom/core/panic.h
M src/panic.c
2 files changed, 9 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/include/osmocom/core/panic.h b/include/osmocom/core/panic.h
index 2bb4240..c4006dc 100644
--- a/include/osmocom/core/panic.h
+++ b/include/osmocom/core/panic.h
@@ -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);

 /*! @} */
diff --git a/src/panic.c b/src/panic.c
index a08f89f..072f458 100644
--- a/src/panic.c
+++ b/src/panic.c
@@ -27,6 +27,7 @@
  *  @{
  * \file panic.c */

+#include <unistd.h>
 #include <osmocom/core/panic.h>
 #include <osmocom/core/backtrace.h>

@@ -83,8 +84,14 @@
                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

--
To view, visit https://gerrit.osmocom.org/9788
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I8adf4c7b0ee6a4581cef8dd4e9f6a1dfde70ee55
Gerrit-Change-Number: 9788
Gerrit-PatchSet: 2
Gerrit-Owner: Harald Welte <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder

Reply via email to