From cb3deaaaac1170d8a9ca06312a097ae7f8689024 Mon Sep 17 00:00:00 2001
From: Logan Aerl Arias <logana@srb2.org>
Date: Sun, 7 Jan 2024 15:08:51 -0500
Subject: [PATCH] Update lauxlib.h

lauxlib.h: mark luaL_error as a REPORT function
---
 src/blua/lauxlib.h | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/blua/lauxlib.h b/src/blua/lauxlib.h
index c5ea45a1cb..87844f4057 100644
--- a/src/blua/lauxlib.h
+++ b/src/blua/lauxlib.h
@@ -31,6 +31,26 @@ LUALIB_API void (luaL_setn) (lua_State *L, int t, int n);
 /* extra error code for `luaL_load' */
 #define LUA_ERRFILE     (LUA_ERRERR+1)
 
+/* Compiler-specific attributes and other macros */
+
+#ifdef __GNUC__ // __attribute__ ((X))
+
+	#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && defined (__MINGW32__) // MinGW, >= GCC 4.1
+		#if 0 //defined  (__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO > 0
+			#define FUNCREPORT  __attribute__ ((format(gnu_printf, 2, 3)))
+		#elif (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) // >= GCC 4.4
+			#define FUNCREPORT  __attribute__ ((format(ms_printf, 2, 3)))
+		#else
+			#define FUNCREPORT  __attribute__ ((format(printf, 2, 3)))
+		#endif
+	#else
+		#define FUNCREPORT  __attribute__ ((format(printf, 2, 3)))
+	#endif
+#endif
+
+#ifndef FUNCREPORT
+#define FUNCREPORT
+#endif
 
 typedef struct luaL_Reg {
   const char *name;
@@ -65,7 +85,7 @@ LUALIB_API int   (luaL_newmetatable) (lua_State *L, const char *tname);
 LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
 
 LUALIB_API void (luaL_where) (lua_State *L, int lvl);
-LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
+LUALIB_API FUNCREPORT int (luaL_error) (lua_State *L, const char *fmt, ...);
 
 LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
                                    const char *const lst[]);
-- 
GitLab