summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2023-04-27 09:56:38 +1200
committerOlly Betts <olly@survex.com>2023-04-27 10:03:29 +1200
commit589373309dae750ed05a46b1b955993da253a287 (patch)
tree2bc39510bac8d48d1c26d59d6c1e7ff87e1c6878 /Lib
parent240f2572ae7e18ece942ab14f3b085a2fb16d043 (diff)
downloadswig-589373309dae750ed05a46b1b955993da253a287.tar.gz
[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.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/lua/lua.swg3
1 files changed, 2 insertions, 1 deletions
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)}