]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUILD: lua: silence a warning on systems where longjmp is not marked as noreturn
authorWilly Tarreau <w@1wt.eu>
Thu, 6 Feb 2020 14:55:41 +0000 (15:55 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 6 Feb 2020 15:01:04 +0000 (16:01 +0100)
commit9d6bb5a5468e07525ae21269776f38f5737aebcf
tree895007a0dee901b0bd5c6dc8905db7d29655159f
parent3610486e8cd9776d2f51c70938732d33a520cdc4
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.
src/hlua.c