Wrap multi-statement macro SWIG_PHP_Error(code,msg) in do {...} while (0)

to protect it from expanding incorrectly (spotted by Sam Liddicott).
Fortunately all current uses by SWIG itself appear to be safe.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9088 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2006-05-05 00:34:01 +00:00
commit acb60e1644

View file

@ -46,7 +46,7 @@ static int default_error_code = E_ERROR;
#define SWIG_PHP_Arg_Error_Msg(argnum,extramsg) "Error in argument " #argnum " "#extramsg
#define SWIG_PHP_Error(code,msg) ErrorCode() = code; ErrorMsg() = msg; SWIG_fail;
#define SWIG_PHP_Error(code,msg) do { ErrorCode() = code; ErrorMsg() = msg; SWIG_fail; } while (0)
#define SWIG_contract_assert(expr,msg) \
if (!(expr) ) { zend_printf("Contract Assert Failed %s\n",msg ); } else