Commit graph

23,228 commits

Author SHA1 Message Date
William S Fulton
e3ccabbd4d Simpler names when using SwigType_manglestr for templates
The default template name is generated instead of one with the default
template parameter.

Used in various places such as the type system.
2022-11-12 11:46:52 +00:00
William S Fulton
46f2778412 Consolidate name mangling functions
Swig_string_mangle      => Swig_name_mangle_string
Swig_name_mangle        => Swig_name_mangle_string
Swig_string_mangle_type => Swig_name_mangle_type
2022-11-12 09:18:19 +00:00
William S Fulton
3364c18d06 Remove unused code in mzscheme.cxx 2022-11-12 09:06:26 +00:00
William S Fulton
6a9be797e1 SwigType * handling corrections - mangling
Further corrections to pass SwigType * to methods expecting types
instead of passing readable type strings.

Swig_string_mangle() takes a generic String *, but it was calling
functions that require SwigType *. Swig_string_mangle_type() is
now provided for SwigType *r. The special template handling
on types now occurs in this function.
2022-11-12 06:42:36 +00:00
William S Fulton
2acdfd77e9 SwigType * handling corrections
Further corrections to pass SwigType * to methods expecting types
instead of passing readable type strings.

Required reworking code that adds a fake inheritance for smart pointers
using the smartptr feature. Swig_smartptr_upcast() added as a support
function for this.
2022-11-09 22:11:27 +00:00
William S Fulton
ea3f043920 SwigValueWrapper and SwigType * correction
Modifying the type by adding in SwigValueWrapper needs to follow the
normal SwigType conventions for correct and proper type handling.
2022-11-08 09:11:35 +00: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
8ab66c3125 Add changes entry for -swiglib CMake fix 2022-11-05 10:19:36 +00:00
William S Fulton
1bc3b63b11 Correct ordering in CHANGES.current file 2022-11-05 10:18:02 +00:00
William S Fulton
be46d464a9 Merge branch 'swiglib'
* swiglib:
  CMake: Fix -swiglib on win32
2022-11-05 10:15:44 +00:00
William S Fulton
58324db9d2 Merge branch 'patch-5'
* patch-5:
  build: harden nuget.yml permissions
2022-11-05 09:50:55 +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
973590ff91 R rtypecheck typemaps
Further switch to use rtypecheck typemaps instead of hard coded logic.
The full switch to typemaps is deferred until swig-4.2 as it can't be fully
backwards compatible. For now a warning is provided to help the
transition. It provides the full typemap that should be placed into
a user's interface file, for example:

%typemap("rtype") int32_t * "integer"
void testmethod(int32_t * i);
void testmethod();

If there is no rtypecheck typemap for int32_t *, the warning shown is:

example.i:7: Warning 750: Optional rtypecheck code is deprecated. Add the
following typemap to fix as the next version of SWIG will not work without it:
%typemap("rtypecheck") int32_t * %{ (is.integer($arg) || is.numeric($arg)) %}

The warning is shown for any code that previously used "numeric", "integer" or
"character" for the rtype typemap. Copying the rtypecheck typemap as
shown into the user interface file will provide the appropriate fix and
the warning will disappear. This is important to do as swig-4.2 will
not be able to provide this helpful warning.
2022-11-05 08:40:26 +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
fe2d781b42 Bump version to 4.2.0 and migrate CHANGES to CHANGES.current 2022-11-04 20:09:13 +00:00
Clinton Stimpson
1f40d38e56 Use more portable PyUnicode_AsUTF8* methods.
This supports the use of Py_LIMITED_API and also uses
PyUnicode_AsUTF8AndSize if Py_LIMITED_API is set to 3.10 or newer.
2022-11-01 07:54:58 +13:00
Olly Betts
df716b8f00 Document that -php7 is for PHP 7 *or later*
This was already in the manual, but not in -help output.

Fixes #2420
2022-10-31 13:41:10 +13:00
Alex
62e27bb616 build: harden nuget.yml permissions
Signed-off-by: Alex <aleksandrosansan@gmail.com>
2022-10-30 22:48:14 +02:00
Julien Schueller
96f2235d6d CMake: Fix -swiglib on win32
- swig library files must be installed relatively to the exe into PREFIX/bin/Lib
- unset SWIG_LIB_WIN_UNIX else swiglib returns a list of 2 paths which
  break cmake detection (and consistent to the provided windows binaries)
2022-10-26 09:25:14 +02: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
Zackery Spytz
899c9b819e Modify some CHANGES entries that weren't written by me
[skip ci]
2022-10-25 10:16:07 +13:00
William S Fulton
c9dcd0ee78 Add SWIG-4.1.0 release date 2022-10-24 19:47:03 +01:00
William S Fulton
a5b4a4389c Merge branch 'rfix-cleaned-up'
* rfix-cleaned-up:
  Whitespace cleanup in R testcase
  R shared_ptr fixes
  align implementation of smartname to r class name
  enable test for pointerreftest fixed by 752b7e8
  switched implementation reference from java to python
  fixes from code review
  enable li_boost_shared_ptr in r-test-suite
  typo in comment
  fix naming of RClass when template of a shared_ptr
2022-10-24 19:39:34 +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
William S Fulton
4a8f7a9c46 Visual C++ warning fixes 2022-10-24 18:43:31 +01:00
AndLLA
0fec14ba34 align implementation of smartname to r class name 2022-10-24 18:20:10 +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
AndLLA
b15e058a27 typo in comment 2022-10-24 18:20:10 +01:00
AndLLA
a71bb2bc6e fix naming of RClass when template of a shared_ptr 2022-10-24 18:20:10 +01:00
William S Fulton
38c2c15e61 Merge branch 'MSB8027'
* MSB8027:
  CMake: Avoid including parser.c twice
  Fix -Wunused-variable warning
2022-10-24 16:28:29 +01:00
William S Fulton
6370fab025 R - fix $typemap() for R specific typemaps
Add support for special variable replacement in the $typemap()
special variable macro for R specific typemaps (rtype, rtypecheck,
scoercein, scoereout).
2022-10-24 16:27:54 +01:00
William S Fulton
1d73341aa4 Polymorphism in R wrappers fixed for C++ structs 2022-10-24 08:56:55 +01:00
Julien Schueller
2f3fb6a52f CMake: Avoid including parser.c twice
Closes #2409
2022-10-24 09:34:13 +02:00
Julien Schueller
0d523d337d Fix -Wunused-variable warning 2022-10-24 09:34:10 +02: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
f40658c2d0 [python] Avoid undefined behaviour
Cast a parameter type explicitly rather than implicitly by casting
the function pointer type, as the latter is undefined behaviour.

Caught by ubsan.
2022-10-20 10:37:47 +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