If the same method name is implemented in a parent class then the
subclass can't have more required parameters than that or else we
get a compatibility error when the module is loaded.
The testsuite wasn't catching this problem because it was no longer
trying to load the modules for testcases without _runme.php, because
the mechanism to do that relied on there being a generated .php
wrapper, which we no longer have by default. Fix that to provide a
regression test for this fix.
See #2151
Otherwise can end up with a second PHP exception if the directorout
typemap doesn't accept PHP Null. `SWIG_fail` in this case results
in us returning to PHP which then propagates the pending exception.
This commit fixes a failure in smoketest.php in Xapian's PHP bindings,
but I've not managed to come up with a reproducer which works for
SWIG's testsuite.
I missed that this change breaks cpp_static, which seems to be to do
with handling the combined getter and setter we emit for static
member variables. Reverting while I figure out how to handle that.
This reverts commit a277748870.
* imfunc:
Add special variable imfuncname expansion for C# and D
Test and document imfuncname special variable expansion
Update docs.
Also expose in proxyClassFunctionHandler
Expose to javaout typemaps.
Conflicts:
CHANGES.current
* csharp-strenghten-overload-check:
Fix expanded director_basic test.
Improve correctness of SwigDerivedClassHasMethod() by making sure only methods that have `override` are used connected by director.
Initial contributions for Linux provided in issue #1233, modified to work
on both Windows and Linux. Dual support is possible by detecting
the sizeof wchar_t which is different on each of these systems.
In some cases the \n was missing from goin directives in some places.
Without this change, you will get
} swig_r = (int)(C....
in the output in some cases, and that won't compile in Go, it will
error with:
../gensio/gensio.go:1508:3: expected ';', found swig_r
It only did this on director callbacks with godirectorin, and only if
the virtual function wasn't assigned to zero. So the following will
fail:
class callbacks {
public:
virtual bool call1(int v, const char * const *strarray);
virtual ~callbacks() = default;
};
but the following won't:
class callbacks {
public:
virtual bool call1(int v, const char * const *strarray) = 0;
virtual ~callbacks() = default;
};
Add "\n" to the proper places to fix this.
Found via `codespell -q 3 -L ans,anumber,ba,bae,chello,clos,cmo,coo,dout,fo,funktion,goin,inout,methid,nd,nin,nnumber,object,objekt,od,ois,packag,parm,parms,pres,statics,strack,struc,tempdate,te,thru,uint,upto,writen`
This appears to have been accidentally added in
d8cc75946b as part of the changes to
support C++11 rvalue references, presumably to match the existing
correct rule for unary &.
There is a non-standard GCC extension for taking the address of a label
using unary &&:
https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
However this extension only works in an expression in a function body,
and SWIG doesn't parse the contents of function bodies so this grammar
rule isn't even providing any useful support for this extension.
If a "docstring" feature is present it will still override a Doxygen comment.
If the "autodoc" feature is also present, the combined "autodoc" and "docstring"
will override the Doxygen comment. If no "docstring" is present then the
"autodoc" feature will not be generated when there is a Doxygen comment.
This way the "autodoc" feature can be specified and used to provide documentation
for 'missing' Doxygen comments.
Closes#1635
This option was undocumented. If used it quietly did nothing
unless you'd installed the SWILL library before building SWIG, but
SWILL is no longer maintained and hasn't seen a release since
2008-04-10.
It's clear nobody has used this functionality for some time as the
code to support it in SWIG isn't actually valid ISO C++:
Modules/browser.cxx: In member function ‘void Browser::show_attributes(Node*)’:
Modules/browser.cxx:57:23: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
57 | char *trunc = "";
| ^~
Modules/browser.cxx:61:21: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
61 | trunc = "...";
| ^~~~~
Closes#2251
* feature/python-builtin-separate-runtime-data:
Rework swig_and_compile_multi_cpp makefile helper
Different capsule names for builtin changes entry
Use different capsule names with and without -builtin
Conflicts:
CHANGES.current
The debug command line options that display parse tree nodes
(-debug-module, -debug-top, -debug-symtabs) now display previously hidden
linked list pointers which are useful for debugging parse trees.
Added new command line option -debug-quiet. This suppresses the display
of most linked list pointers and symbol table pointers in the parse tree nodes.
The keys in the parse tree node are now shown in alphabetical order.
The version checking was historically done to deal with
different versions and importing the low-level Python
module. Then it was used to try and help when using -py3.
A minimum version check implies that the wrappers work
with any version >= 2.7, which is not really correct.
The correct thing to do is to check that the exact
version used matches the one that the C layer was compiled
against, which can only be left for the user to do, perhaps
using %pythonbegin.
Issue #1779
Problem when all the base class's overloaded methods were
overridden in the derived class - fixes "multiply defined" errors.
Linked lists of the overloaded methods were not set up correctly
when handling the using declaration.
Closes#2244
A metaclass is added using a decorator @_swig_add_metaclass which
is designed to provide a metaclass that works for both Python 2 and Python 3.
The option to use the Python 3 only syntax: metaclass=_SwigNonDynamicMeta
via the -py3 command line option has been removed as part of a
simplification to remove the -py3 option.
Issue #1779
pyabc.i for abstract base classes now supports versions of Python
prior to 3.3 by using the collection module for these older versions.
Python-3.3 and later continue to use the collections.abc module.
The -py3 option no longer has any effect on the %pythonabc feature.
* flatstaticmember:
Test -flatstaticmethod and %extend
Python -flatstaticmethod corrections
Enable flat static constructor methods
Move low level static methods
Use flat static method if it's a "friend"
Python: Option to generate flat class methods
Correct logic for suppressing static methods.
Previous logic was missing director disown methods.
Add changes file entry for -flatstaticmethod.
Closes#2137
With flags DOH_REPLACE_ID_BEGIN, DOH_REPLACE_ID_END and
DOH_REPLACE_NUMBER_END the code looked for a match for the token
string using strstr() and then checked the extra condition - if the
extra condition didn't apply it then advanced by the length of the token
before searching again.
However that can miss matches if the strstr() matches can overlap
one another, so only advance one position, which is conservative
but can't miss matches.
For example this would not match before:
Replace("123123", "1231", r, DOH_REPLACE_NUMBER_END);
This issue seems to be entirely latent in the current SWIG codebase
due to the nature of the token strings passed when using these flags.
See #2235
Previously SWIG checked that the typemap action contained ";\n" not
followed by an identifier character, and that it contained no other
`;`, but that incorrectly allows some cases it shouldn't.
Instead check that the action ends with `;\n` and contains no other
`;`, which is simpler and correctly rejects these cases.
Types generated with and without -builtin are not compatible. Mixing
them in a common type list leads to crashes. Avoid this by using
different capsule names: "type_pointer_capsule" without -builtin and
"type_pointer_capsule_builtin" with.
See #1684