Move code in main loop into new function to handle one method at a time.
In preparation for next commit for using declaration fix.
Remove unused default_director variable.
Fixes fully qualified names for functions added by using declarations:
- Error messages show fully qualified names in Lua
- Overload warning messages show fully qualified names
- Error messages calling dispatch functions for handling overloaded methods in OCaml, Python and Tcl
Segfault was actually avoided in previous commit ab23cb29.
This commit makes handling more robust in the event of
using %ignore just on the derived method, not tested as it is not
what one should do with directors, and possibly other cases.
Go still segfaults with the new testcase director_using_member_scopes.i.
Issue #1441.
Fix using declaration in derived class incorrectly introducing a method
from a base class when the using declaration is declared before the method
declaration. Problem occurred when within a namespace and the parameter types
in the method signatures were not fully qualified.
Issue #1441
The initial prototype shown in these examples has a `len` parameter
but that the rest of the example is as if that parameter isn't there
so remove it from the initial prototype.
Fixes https://sourceforge.net/p/swig/bugs/1289/
SWIG now handles an interface filename specified on the command line
which contains a closing parenthesis `)`, and more generally with
attributes to `%include` and `%import` which are quoted and contain
parentheses.
Fixes#1006
Fix SWIG_AsWCharPtrAndSize() to actually assign to result variable. It
looks like SWIG/Tcl wide character handling is currently fundamentally
broken except on systems which use wide characters as the system
encoding, but this should fix wrapping functions which take a wide
string as a parameter on Microsoft Windows.
Patch from Omar Medina.
Fixes https://sourceforge.net/p/swig/bugs/1290/
SWIG python objects were being freed after the corresponding SWIG
module information was destroyed in Python 3, causing leaks when as
a result the object destructor could not be invoked. To prevent this
misordering, SWIG python objects now obtain a reference to the
Python capsule wrapping the module information, so that the module
information is correctly destroyed after all SWIG python objects
have been freed (and corresponding destructors invoked).
Fixes#2154Fixes#2208
Calling assert() on a condition that's always false is not an
appropriate way to exit after emitting "Fatal error [...]" because
if NDEBUG is defined the assert() becomes a no-op and the error
stops actually being fatal.
The regex pattern to upper-case things containing an `i` had incorrect
escaping (`\\(`...`\\)` instead of `(`...`)`) so `import` didn't get
renamed.
This wasn't detected because there were no `_runme` files for this
testcase, so add rename_camel_runme.php which uses reflection to check
the wrapped PHP classes, functions and constants are all named as
expected.
Also expand coverage of converting to underscore case and add coverage
for converting to lower-camel-case.
Related to #1041.
Use `#pragma GCC poison` (supported since GCC 3, maybe earlier) when
compiling with GCC to help prevent direct uses being introduced for
functions which DOH provides a wrapper for.
This was introduced by a recent commit adding a testcase matching
an example in the manual. There doesn't seem to be a suitable
termplate in the standard library before C++11, so instead use
a dummy version of std::array defined in the testcase.
Exit() is a wrapper for exit() by default, but SetExitHandler() allows
specifying a function to call instead.
This means that failures within DOH (e.g. Malloc() failing due to lack
of memory) will now perform cleanup such as removing output files.
This commit also cleans up exit statuses so SWIG should now reliably
exit with status 0 if the run was successful and status 1 if there was
an error (or a warning and -Werror was in effect).
Previously in some situations SWIG would try to exit with the status set
to the number of errors encountered, but that's problematic - for
example if there were 256 errors this would result in exit status 0 on
most platforms. Also some error statuses have special meanings e.g.
those defined by <sysexits.h>.
Also SWIG/Javascript tried to exit with status -1 in a few places (which
typically results in exit status 255).
Previously code in the SWIG tool didn't handle allocation failures
well. Most places didn't check for NULL return from
malloc()/realloc()/calloc() at all, typically resulting in undefined
behaviour, and some places used assert() to check for a NULL return
(which is a misuse of assert() and such checks disappear if built with
NDEBUG defined leaving us back with undefined behaviour).
All C allocations are now done via wrapper functions (Malloc(),
Realloc() and Calloc()) which emit and error and exit with non-zero
status on failure, so a non-NULL return can be relied upon.
Fixes#1901.
Specifying a value on the typemap method now gives an error, e.g.:
%typemap(argout=123) char * ""
The old way of specifying a language name in the typemap attributes
is no longer supported (it has been deprecated for 16 years).
Closes#891
Both function annotations and variable annotations are turned on using the
"python:annotations" feature. Example:
%feature("python:annotations", "c");
struct V {
float val;
};
The generated code contains a variable annotation containing the C float type:
class V(object):
val: "float" = property(_example.V_val_get, _example.V_val_set)
...
Python 3.5 and earlier do not support variable annotations, so variable
annotations can be turned off with a "python:annotations:novar" feature flag.
Example turning on function annotations but not variable annotations globally:
%feature("python:annotations", "c");
%feature("python:annotations:novar");
or via the command line:
-features python:annotations=c,python:annotations:novar
Closes#1951
These functions are added in a number of testcases but for all
languages not just Python. It's tedious having to update the
PHP expected function lists for them, so let's just filter them
out.
Testing is skipped where there is no support for it, that is,
using -builtin or -fastproxy. How to add this support in needs
determining, it's not clear how to do so.
Python function annotations containing C/C++ types are no longer
generated when using the -py3 option. Function annotations support
has been moved to a feature to provide finer grained control.
It can be turned on globally by adding:
%feature("python:annotations", "c");
or by using the command line argument:
-features python:annotations=c
The implementation is designed to be expandable to support different
annotations implementations. Future implementations could implement
something like the following for generating pure Python types:
%feature("python:annotations", "python");
or typing module types to conform to PEP-484:
%feature("python:annotations", "typing");
Closes#1561
Issue #735