forked from wolfSSL/wolfssl
only force exit() in all cases with gcc since we know noreturn attribute there
This commit is contained in:
@ -355,11 +355,30 @@ void join_thread(THREAD_TYPE);
|
||||
#endif
|
||||
static const word16 wolfSSLPort = 11111;
|
||||
|
||||
static INLINE void err_sys(const char* msg)
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define WC_NORETURN __attribute__((noreturn))
|
||||
#else
|
||||
#define WC_NORETURN
|
||||
#endif
|
||||
|
||||
static INLINE WC_NORETURN void err_sys(const char* msg)
|
||||
{
|
||||
printf("wolfSSL error: %s\n", msg);
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
/* scan-build (which pretends to be gnuc) can get confused and think the
|
||||
* msg pointer can be null even when hardcoded and then it won't exit,
|
||||
* making null pointer checks above the err_sys() call useless.
|
||||
* We could just always exit() but some compilers will complain about no
|
||||
* possible return, with gcc we know the attribute to handle that with
|
||||
* WC_NORETURN. */
|
||||
if (msg)
|
||||
#endif
|
||||
{
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define MY_EX_USAGE 2
|
||||
|
Reference in New Issue
Block a user