This is necessary for regex-like renames (where you can't use the #define trick
as is done in many of the %keywordwarn directives). It's now unnecessary to print
the "renaming to '`x`'" code explicitly by the kw.swg files.
We were passing flags of DOH_REPLACE_ANY|DOH_REPLACE_FIRST in three
places, which doesn't make sense as those are mutually exclusive
concepts. In the current implementation DOH_REPLACE_FIRST wins in
this situation, so replace with that and clarify the docs.
The SWIG_PyInstanceMethod_New method is no longer added to wrapped
classes except when it's actually needed, which is when
(!builtin && fastproxy) is true (which it isn't by default).
The SWIG_PyStaticMethod_New method is no longer is now similarly
gated - previously only (fastproxy) was checked.
Finally the C/C++ functions that implement these were always compiled
into the module, but now they're only included if
(!builtin && fastproxy) is true.
Issue noted by vadz in #2190.
When not using -builtin, the self parameter is now still made
available so that user typemaps can use it. Fixes#967.
When using -builtin, fix -Wunused-parameter warnings in the generated
wrapper code. See #801.
Based on a commit peeled out of #801 by teythoon.
Use SWIG_<module>_Init() function to init the module rather than
<module>_Init() as the latter can collide with a function being wrapped.
Fixes#745Fixes#1739
Remove redundant NULL checks before free()/delete
The ISO C and C++ standards guarantee that it's safe to call these
on a NULL pointer, so it's not necessary for the calling code to
also check.
Fixes https://sourceforge.net/p/swig/feature-requests/70/
YYEOF works as a token for "end of file" on my dev box but fails in
CI. I assume it must be a Bison version difference.
Based on the Bison manual, I'm trying this fix (which also works on my
dev box).
Adding full support for these in expressions seems hard to do without
introducing conflicts into the parser grammar, but in fact all reported
cases have had parentheses around the comparison and we can support that
with a few restrictions on the left side of `<`.
Fixes#80 and #635. Also https://sourceforge.net/p/swig/bugs/1139/
Document extern template functions support.
Extern templates result in new warning to differentiate
from template explicit instantiation definition warning.
Since the switch to wrapping classes using PHP's C API, we now
internally need to be able to tell if a PHP object is of or derived
from a class that is wrapped by SWIG so we know if we can offset the
zend_object pointer to get to the swig_object_wrapper. If we try to
do this to an object which isn't wrapped by SWIG then we invoke C/C++
undefined behaviour (and typically get a segmentation fault).
This check is implemented by having a SWIG\wrapped empty interface which
we make all SWIG-wrapped classes implement simply so we can test for it
to detect such classes.
Fixes#2125
As discussed and agreed in #1629, it's become hard to test with Perl
5.6 or earlier, such old versions are no longer in active use, and
4.1.0 is an appropriate time to make such a change.
I've dropped the compatibility code that was obvious to me, but there's
probably more that can be cleaned up now.
Fix access to C++ static member functions using Python class
staticmethod syntax, such as Klass.memberfunction instead of
Klass_memberfunction, when using -fastproxy and -builtin in
combination with %callback.
The docstring containing the callback pointers were not being patched
during module initialisation.
Accept keyword arguments accessing C++ static member functions when
using -builtin and kwargs feature and Python class staticmethod syntax.
The missing keyword argument support was only when using the
class staticmethod syntax, not when using the flat static method
syntax.
Previously the zend_class_entry for Foo was named SWIGTYPE_Foo_ce, but
this can collide in some cases - e.g. if there's a class named p_Foo
then its zend_class entry will be SWIGTYPE_p_Foo_ce, but that's the same
as the swig_type_info for a class named p_Foo_ce.
Do more initialisation at module load time.
Use a shared set of handlers for cases when the C/C++ object is
destroyed with free().
Most of the code in the free_obj and create_object handlers is the
same for every wrapped class so factor that out into common functions.