BUILD: lua: silence a warning on systems where longjmp is not marked as noreturn
If the longjmp() call is not flagged as "noreturn", for example, because the operating system doesn't target a gcc-compatible compiler, we may get this warning when building Lua : src/hlua.c: In function 'hlua_panic_ljmp': src/hlua.c:128:1: warning: no return statement in function returning non-void [-Wreturn-type] static int hlua_panic_ljmp(lua_State *L) { longjmp(safe_ljmp_env, 1); } ^~~~~~ The function's prototype cannot be changed because it must be compatible with Lua's callbacks. Let's simply enclose the call inside WILL_LJMP() which we created exactly to signal a call to longjmp(). It lets the compiler know we won't get back into the function and that the return statement is not needed.
This commit is contained in:
parent
3610486e8c
commit
9d6bb5a546
@ -125,7 +125,7 @@
|
|||||||
__decl_spinlock(hlua_global_lock);
|
__decl_spinlock(hlua_global_lock);
|
||||||
THREAD_LOCAL jmp_buf safe_ljmp_env;
|
THREAD_LOCAL jmp_buf safe_ljmp_env;
|
||||||
static int hlua_panic_safe(lua_State *L) { return 0; }
|
static int hlua_panic_safe(lua_State *L) { return 0; }
|
||||||
static int hlua_panic_ljmp(lua_State *L) { longjmp(safe_ljmp_env, 1); }
|
static int hlua_panic_ljmp(lua_State *L) { WILL_LJMP(longjmp(safe_ljmp_env, 1)); }
|
||||||
|
|
||||||
#define SET_SAFE_LJMP(__L) \
|
#define SET_SAFE_LJMP(__L) \
|
||||||
({ \
|
({ \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user