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/
The Ruby C API function 'rb_funcall' is used in various places in generated
code for invoking a Ruby method without parameters. The C function uses a
variadic parameter list for the arguments passed to Ruby, therefore in these
cases the list of variadic parameters is empty.
As an optimization Ruby may implement the 'rb_funcall' function as a macro
which however will not accept an empty list of arguments for '...' as of
C99 and C++11.
In order to prevent compiler warnings, this commit replaces all such
occurrences with a call to 'rb_funcall2' (which in its current name
'rb_funcallv' is invoked by the 'rb_funcall' macro anyway, at least for
Ruby 2.6.6).
It was not obvious to at least one person that namespaces need to be
unignored just like classes and methods. Add an explicit reference to
that in the docs.
Also add something to unignore all classes in the example that shows how
to ignore all classes, as that might not be obvious.
Fixes#193
In the example for ignoring everything, it didn't show how to undo the
ignore all, and the obvious '%rename("") ""' didnt work.
'"%rename("%s") ""' is the right way to do that, so add it to the
example.
Fixes#2173
The example I recently added about renaming didn't compile. Here's the
fix.
There was also a use of the term "override" which should have been
changed to "replace".
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).
This fallback version of PyString_AS_STRING() for Python 3 makes use of
PyUnicode_AS_STRING, but I can find no evidence that ever existed in
Python - all references I've found are to SWIG or SWIG-generated code.
The only uses of PyString_AS_STRING() in SWIG generated code are for
Python 2 #if-branches, so this fallback is never used by SWIG.
Because it doesn't work it can't be usefully used in user interface
files either, so let's remove it to avoid potential user confusion
(such as #987).
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
On AIX, one can compile applications either in 32bit or 64bit.
With GCC, this is done by using: -maix64 or -maix32 (default).
Thus, when building & testing Swig in 64bit, the -maix64 option must be
passed to all calls to gcc.
Fixes#1923
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.
SWIG_SetPointerZval() requires the zval structure passed to be
initialised (so it can handle the constructor case where the zval is
already initialised as a PHP object.
I couldn't think of a suitable regression test for this, but it fixes 2
issues detected by running director_basic under valgrind.
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