Commit graph

5,830 commits

Author SHA1 Message Date
William S Fulton
1d73341aa4 Polymorphism in R wrappers fixed for C++ structs 2022-10-24 08:56:55 +01:00
Olly Betts
cfd2557cda Revert "[js] Add mod_runme.js"
This reverts commit ea514c3961.

The new runme.js isn't used for node because it fails to run
multicpptest testcases, but was failing for jsc in CI.

The first problem is the new file is missing `new` where the two
objects are created, but fixing that reveals that this testcase
is currently broken for Javascript so just revert for now.
2022-10-20 11:42:27 +13:00
Olly Betts
a5bc48afea [Lua] Fix type resolution between SWIG-wrapped modules
See #2126
2022-10-20 10:14:59 +13:00
Olly Betts
867e49d7c5 [Ocaml] Add mod_runme.ml
See #2126
2022-10-19 07:42:11 +13:00
Olly Betts
ea514c3961 [js] Add mod_runme.js
See #2126
2022-10-19 07:35:53 +13:00
William S Fulton
01627edaff Remove C++11 from li_std_vector_vector testcase 2022-10-18 08:05:49 +01:00
Olly Betts
747a6a264f [php] Fix handling of multi-module cases
Look up unknown base classes using SWIG_MangledTypeQueryModule().

Revert to using SWIG_TypeCheck() instead of SWIG_TypeCheckStruct()
as the latter doesn't seem to work for this case (at least for PHP
right now).

Add mod_runme.php as a regression test for this.

Adjust the PHP test harness not to set up reflection for the module
unless it's actually needed for a testcase.  Currently the approach
to find the module name doesn't work for multi-module testcases.

See #2126
2022-10-18 10:28:17 +13:00
William S Fulton
d8a0286012 R - Add support for std::vector<std::vector<std::string>>
Closes #2385
2022-10-17 20:14:45 +01:00
William S Fulton
d58eb86821 Testcase warning fix
Workaround for seemingly bogus warning: ‘<unnamed>[0]’ may be used uninitialized [-Wmaybe-uninitialized]
2022-10-15 14:58:26 +01:00
William S Fulton
e622a708d2 Fix Javascript node test-suite to use desired c++ standard
Passes the -std determined in configure.ac to node-gyp
2022-10-15 14:58:25 +01:00
William S Fulton
bba072d95d Merge branch 'fix-cast'
* fix-cast:
  add tests for new casting behavior
  skip tests when value is out of range
  refactor integers JS testcase to avoid repeating code
  Return uint64_t as double if is bigger than uint32_t
  Use SWIG_TypeCast in SWIG_V8_ConvertInstancePtr if types don't match (#3)
2022-10-14 19:19:13 +01:00
Olly Betts
5f96d15943 [R] Run destructors of local C++ objects on SWIG_fail
Arrange that destructors of local C++ objects in the wrapper function
get run on SWIG_fail (which calls Rf_error() which calls longjmp()).

We achieve this by putting almost everything in the function in its
own block, and end that right before Rf_error() at which point those
destructors will get called.
2022-10-14 14:44:19 +13:00
Olly Betts
fefb231bd8 [php] Update exception_memory_leak_runme.php
Test the new "return by value" case too.
2022-10-14 14:44:19 +13:00
Olly Betts
9ab9c71623 [lua] Run destructors of local C++ objects on SWIG_fail
Arrange that destructors of local C++ objects in the wrapper function
get run on SWIG_fail (which calls lua_error() which calls longjmp()).

We achieve this by putting almost everything in the function in its
own block, and end that right before lua_error() at which point those
destructors will get called.
2022-10-14 14:44:19 +13:00
Olly Betts
3dd7e93c77 Fix issues with exception_memory_leak testcase
The out typemap uses a function name which doesn't match the name of the
function we want it to apply to, so this testcase wasn't actually
triggering an exception so wasn't actually testing anything!

With that fixed, the testcase fails to compile for PHP due to use of
SWIG_exception_fail() (which not all target languages implement), and
with that fixed, the _runme.php needs a try ... catch adding to handle
the raised exception.
2022-10-14 12:12:21 +13:00
William S Fulton
752b7e82cd Add missing SWIGTYPE *const& typemaps 2022-10-13 22:22:18 +01:00
William S Fulton
f13de56e5f Revert "[xml] Move to "Experimental" target language status"
This reverts commit 22a4355f34.

Conflicts:
	CHANGES.current
	RELEASENOTES
2022-10-13 21:14:44 +01:00
Olly Betts
e123c2afe8 Additional SWIG_VERSION testing 2022-10-13 08:09:13 +01:00
William S Fulton
c82aa3bb41 Quick fix SWIG_VERSION not being defined correctly in wrappers 2022-10-13 07:57:09 +01:00
Olly Betts
ac00c7ad98 Fix php example comment typo 2022-10-11 10:30:37 +13:00
William S Fulton
2268d6ee96 Fix compile error when using directors
Fix when using templates with more than one template parameter
and used as an input parameter in a virtual method in a
director class (problem affecting most of the scripting languages).

Fixes #2160
2022-10-10 19:51:08 +01:00
Alba Mendez
55d7a51343 add tests for new casting behavior
more integers are preserved now
2022-10-10 13:28:44 +02:00
Alba Mendez
5b02dc93d6 skip tests when value is out of range 2022-10-10 13:28:44 +02:00
Alba Mendez
cf7733e4b8 refactor integers JS testcase to avoid repeating code 2022-10-10 12:49:57 +02:00
William S Fulton
2f55379687 Improve director unwrap detection for the return type
Resolve the return type to correctly determine if the type is a pointer or
reference to a director class.

SwigType_refptr_count_return() recently added as a simpler fix is no
longer needed.

The conventional approach of using the "type" rather than "decl" to
analyse the return type is used instead too.

Issue #1823
2022-10-10 08:45:26 +01:00
William S Fulton
4a397869a2 Merge branch 'director-unwrap-result'
* director-unwrap-result:
  Unwrap director classes only when returning a pointer or reference to an object
2022-10-07 18:41:14 +01:00
William S Fulton
cea25abca5 Completely remove CFFI
No meaningful progress to update CFFI to experimental status
has been made since CFFI was disabled in SWIG-4.0.0 as the first
stage to removal. This commit is the final stage to remove it.

See issue #1966 for an attempt at updating CFFI to experimental
status. Anyone wishing for SWIG to support CFFI again might
want to utilise this work.
2022-10-06 23:29:33 +01:00
William S Fulton
7b0f7caaf2 Makefile re-order
All target languages are in now in alphabetical order
2022-10-06 23:29:33 +01:00
William S Fulton
19a5f3f4a5 Remove some final testing
Given Visual C++ does not work with these tests (tested with VS2022 17.3 and earlier)
2022-10-06 21:51:18 +01:00
Olly Betts
047928d670 Fix comment typo 2022-10-06 18:06:20 +13:00
Olly Betts
631b41ae7b Use https for swig.org links 2022-10-06 13:16:39 +13:00
William S Fulton
7a5c5896f1 Testcase warning suppression 2022-10-06 00:36:59 +01:00
William S Fulton
5644680788 Doxygen Java fix quoting for \image command
Closes #2048
2022-10-06 00:29:03 +01:00
William S Fulton
ba279ae939 Add support for parsing C++11 final classes
Such as:

  class X final {};

This no longer gives a syntax error.
This change has introduced one more shift-reduce conflict in the parser.
with a conflict with a C style variable declaration with name final:

  class X final;

resulting in a syntax error (for C++ not C). This is an an unusual style
for C++ code and more typical declarations do work:

  X final;

Closes #672
2022-10-05 22:42:17 +01:00
William S Fulton
76f5670fa4 Fix OCaml %rename for enum items 2022-10-05 22:42:17 +01:00
William S Fulton
6f1532e35a Warning fix for OCaml test 2022-10-05 22:41:22 +01:00
Olly Betts
06296a7128 Report errors in preprocessor expressions by default
Until now SWIG quietly ignored such errors unless -Wextra (or -Wall
which implies -Wextra) was passed, but this is unhelpful as it hides
problems.  To illustrate this point, enabling this warning by
default revealled a typo in the preproc_defined.i testcase in
SWIG's own testsuite.

If you really don't want to see this warning, you can suppress it
with command line option -w202 or by using this in your interface
file:

%warnfilter(SWIGWARN_PP_EVALUATION);

Both will work with older versions of SWIG too.

Fixes #1465
Fixes #2389
2022-10-05 17:07:06 +13:00
Olly Betts
4ac3c87a29 Sort out predefined SWIG-specific macros
Ensure that SWIG_VERSION is defined both at SWIG-time and in the
generated C/C++ wrapper code (it was only defined in the wrapper
for some target languages previously).

SWIGGO and SWIGJAVASCRIPT are now defined in the generated wrappers
to match behaviour for all other target languages.

Stop defining SWIGVERSION in the wrapper.  This only happened as a
side-effect of how SWIG_VERSION was defined but was never documented and
is redundant.

The new testcase also checks that SWIG is defined at SWIG-time but not
in the generated wrapper, and that exactly one of a list of
target-language specific macros is defined.

Fixes #1050
2022-10-05 12:40:15 +13:00
William S Fulton
cd46d65beb Testcase overloading warning fix 2022-09-29 19:40:52 +01:00
Olly Betts
3bf1da4298 Fix a few documentation typos 2022-09-29 18:17:32 +13:00
Olly Betts
9a4dea06c8 [php] Add php:allowdynamicproperties feature
This follows PHP 8.2 deprecating dynamic features.

The new feature also provides a clean way to fix the remaining PHP
test case failure under PHP 8.2.
2022-09-29 18:16:51 +13:00
Olly Betts
91887a10cd [php] Avoid creating dynamic properties in testsuite
This gives a deprecation warning with PHP 8.2.
2022-09-28 18:53:04 +13:00
Olly Betts
e789c9e799 [php] Avoid deprecated interpolation syntax
Avoid syntax deprecated in PHP 8.2.
2022-09-28 18:51:53 +13:00
Frank Schlimbach
fa00622614 Fixes for classes with the same name in different namespaces
Includes the majority of patch #1484.
Excludes changes in typepass.cxx for specializations which have no effect
on the duplicate_class_name_in_ns testcase, nor the rest of the test-suite.
2022-09-21 22:38:22 +01:00
William S Fulton
9081e3e878
Merge pull request #2374 from friedrichatgc/fix_octave_horzcat
Fix octave operator horzcat test
2022-09-19 15:10:30 +01:00
William S Fulton
ed333b6b97 std::string throws typemaps
Go, Guile, Racket, Scilab: Add throws typemaps for std::string so that
thrown string exception messages can be seen.

Test all language for std::string throws typemaps
2022-09-19 09:09:29 +01:00
William S Fulton
4a29229bab Add catches_strings test to test throws char * typemap 2022-09-19 09:09:29 +01:00
William S Fulton
d32943b2a9 Javascript v8 object to string exceptions improvement 2022-09-19 09:09:29 +01:00
William S Fulton
00190c484f Javascript, Octave, R - Improve exceptions for %catches
and exception specifications for native types.

Now the raised exception contains the string value as the exception
message instead of just the C/C++ type of the exception.

R exceptions were completely swallowed beforehand
2022-09-19 09:09:29 +01:00
Markus Friedrich
720c28f1ed Reenable and fix octave horzcat operator test
This test was disabled with 0a0743f25c since
it fails with octave 7.2.0

The test function horzcat now uses a variable length argument list to fix this.
Before octave 7 it seems to be possible to call a N-argument octave function
with > N arguments without any error. With octave 7 this seems no longer to be
possible which caused the test failure.
2022-09-18 19:40:37 +02:00