wsutil: Avoid using g_abort()

g_abort() requires GLib 2.50, our minimum required version
is 2.38.
This commit is contained in:
João Valverde 2021-05-20 02:39:19 +01:00
parent cf0cb5819f
commit adfb0b99c2
1 changed files with 3 additions and 2 deletions

View File

@ -11,6 +11,7 @@
#define __WS_ASSERT_H__
#include <ws_attributes.h>
#include <stdlib.h>
/*
* ws_assert() cannot produce side effects, otherwise code will
@ -33,13 +34,13 @@
* g_assert_not_reached() and G_DISABLE_ASSERT. However if that is not
* the case then g_assert_not_reached() is simply (void)0 and that
* causes the spurious warnings, because the compiler can't tell anymore
* that a certain code path is not used. We add the call to g_abort() so
* that a certain code path is not used. We add the call to abort() so
* that the function never returns, even with G_DISABLE_ASSERT.
*/
static inline
WS_NORETURN void ws_assert_not_reached(void) {
g_assert_not_reached();
g_abort();
abort();
};
#endif /* __WS_ASSERT_H__ */