Commit graph

5,810 commits

Author SHA1 Message Date
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
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
William S Fulton
e97181ebc0 Add missing typecheck typemaps for std::auto_ptr and std::unique_ptr
To fix overloading when using these types.
2022-09-17 10:23:51 +01:00
William S Fulton
dad7c93ca0 Provide SWIGTYPE MOVE typemaps in swigmove.i
For implementing full move semantics when passing parameters by value.
Based on SWIGTYPE && and std::unique_ptr typemaps which implement move
semantics.

Added for all languages, but untested for: Go, Ocaml, R, Scilab (and
unlikely to be fully functional for same reasons as for std::unique_ptr
support).

Issue #999
2022-09-16 08:36:25 +01:00
Olly Betts
adc2fa9664 Fix default_args_runme.php for 32-bit platforms
On 32-bit platforms -2147483648 is a PHP float (rather than PHP int on
64-bit platforms) so only check equivalence rather than strict equality.

Fixes #2360
2022-09-14 11:30:28 +12:00
William S Fulton
ad1688055d Correct TCL integers testcase for 32-bit platforms 2022-09-09 22:53:29 +01:00
William S Fulton
0c2d0fea0f Move SwigValueWrapper to header section
Recent change to SwigValueWrapper required the <utility> header.
Included headers should be after the include of the language
specific header files (which go into the earlier runtime section).

Testcase required -Winit-list-lifetime warning suppression change
for Perl which somehow lost the warning suppression when put
into the %begin section.
2022-09-09 19:36:08 +01:00
William S Fulton
0a0743f25c Temporarily remove Octave concatenation test broken in octave-7.2.0 2022-09-09 08:46:26 +01:00
William S Fulton
2212af3f4f rvalue reference outputs
Document rvalue reference outputs behaviour
Test rvalue reference outputs
2022-09-08 08:46:32 +01:00
William S Fulton
4588c41646 Temporarily remove rvalue reference python runtime test
Work in progress: SWIGTYPE && out typemaps need to take ownership
2022-09-03 05:53:54 +01:00
William S Fulton
c6664703f6 std::auto_ptr emulation fix in test case 2022-09-03 05:49:13 +01:00
William S Fulton
4c58bb558f Fix Racket tests using schemerunme directory
For out of source builds
2022-09-02 19:17:38 +01:00
William S Fulton
7934561874 Test/fixes to handle NULL pointer for unique_ptr/auto_ptr
Also add missing unique_ptr tests for Lua and Racket.
2022-08-31 19:42:55 +01:00
William S Fulton
ca9eebcb8d Octave - SWIG now marshalls a C/C++ NULL pointer into the null matrix, []
SWIG has always marshalled the null matrix into a NULL pointer; this remains
and now we have consistency in representing a NULL pointer.

This is a pre-requisite for a pending commit to fully support std::unique_ptr.
2022-08-31 19:40:13 +01:00
William S Fulton
2cfd77b1c0 Racket - NULL pointer handling
SWIG now converts a C/C++ NULL pointer into a null value by calling
scheme_make_null(), so that scheme's null? is true for a NULL C/C++
pointer value.

Consistency with Guile and needed for a pending commit for handling
NULL and std::unique_ptr.
2022-08-31 19:40:13 +01:00
William S Fulton
e139a36511 SWIGTYPE && input typemaps now assume object has been moved
Replicated Java implementation.

Fully implemented for:
- C#
- D
- Guile
- Javascript (UTL)
- Lua
- MzScheme
- Octave (UTL)
- Perl (UTL)
- PHP
- Python (UTL)
- Ruby (UTL)
- Tcl (UTL)

PHP std::auto_ptr std::unique_ptr minor tweaks and testcase corrections
2022-08-31 19:40:14 +01:00
William S Fulton
0634883089 SWIGTYPE && input typemaps now assume object has been moved - Java
Implementation tweak - better RAII.
SWIGTYPE && null pointer check.
2022-08-31 19:40:13 +01:00
William S Fulton
c10a84c775 Cosmetic stray semi-colon removal after %typemap using quotes 2022-08-31 19:40:13 +01:00
William S Fulton
0ba11023ac Rename debug in testcases to trace
To remove D specific keyword rename
2022-08-20 15:09:23 +01:00
William S Fulton
48c644ea6e Add Racket support for std::unique_ptr and std::auto_ptr
Equivalent to Guile implementation.

Slight tweak to proxy ownership was required by adding in
the own member to swig_mz_proxy.
2022-08-18 22:45:03 +01:00
William S Fulton
5365149ae4 Guile testing
- call gc instead of explicitly calling the destructor
- Guile li_std_auto_ptr testcase tweaks intended for use from Racket
2022-08-18 22:45:03 +01:00
William S Fulton
63143e8773 Guile testing - call gc instead of explicitly calling the destructor 2022-08-18 21:42:25 +01:00