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/
This testcase was using a pointer to a variable which had gone out
of scope, which is undefined behaviour. The test was only passing
because the tests are compiled without optimisation by default and
the memory where this value lived happened to remain intact in that
case with current versions of compilers we test with. Running the
testsuite with CXXFLAGS=-O2 causes this test to fail.
Fix by extending the lifetime of the variable to the whole wrapper
function.
Fixes#1925
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.
The typemaps for long long and unsigned long long didn't handle a
string input correctly, and long_long_runme.php had a flawed test
in this case.
Fixes#2155
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.
Use Python class staticmethod syntax to access C++ static member functions,
such as Klass.memberfunction, instead of Klass_memberfunction.
Examples and test-suite changes in preparation for issue #2137.