Commit graph

5,861 commits

Author SHA1 Message Date
William S Fulton
ecf05445b9 Test cases fix 2022-11-26 10:04:35 +00:00
William S Fulton
15692f0e89 Add missing testcase cpp11_template_parameters_decltype 2022-11-26 01:27:04 +00:00
William S Fulton
2a1711e436 Slightly better decltype() support for expressions
decltype now accepts C++ expressions instead of just an ID, such as:

  int i,j;
  ...  decltype(i+j) ...
  ...  decltype(&i) ...

These result in a warning for non-trivial expressions which SWIG cannot evaluate:

  Warning 344: Unable to deduce decltype for 'i+j'.

See 'Type Inference' in CPlusPlus.html for workarounds.

Issue #1589
Issue #1590
2022-11-26 01:16:20 +00:00
William S Fulton
9b91b24d6b Fix syntax error parsing unnamed template parameters with a default.
Closes #961
2022-11-25 08:37:39 +00:00
Olly Betts
81c6a63898 Fix undefined behaviour in parser
Fix undefined behaviour in swig's parser when handling default parameter
expressions containing method calls.

Fixes #2447
2022-11-25 09:51:58 +13:00
William S Fulton
5a8d58c3a7 Merge branch 'rtests2'
* rtests2:
  more r tests
  more r tests
  added testcase pointer_reference
  [PHP] Update docs for removal of -noproxy in SWIG 4.1.0

Conflicts:
	CHANGES.current
2022-11-23 21:12:07 +00:00
William S Fulton
e0904f44eb Restore testing template_expr testcase
Problems handling < and > in template parameters are now fixed.
Remove illegal C++ code (template typedefs) - replace with a function
using same template.
2022-11-23 07:32:12 +00:00
William S Fulton
ca5c68e544 Fix seg fault handling template parameter expressions containing '>='
Similar to previous commit

Issue #1037
2022-11-22 21:40:38 +00:00
William S Fulton
0341258af7 Fix seg fault handling template parameter expressions containing '<='
Recent commits ensure types are correctly stored in SwigType *. In
particular template parameters are enclosed within '<(' and ')>'.
Now we can confidently handle template parameters as really being
delimited as such to fix an infinite loop handling template expressions
containing '<' or '>'. The previous implementation only assumed
template parameters were delimited by '<' and '>'.

Issue #1037
2022-11-22 08:37:35 +00:00
AndLLA
1dd31446ce more r tests 2022-11-20 18:52:00 +01:00
William S Fulton
4729cf2b1f Duplicate class template instantiations via %template changes
Named duplicate class template instantiations now issue a warning and are ignored.
Duplicate empty class template instantiations are quietly ignored.

The test cases are fixed for this new behaviour.

This commit is a pre-requisite for the near future so that the Python
builtin wrappers can correctly use the SwigType_namestr function without
generating duplicate symbol names.
2022-11-18 19:35:47 +00:00
AndLLA
a88995a11d more r tests 2022-11-16 22:17:25 +01:00
AndLLA
63821f1bb5 added testcase pointer_reference 2022-11-16 20:54:45 +01:00
William S Fulton
c0026d036a
Merge pull request #2430 from AndLLA/rtests
more tests for R
2022-11-06 17:17:33 +00:00
William S Fulton
62be0de3d0 Workaround for incomplete or/and keyword support in VC++ 2022-11-06 17:08:12 +00:00
AndLLA
db9df1b3be more tests for R 2022-11-05 20:43:15 +01:00
William S Fulton
86b3e60617 rename cpp14_enable_if_t to cpp17_enable_if_t
std::enable_if_t is in C++14, but std::is_integral_v
is in C++17
2022-11-05 17:13:30 +00:00
William S Fulton
52edda64c1 Fix infinite loop handling non-type template parameters
Fixes infinite loop due to () brackets in a non-type template
parameter containing an expression

Fixes #2418

Non-trivial expressions are still not qualified properly though.
2022-11-05 08:41:10 +00:00
William S Fulton
d6d83f4df4 Overloading fixes for R and rtypecheck typemap
- Fix for special variable $argtype expansion in rtypecheck typemap.
- Remove unnecessary () brackets when using rtypecheck typemap for
  single parameter functions.
- Add rtypecheck typemaps for shared_ptr so that NULL can be used
  in overloaded functions taking shared_ptr.
2022-11-05 08:40:26 +00:00
William S Fulton
f2da4f2ade Improve R wrapper error message calling overloaded methods
when incorrect types passed are passed to the overloaded methods.

Old unhelpful error message:
  Error in f(...) : could not find function "f"

Example of new improved error message:
  Error in use_count(k) :
    cannot find overloaded function for use_count with argtypes (NULL)
2022-11-05 08:40:19 +00:00
William S Fulton
9e7610f972 Fix memory leak in R shared_ptr wrappers
Fix leak when a cast up a class inheritance chain is
required.

Adds implementation of SWIG_ConvertPtrAndOwn for R.

Closes #2386
2022-11-05 08:32:05 +00:00
William S Fulton
24b0e68391 li_boost_shared_ptr testcase for R
Synchronise test with Python version of testcase
2022-11-05 08:02:59 +00:00
William S Fulton
ed09dd948f cpp11_attribute_specifiers testcase warning suppression 2022-11-05 08:02:59 +00:00
William S Fulton
1e99e4fe37 R shared_ptr testing
Enable more tests.
Use preferred member variable access.
2022-10-24 23:03:47 +01:00
AndLLA
76f004766d enable tests working after master merge 2022-10-24 23:03:47 +01:00
William S Fulton
d238d109c9 Whitespace cleanup in R testcase 2022-10-24 19:38:01 +01:00
William S Fulton
6c4dcbb8fe R shared_ptr fixes
Fix problems in shared_ptr wrappers where the class names were
not consistent when using the shared_ptr template or the actual
underlying type. Move $R_class substitution to typemaps.

Issue #2386
2022-10-24 19:37:56 +01:00
AndLLA
deb8664165 enable test for pointerreftest fixed by 752b7e8 2022-10-24 18:20:10 +01:00
AndLLA
0d0e369aaf switched implementation reference from java to python 2022-10-24 18:20:10 +01:00
AndLLA
b885c22f11 fixes from code review 2022-10-24 18:20:10 +01:00
AndLLA
ba96783d11 enable li_boost_shared_ptr in r-test-suite 2022-10-24 18:20:10 +01:00
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