Revert this fix unless ZEND_RAW_FENTRY is defined (it was added in
PHP 5.2.<something>):
[PHP] Fix many occurrences of "warning: deprecated conversion from
string constant to 'char*'" from GCC 4.2 in generated C/C++ code.
Use zend_function_entry rather than function_entry in generated code.
The later only exists for compatibility with PHP3!
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9997 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c166ffc10d
commit
a1ae35b43f
2 changed files with 13 additions and 3 deletions
|
|
@ -14,6 +14,16 @@ extern "C" {
|
|||
#include "zend_API.h"
|
||||
#include "php.h"
|
||||
|
||||
#ifdef ZEND_RAW_FENTRY
|
||||
/* ZEND_RAW_FENTRY was added somewhere between 5.2.0 and 5.2.3 */
|
||||
# define SWIG_ZEND_NAMED_FE(ZN, N, A) ZEND_RAW_FENTRY((char*)#ZN, N, A, 0)
|
||||
#else
|
||||
/* This causes warnings from GCC >= 4.2 (assigning a string literal to char*).
|
||||
* But this seems to be unavoidable without directly assuming knowledge of
|
||||
* the structure, which changed between PHP4 and PHP5. */
|
||||
# define SWIG_ZEND_NAMED_FE(ZN, N, A) ZEND_NAMED_FE(ZN, N, A)
|
||||
#endif
|
||||
|
||||
/* These TSRMLS_ stuff should already be defined now, but with older php under
|
||||
redhat are not... */
|
||||
#ifndef TSRMLS_D
|
||||
|
|
|
|||
|
|
@ -714,7 +714,7 @@ public:
|
|||
cs_entry = NULL;
|
||||
|
||||
Printf(s_entry, "/* Every non-class user visible function must have an entry here */\n");
|
||||
Printf(s_entry, "static function_entry %s_functions[] = {\n", module);
|
||||
Printf(s_entry, "static zend_function_entry %s_functions[] = {\n", module);
|
||||
|
||||
/* start the init section */
|
||||
Printv(s_init, "zend_module_entry ", module, "_module_entry = {\n" "#if ZEND_MODULE_API_NO > 20010900\n" " STANDARD_MODULE_HEADER,\n" "#endif\n", NIL);
|
||||
|
|
@ -856,7 +856,7 @@ public:
|
|||
|
||||
/* Just need to append function names to function table to register with PHP. */
|
||||
void create_command(String *cname, String *iname) {
|
||||
// This is for the single main function_entry record
|
||||
// This is for the single main zend_function_entry record
|
||||
if (shadow && php_version == 4) {
|
||||
if (wrapperType != standard)
|
||||
return;
|
||||
|
|
@ -864,7 +864,7 @@ public:
|
|||
Printf(f_h, "ZEND_NAMED_FUNCTION(%s);\n", iname);
|
||||
String * s = cs_entry;
|
||||
if (!s) s = s_entry;
|
||||
Printf(s, " ZEND_RAW_FENTRY((char*)\"%(lower)s\",%s,NULL,0)\n", cname, iname);
|
||||
Printf(s, " SWIG_ZEND_NAMED_FE(%(lower)s,%s,NULL)\n", cname, iname);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue