Add bool output parameter to Swig_overload_dispatch to say when it has
generated code that will use the typecheck typemap code to help Lua and
Octave to not emit unused argv[] arrays.
Alas, resorted to warning suppression for deficient cpp11_initializer_list
typecheck typemap in cpp11_std_initializer_list testcase.
Complete the removal of Ruby's output_helper macro and replacement
with SWIG_AppendOutput for director typemaps.
Requires $isvoid special variable support in director code.
The $isvoid special variable expands to 1 if the
wrapped function has a void return, otherwise expands to 0.
In the implementation, use a consistent variable name, returntype,
for a node's "type" attribute.
Issue #2907
It's far from ideal that ocaml's C API uses a common term like "value"
as a typedef as it can clash with uses of "value" as an identifier in
the C/C++ API being wrapped, but that's not a problem that SWIG created
or really is able to solve.
Previously SWIG would try to rename "value" inside ocaml's headers
by defining it as a macro before including them and then undefining it
afterwards. However this doesn't work for uses of "value" in macros
defined in the ocaml headers for use in code using the ocaml C API.
This lead to SWIG trying to have tweaked copies to replace all such
macros, which have inevitably diverged from those defined by ocaml;
also SWIG lacks replacements for more recently introduced macros.
This option has emitted a deprecation warning since SWIG 3.0.4 - if you
want to specify a different filename extension for generated C++ files
use -cppext instead, which works for all SWIG target language backends.
Avoids confusion with newly created Allocate::is_assignable.
Language::is_immutable is just a wrapper around the
"feature:immutable" flag since previous commit.
is_mutable rename wip
Don't attempt to generate a setter when wrapping
variables which have a private assignment operator as assignment is not
possible. This now matches the behaviour of all the other target languages.
These features were all deprecated in 1.3.26 (October 9, 2005)
or before (many long before), so all more than 17 years and 3 new major
versions ago which seems more than enough time for users to have stopped
using them, especially as most emit a deprecation warning if used.
Add Swig_obligatory_macros which must be called by each
target language to define SWIG_VERSION correctly
in the generated code, as well as the language specific
macro SWIGXXX where XXX is the target language name.
Drop the #ifdef SWIGXXX that was previously generated -
I can't see the point of this and if users are defining
this macro somehow, then users will need to change this
Closes#1050
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).
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.
These were officially deprecated in 2001, and attempts to use them have
resulted in a warning (including a pointer to what to update them to)
for most if not all of that time.
Fixes#1984
Prevent segfaults when too few arguments are passed to a function.
Length checks are not needed for the wrappers of overloaded
functions -- the generated dispatch function already checks.
Add default_args_runme.ml.
Fix minor errors in some runtime tests. Extra args were being passed
in some cases.
* ZackerySpytz-OCaml-classDirectorMethod-CAMLreturn:
[OCaml] Fix possible GC issues in generated director code
Conflicts:
Examples/test-suite/ocaml/director_unroll_runme.ml
If a class was given the director feature, it was not possible
to use ctors with multiple parameters.
Add director_default_runme.ml (it is based on
director_default_runme.java).
The result of caml_named_value() can be cached for (slightly)
improved performance.
This is mentioned in the OCaml reference manual.
https://caml.inria.fr/pub/docs/manual-ocaml/intfc.html#sec453
In addition, fix incorrect use of CAMLreturn() in
caml_ptr_val_internal().
If given, the OCaml module will place the docstring at the very
beginning of the generated mli file, where it can be read by the
OCamldoc tool.
The implementation is based on the equivalent features in the Python
and Ruby modules.
* ZackerySpytz-OCaml-eliminate-wno-write-strings:
[OCaml] Remove support for OCaml versions < 3.12.0
[OCaml] Fix toplevel creation for ocamlmktop versions >= 4.04.0
[OCaml] Eliminate use of -Wno-write-strings
The OCaml module was generating invalid code for director classes
which contain methods with exception specifications. The fix is based
on some of the code in python.cxx's classDirectorMethod().
This commit fixes compilation failures for a number of director unit
tests.
Add director_exception_catches_runme.ml,
director_exception_nothrow_runme.ml, and director_ignore_runme.ml.
The OCaml module was generating duplicate declarations in the ml
and mli files for overloaded functions. For every wrapper function
created for an overloaded function, it would generate a duplicate of
the dispatch function in the ml and mli files.
In addition, add the SWIG banner to generated ml and mli files.
Don't convert string literals to char * in the strings_test example.
In constantWrapper(), use SwigType_str() instead of SwigType_lstr()
in order to keep const qualifiers.
OCaml's variableWrapper() wasn't calling emit_action_code() for
in/out typemaps, which meant that %allowexception was being ignored.
In addition, remove all comments in the typemaps in Lib/ocaml. In the
case of the allowexcept test, one of the typemap comments caused
compilation to fail because it became nested within another comment
in an %exception block.
Re-enable the allowexcept test.
Add allowexcept_runme.ml.
The OCaml module was generating dead code in the wrappers for
overloaded functions. Only the generated dispatch function needs to
allocate an array for the passed arguments.
In addition, add overload_extend, overload_rename and overload_subtype
runtime tests.
OCaml's constantWrapper() was adding unneeded quotes when wrapping
static const member chars.
Add runtime tests for char_constant, chartest, and
static_const_member.
In OCaml 3.08.0, many functions in the OCaml C API were renamed to
include a caml_ prefix. Their previous names were retained as macros
in caml/compatibility.h and were (apparently) deprecated.
Rename occurrences of alloc_string, alloc_tuple, callback, callback2,
callback3, copy_double, copy_int64, copy_string, failwith, and modify
in the OCaml module.
The OCaml module requires OCaml >= 3.08.3, so this change is safe
for all supported OCaml versions.