From 589373309dae750ed05a46b1b955993da253a287 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Thu, 27 Apr 2023 09:56:38 +1200 Subject: [Lua] Alternative SWIG_LUA_CONSTTAB_INT fix SWIG_LUA_CONSTTAB_INT can be called with a constant expression containing commas (e.g. `SizeOf< int,int >::size`). This was addressed in b13f584258079dd88a4ca87412b87ac4464686df by making its second argument variadic, but (a) this doesn't work with our baseline of C90/C++98 and (b) the variadic syntax used is a GCC extension which doesn't work with all compilers (e.g. MSVC). We can solve this without needing variadic macros by simply wrapping this argument in an extra pair of parentheses when calling. --- Lib/lua/lua.swg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Lib') diff --git a/Lib/lua/lua.swg b/Lib/lua/lua.swg index 12c635d77..4244435a5 100644 --- a/Lib/lua/lua.swg +++ b/Lib/lua/lua.swg @@ -18,8 +18,9 @@ * constants typemaps * ----------------------------------------------------------------------------- */ // this basically adds to a table of constants +/* Extra `(`...`)` here are to handle $value being e.g. `SizeOf< int,int >::size`. */ %typemap(consttab) int, unsigned int, short, unsigned short, long, unsigned long, unsigned char, signed char, bool, enum SWIGTYPE - {SWIG_LUA_CONSTTAB_INT("$symname", $value)} + {SWIG_LUA_CONSTTAB_INT("$symname", ($value))} %typemap(consttab) float, double {SWIG_LUA_CONSTTAB_FLOAT("$symname", $value)} -- cgit v1.2.1