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:
parent
6b1607a19a
commit
acb60e1644
1 changed files with 1 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue