Commit graph

4,982 commits

Author SHA1 Message Date
William S Fulton
528f33e9e5 Merge branch 'ZackerySpytz-OCaml-eliminate-wno-write-strings'
* 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
2019-01-31 07:29:09 +00:00
William S Fulton
280ce63100 Merge branch 'ZackerySpytz-OCaml-template_opaque-using_extend-runtime-tests'
* ZackerySpytz-OCaml-template_opaque-using_extend-runtime-tests:
  [OCaml] Runtime tests for template_opaque, using_extend and some others
2019-01-31 07:25:11 +00:00
William S Fulton
526b2cf0ae Merge branch 'ZackerySpytz-OCaml-director-classes-throw'
* ZackerySpytz-OCaml-director-classes-throw:
  [OCaml] Fix handling of exception specifications for director classes
2019-01-31 07:21:50 +00:00
William S Fulton
2b788c47fa Merge branch 'ZackerySpytz-OCaml-inctest-li_cpointer_cpp-runtime-tests'
* ZackerySpytz-OCaml-inctest-li_cpointer_cpp-runtime-tests:
  [OCaml] Runtime tests for inctest, li_cpointer_cpp and some others
2019-01-31 07:15:03 +00:00
Zackery Spytz
f78358d9aa [OCaml] Runtime tests for template_opaque, using_extend and some others
Add runtime tests for namespace_virtual_method, template_opaque,
using_extend, using_inherit, using_pointers, using_private, and
varargs_overload.
2019-01-27 06:50:51 -07:00
Zackery Spytz
35663b1622 [OCaml] Fix handling of exception specifications for director classes
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.
2019-01-26 05:58:38 -07:00
Zackery Spytz
25e650e7d8 [OCaml] Fix toplevel creation for ocamlmktop versions >= 4.04.0
The -o and -c options of ocamlc/ocamlopt were modified to be stricter
in 4.04.0.
da56cf6dfd

The changes in Examples/Makefile.in are compatible with earlier OCaml
versions (at least back to 3.12.0).
2019-01-25 01:58:48 -07:00
Zackery Spytz
4ca7cd7b27 [OCaml] Eliminate use of -Wno-write-strings
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.
2019-01-24 05:32:35 -07:00
Zackery Spytz
4d54d305fc [OCaml] Runtime tests for inctest, li_cpointer_cpp and some others
Add runtime tests for inctest, li_cpointer_cpp, newobject2,
special_variables, special_variable_macros, template_extend1, and
template_extend2.
2019-01-22 22:50:40 -07:00
Zackery Spytz
4074f788b3 [OCaml] Fix %allowexception
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.
2019-01-22 07:51:45 -07:00
William S Fulton
a873d3810e Merge branch 'ZackerySpytz-OCaml-overload_numeric-warnings'
* ZackerySpytz-OCaml-overload_numeric-warnings:
  [OCaml] Some %typecheck precedence tweaks
2019-01-22 08:12:54 +00:00
William S Fulton
d02f65e26a Merge branch 'ZackerySpytz-OCaml-overload_method-typedef_class-runtime-tests'
* ZackerySpytz-OCaml-overload_method-typedef_class-runtime-tests:
  [OCaml] Runtime tests for overload_method, typedef_class and some others
2019-01-22 08:10:02 +00:00
Zackery Spytz
d5afcab9a6 [OCaml] Some %typecheck precedence tweaks
Fix warnings in overload_numeric.i.

./../overload_numeric.i:36: Warning 509: Overloaded method Nums::over(short) effectively ignored,
./../overload_numeric.i:33: Warning 509: as it is shadowed by Nums::over(signed char).
./../overload_numeric.i:39: Warning 509: Overloaded method Nums::over(int) effectively ignored,
./../overload_numeric.i:33: Warning 509: as it is shadowed by Nums::over(signed char).

Add overload_numeric_runme.ml.
2019-01-21 23:17:43 -07:00
Zackery Spytz
8b083b4284 [OCaml] Runtime tests for overload_method, typedef_class and some others
Add runtime tests for overload_method, typedef_class,
typedef_inherit, typemap_arrays, typemap_delete, types_directive, and
valuewrapper.
2019-01-20 23:08:03 -07:00
Vadim Zeitlin
1e22e791ef Always include default parameter values in Python autodoc strings
One of side effects of 15b369028f was that
the default values were only included in Python doc strings if we could
be sure that they could be interpreted as valid Python expressions, but
this change was actually undesirable as it may be useful to see C++
expression for the default value in the doc string even when it isn't
valid in Python.

Undo this part of the change and extend autodoc unit test to check that
this stays fixed.

Closes #1271.
2019-01-21 00:57:02 +01:00
William S Fulton
8587fd7b0d Merge branch 'ZackerySpytz-OCaml-overloaded-bools-typecheck'
* ZackerySpytz-OCaml-overloaded-bools-typecheck:
  [OCaml] Remove the last remnants of libswigocaml
  [OCaml] Fix the handling of bools in overloaded functions
2019-01-19 23:06:56 +00:00
William S Fulton
65cab79071 Merge branch 'ZackerySpytz-OCaml-dead-code-overloaded-funcs'
* ZackerySpytz-OCaml-dead-code-overloaded-funcs:
  [OCaml] Fix dead code generation in overloaded function wrappers
2019-01-19 23:03:07 +00:00
William S Fulton
88b83a3a75 Merge branch 'ZackerySpytz-OCaml-fvirtual-overload_polymorphic-runtime-tests'
* ZackerySpytz-OCaml-fvirtual-overload_polymorphic-runtime-tests:
  [OCaml] Runtime tests for fvirtual, overload_polymorphic and some others
2019-01-19 23:00:18 +00:00
William S Fulton
8e1893f355 D warning suppressions in autodoc testcase 2019-01-19 19:52:40 +00:00
William S Fulton
721f6ddef1 Add autodoc and keyword argument tests 2019-01-19 19:52:40 +00:00
William S Fulton
1329ed7a5c Suppress rename warnings when parameter names are keywords
Parameter renaming is not fully implemented. Mainly because there is no
C/C++ syntax to
for %rename to fully qualify a function's parameter name from outside
the function. Hence it
is not possible to implemented targetted warning suppression on one
parameter in one function.

Issue #1420
2019-01-19 19:52:34 +00:00
Zackery Spytz
b879ccdc3e [OCaml] Fix the handling of bools in overloaded functions
Use the SWIG_TYPECHECK_BOOL precedence level instead of
SWIG_TYPECHECK_INTEGER when checking for bools.

Add a runtime test in the form of overload_bool_runme.ml.
2019-01-18 23:42:59 -07:00
Zackery Spytz
f71ee5be67 [OCaml] Runtime tests for fvirtual, overload_polymorphic and some others
Add runtime tests for conversion, extend_typedef_class,
extend_constructor_destructor, fvirtual, overload_polymorphic,
template_rename, and using1.
2019-01-17 15:58:48 -07:00
William S Fulton
2e9b270cbb Merge branch 'vadz-better-param-names'
* vadz-better-param-names:
  Enable keyword arguments for keyword_rename unit test
  Update error messages test suite
  Add more tests for Python parameter renaming
  Improve handling parameters clashing with language keywords
2019-01-17 18:19:36 +00:00
Zackery Spytz
fa1a0a378c [OCaml] Fix dead code generation in overloaded function wrappers
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.
2019-01-16 20:00:40 -07:00
Vadim Zeitlin
cb426b1074 Enable keyword arguments for keyword_rename unit test
This is required for the recently added Python test checking that an
argument clashing with a Python keyword is also renamed when using
keyword arguments and fixes this test failure when using -builtin Python
option.
2019-01-17 01:25:43 +01:00
William S Fulton
00fbf09137 Merge branch 'ZackerySpytz-OCaml-callback-example'
* ZackerySpytz-OCaml-callback-example:
  [OCaml] Add a callback example
2019-01-16 21:48:26 +00:00
William S Fulton
32a8cd8f2f Merge branch 'ZackerySpytz-OCaml-constant-char-wrapping'
* ZackerySpytz-OCaml-constant-char-wrapping:
  [OCaml] Fix the wrapping of static const member chars
2019-01-16 21:46:57 +00:00
William S Fulton
1bd1142d02 Fix python callback test-suite failure 2019-01-16 20:10:37 +00:00
Vadim Zeitlin
7e9181d70e Update error messages test suite
List the expected warnings about renaming "def" to "_def" too.
2019-01-16 18:52:19 +01:00
William S Fulton
cf1624ebc4 Python static method wrapper changes
- Static method wrappers were using the 'fastproxy' approach by default.
  This is inconsistent with instance method wrappers. The fastproxy approach
  is now turned off by default to be consistent with instance methods.
  Static method wrappers can now also be controlled using the -fastproxy and
  -olddefs options.

  Example:

    struct Klass {
      static int statmethod(int a = 2);
    };

  generates:

  class Klass(object):
      ...
      @staticmethod
      def statmethod(a=2):
          return _example.Klass_statmethod(a)

  instead of:

    class Klass(object):
      ...
      statmethod = staticmethod(_example.Klass_statmethod)

- Modernise wrappers for static methods to use decorator syntax - @staticmethod.

- Add missing runtime test for static class methods and using the actual
  class method.
2019-01-16 08:21:00 +00:00
Zackery Spytz
a641966e0b [OCaml] Add a callback example
It is based on the the Python and Go examples.
2019-01-16 00:53:13 -07:00
Vadim Zeitlin
22158807fa Add more tests for Python parameter renaming
These tests were proposed by @wsfulton.

See https://github.com/swig/swig/issues/1272
2019-01-16 04:29:04 +01:00
Zackery Spytz
c61c221057 [OCaml] Fix the wrapping of static const member chars
OCaml's constantWrapper() was adding unneeded quotes when wrapping
static const member chars.

Add runtime tests for char_constant, chartest, and
static_const_member.
2019-01-15 16:37:26 -07:00
William S Fulton
fa0c3fe5c2 Merge branch 'ZackerySpytz-OCaml-cpp_nodefault-constructor_rename-runtime-tests'
* ZackerySpytz-OCaml-cpp_nodefault-constructor_rename-runtime-tests:
  [OCaml] Runtime tests for constructor_rename, cpp_nodefault and some others
2019-01-14 23:21:13 +00:00
William S Fulton
3fe9bbe907 Merge branch 'ZackerySpytz-OCaml-copy_string-test'
* ZackerySpytz-OCaml-copy_string-test:
  [OCaml] Fix and re-enable the string_simple, minherit, and unions tests
2019-01-14 23:20:24 +00:00
William S Fulton
36846e9342 Merge branch 'ZackerySpytz-OCaml-class-example'
* ZackerySpytz-OCaml-class-example:
  [OCaml] Re-enable the using_protected unit test
  [OCaml] Add a class example
2019-01-14 23:16:59 +00:00
Zackery Spytz
5b6c57e6ae [OCaml] Runtime tests for constructor_rename, cpp_nodefault and some others
Add runtime tests for constructor_rename, cpp_nodefault, extend,
extend_special_variables, extend_template, extern_c, and
global_ns_arg.
2019-01-13 22:44:31 -07:00
Zackery Spytz
83df4e8ed6 [OCaml] Fix and re-enable the string_simple, minherit, and unions tests
copy_string() is a macro in the OCaml C API, so rename the function
to copy_str(). Add a runtime test.

The minherit runtime test was fixed by b64d685.

Use the proper syntax for accessing member variables in
unions_runme.ml
2019-01-13 17:28:00 -07:00
William S Fulton
694bec91a4 Merge branch 'ZackerySpytz-OCaml-abstract_access-abstract_typedef-runtime-tests'
* ZackerySpytz-OCaml-abstract_access-abstract_typedef-runtime-tests:
  [OCaml] Runtime tests for abstract_access, abstract_typedef and some others
2019-01-12 10:39:43 +00:00
Zackery Spytz
e5b470327b [OCaml] Runtime tests for abstract_access, abstract_typedef and some others
Add runtime tests for abstract_access, abstract_typedef,
abstract_typedef2, abstract_virtual, aggregate, cast_operator, and
constover. The aggregate and cast_operator tests are based on the
corresponding ruby tests, and the rest are based on python tests.
2019-01-11 22:26:11 -07:00
Zackery Spytz
ded4abab62 Some renaming
Add OCaml to Tools/testflags.py.
2019-01-11 21:31:42 -07:00
Zackery Spytz
51bfdce781 Merge remote-tracking branch 'upstream/master' into OCaml-make-j-race-conds 2019-01-11 21:21:56 -07:00
Zackery Spytz
a851e0a9ac [OCaml] Re-enable the using_protected unit test
Use the [member-variable] syntax in using_protected_runme.ml as
required by the OCaml module's documentation and implementation.

Fix the return type for vec_write() in example.h in the OCaml stl
example.
2019-01-11 17:59:23 -07:00
Zackery Spytz
96c5a95878 [OCaml] Add a class example
It is based on the Python class example. The Makefile is based on the
Makefile used in the OCaml shapes example.
2019-01-11 17:53:38 -07:00
Zackery Spytz
5bdb52b319 [OCaml] class_scope_weird, cpp_static, and ignore_parameter runtime tests
They are based on the corresponding python runtime tests.
2019-01-11 19:35:17 +00:00
William S Fulton
b64d685d5f Merge branch 'ZackerySpytz-OCaml-fix-member-var-access'
* ZackerySpytz-OCaml-fix-member-var-access:
  OCaml's classHandler() requires name, not sym:name.
  [OCaml] Fix member var getters and setters
2019-01-11 18:42:19 +00:00
Zackery Spytz
7c653ba7df Add rules for swig.cmi, swig.cmo, and swigp4.cmi
In addition, give runme executables unique names (based on the go
Makefile).
2019-01-10 14:11:16 -07:00
Zackery Spytz
98af86f58b Merge remote-tracking branch 'upstream/master' into OCaml-make-j-race-conds 2019-01-10 13:32:19 -07:00
Zackery Spytz
4ca6fdc551 OCaml's classHandler() requires name, not sym:name.
In classHandler(), assign sym:name to the classname global so that it
can be used in membervariableHandler().

Add a small runme test for li_std_vector.
Use swigp4 when compiling the runme tests.
2019-01-08 20:10:07 -07:00