]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: lua: move longjmp annotation macros to hlua.h
authorWilliam Lallemand <wlallemand@haproxy.com>
Wed, 10 Jun 2026 12:17:22 +0000 (14:17 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Thu, 11 Jun 2026 12:40:27 +0000 (14:40 +0200)
__LJMP, WILL_LJMP() and MAY_LJMP() were defined locally in hlua.c,
making them unavailable to other modules that implement Lua bindings.
Move them to include/haproxy/hlua.h so they can be used outside of
hlua.c.

include/haproxy/hlua.h
src/hlua.c

index 38952da3bd42eafa3228bb943e226407ba97a632..31a7af08309a6da9ade74e03321aff1d6fee10a8 100644 (file)
 
 #ifdef USE_LUA
 
+/* Lua uses longjmp to perform yield or throwing errors. This
+ * macro is used only for identifying the function that can
+ * not return because a longjmp is executed.
+ *   __LJMP marks a prototype of hlua file that can use longjmp.
+ *   WILL_LJMP() marks an lua function that will use longjmp.
+ *   MAY_LJMP() marks an lua function that may use longjmp.
+ */
+#define __LJMP
+#define WILL_LJMP(func) do { func; my_unreachable(); } while(0)
+#define MAY_LJMP(func) func
+
 /* The following macros are used to set flags. */
 #define HLUA_SET_RUN(__hlua)         do {(__hlua)->flags |= HLUA_RUN;} while(0)
 #define HLUA_CLR_RUN(__hlua)         do {(__hlua)->flags &= ~HLUA_RUN;} while(0)
index 70e0a33a80094f5a0902686655e502d022125da5..d2734d101a2bc001c4bf977bbb2df18871fb8016 100644 (file)
@@ -105,16 +105,6 @@ static uint8_t hlua_body = 1;
  */
 static uint8_t hlua_bool_sample_conversion = HLUA_BOOL_SAMPLE_CONVERSION_UNK;
 
-/* Lua uses longjmp to perform yield or throwing errors. This
- * macro is used only for identifying the function that can
- * not return because a longjmp is executed.
- *   __LJMP marks a prototype of hlua file that can use longjmp.
- *   WILL_LJMP() marks an lua function that will use longjmp.
- *   MAY_LJMP() marks an lua function that may use longjmp.
- */
-#define __LJMP
-#define WILL_LJMP(func) do { func; my_unreachable(); } while(0)
-#define MAY_LJMP(func) func
 
 /* This couple of function executes securely some Lua calls outside of
  * the lua runtime environment. Each Lua call can return a longjmp