You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.4 KiB

  1. commit 3f39e1d4b5ca37e57247034421c69bc301d996b2
  2. Author: Willy Tarreau <w@1wt.eu>
  3. Date: Tue Oct 16 17:57:36 2018 +0200
  4. BUILD: lua: silence some compiler warnings after WILL_LJMP
  5. These ones are on error paths that are properly handled by luaL_error()
  6. which does a longjmp() but the compiler cannot know it. By adding an
  7. __unreachable() statement in WILL_LJMP(), there is no ambiguity anymore.
  8. This may be backported to 1.8 but these previous patches are needed first :
  9. - BUILD: compiler: add a new statement "__unreachable()"
  10. - MINOR: lua: all functions calling lua_yieldk() may return
  11. - BUILD: lua: silence some compiler warnings about potential null derefs (#2)
  12. (cherry picked from commit b059b894cdf795f134b6e53ff95ea7f907feb846)
  13. Signed-off-by: Willy Tarreau <w@1wt.eu>
  14. diff --git a/src/hlua.c b/src/hlua.c
  15. index ad9238ef..c3bb269a 100644
  16. --- a/src/hlua.c
  17. +++ b/src/hlua.c
  18. @@ -24,6 +24,7 @@
  19. #include <ebpttree.h>
  20. #include <common/cfgparse.h>
  21. +#include <common/compiler.h>
  22. #include <common/xref.h>
  23. #include <common/hathreads.h>
  24. @@ -63,7 +64,7 @@
  25. * MAY_LJMP() marks an lua function that may use longjmp.
  26. */
  27. #define __LJMP
  28. -#define WILL_LJMP(func) func
  29. +#define WILL_LJMP(func) do { func; __unreachable(); } while(0)
  30. #define MAY_LJMP(func) func
  31. /* This couple of function executes securely some Lua calls outside of