[PHP] Don't use zend_error_noreturn() for cases where the function

returns void - now this issue can only matter if you have a function
or method which is directed and returns non-void.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12523 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2011-03-07 23:05:01 +00:00
commit 24053d7789
2 changed files with 24 additions and 3 deletions

View file

@ -5,6 +5,11 @@ See the RELEASENOTES file for a summary of changes in each release.
Version 2.0.3 (in progress) Version 2.0.3 (in progress)
=========================== ===========================
2011-03-07: olly
[PHP] Don't use zend_error_noreturn() for cases where the function
returns void - now this issue can only matter if you have a function
or method which is directed and returns non-void.
2011-03-06: olly 2011-03-06: olly
[PHP] Add casts to the typemaps for long long and unsigned long [PHP] Add casts to the typemaps for long long and unsigned long
long to avoid issues when they are used with shorter types via long to avoid issues when they are used with shorter types via

View file

@ -982,7 +982,11 @@ public:
/* Error handling code */ /* Error handling code */
Printf(f->code, "fail:\n"); Printf(f->code, "fail:\n");
Printv(f->code, cleanup, NIL); Printv(f->code, cleanup, NIL);
Printv(f->code, "SWIG_ZEND_ERROR_NORETURN(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());", NIL); /* This could be zend_error_noreturn(), but that's buggy in PHP ~5.3 and
* using zend_error() here shouldn't generate a warning, so just use that.
* At worst this may result in slightly less good code.
*/
Printv(f->code, "zend_error(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());", NIL);
Printf(f->code, "}\n"); Printf(f->code, "}\n");
@ -2301,7 +2305,11 @@ done:
Append(f->code, "return;\n"); Append(f->code, "return;\n");
Append(f->code, "fail:\n"); Append(f->code, "fail:\n");
Append(f->code, "SWIG_ZEND_ERROR_NORETURN(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());\n"); /* This could be zend_error_noreturn(), but that's buggy in PHP ~5.3 and
* using zend_error() here shouldn't generate a warning, so just use that.
* At worst this may result in slightly less good code.
*/
Append(f->code, "zend_error(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());\n");
Printf(f->code, "}\n"); Printf(f->code, "}\n");
Wrapper_print(f, s_wrappers); Wrapper_print(f, s_wrappers);
@ -2676,7 +2684,15 @@ done:
} }
Append(w->code, "fail:\n"); Append(w->code, "fail:\n");
Append(w->code, "SWIG_ZEND_ERROR_NORETURN(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());\n"); if (!is_void) {
Append(w->code, "SWIG_ZEND_ERROR_NORETURN(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());\n");
} else {
/* This could be zend_error_noreturn(), but that's buggy in PHP ~5.3 and
* using zend_error() here shouldn't generate a warning, so just use that.
* At worst this may result in slightly less good code.
*/
Append(w->code, "zend_error(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());\n");
}
Append(w->code, "}\n"); Append(w->code, "}\n");
// We expose protected methods via an extra public inline method which makes a straight call to the wrapped class' method // We expose protected methods via an extra public inline method which makes a straight call to the wrapped class' method