Avoid -Wempty-body warnings from SWIG_contract_assert

This commit is contained in:
Olly Betts 2022-02-11 08:56:16 +13:00 committed by Olly Betts
commit 31af3ce9bf
11 changed files with 23 additions and 22 deletions

View file

@ -307,7 +307,7 @@ typedef struct {
/* Contract support */
#define SWIG_contract_assert(expr, msg) \
if (!(expr)) { SWIG_Lua_pusherrstring(L, (char *) msg); goto fail; } else
do { if (!(expr)) { SWIG_Lua_pusherrstring(L, (char *) msg); goto fail; } } while (0)
/* helper #defines */

View file

@ -24,7 +24,7 @@
// additional check for unsigned numbers, to not permit negative input
%typemap(in,checkfn="lua_isnumber") unsigned int,
unsigned short, unsigned long, unsigned char
%{SWIG_contract_assert((lua_tonumber(L,$input)>=0),"number must not be negative")
%{SWIG_contract_assert((lua_tonumber(L,$input)>=0),"number must not be negative");
$1 = ($type)lua_tonumber(L, $input);%}
%typemap(out) int,short,long,
@ -43,7 +43,7 @@ $1 = ($type)lua_tonumber(L, $input);%}
%{ temp=($*1_ltype)lua_tonumber(L,$input); $1=&temp;%}
%typemap(in,checkfn="lua_isnumber") const unsigned int&($*1_ltype temp)
%{SWIG_contract_assert((lua_tonumber(L,$input)>=0),"number must not be negative")
%{SWIG_contract_assert((lua_tonumber(L,$input)>=0),"number must not be negative");
temp=($*1_ltype)lua_tonumber(L,$input); $1=&temp;%}
%typemap(out) const int&, const unsigned int&