Commit graph

23,082 commits

Author SHA1 Message Date
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
20ed76a27b [ci] Revert continue-on-error for PHP 8.0
Tests are now passing there.
2022-09-29 14:09:01 +13:00
Olly Betts
9908f9f310 [php] Fix testcase segfaults with PHP 8.0
These testcases were segfaulting:

prefix
director_using_member_scopes
virtual_poly

The fix here is admittedly a hack - we perform the initialisation
of EG(class_table) from CG(class_table) which PHP will do, but
hasn't yet.

PHP doesn't seem to clearly document which API calls are actually
valid in minit or other initialisation contexts, but the code we're
generating works with all PHP 7.x and PHP 8.x versions aside from PHP
8.0 so it seems this is a bug in PHP 8.0 rather than that we're doing
something invalid, and we need to work with existing PHP 8.0 releases
so this hack seems a necessary evil.  It will at least have a limited
life as PHP 8.0 is only in active support until 2022-11-26, with
security support ending a year later.

Fixes #2383.
2022-09-29 13:13:52 +13:00
Olly Betts
cb9c96011a [php] Suppress -Wdeclaration-after-statement in php.h
In PHP 8.2 zend_operators.h contains inline code which triggers this
warning and our testsuite uses with option and -Werror.

I don't see a good way to only do this within our testsuite, but
disabling it globally like this shouldn't be problematic.
2022-09-29 11:06:56 +13:00
Olly Betts
246dd2d787 [php] Workaround PHP 8.2 header problem
We need to include php.h before stdio.h (and probably before most
other libc headers).
2022-09-28 19:01:01 +13:00
Olly Betts
55c95d475c [php] Adapt swig_ptr_cast_object for PHP 8.2
The required return type has changed from int to an enum, which
gives a compiler warning when we assign a function pointer.
2022-09-28 18:59:31 +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
Olly Betts
303cf392f7 [ci] Temporarily allow PHP 8.0 and 8.2 to fail
I'm actively working on fixing them, but meanwhile we don't want PR
jobs failing on these.
2022-09-28 18:50:08 +13:00
Olly Betts
c3ae2aaafc [ci] Fix CI to actually test PHP 8.0; add PHP 8.2
The CI job for PHP 8.0 was relying on not specifying a version
giving us PHP 8.0, but actually it gives us 8.1 currently.

This seems too brittle, so always specify the version explicitly as
at worst it means uninstalling and reinstalling PHP packages in a
case we could avoid.

Also add PHP 8.2 testing.

See #2383
2022-09-28 11:13:36 +13:00
William S Fulton
eaf468e9e8 C# CreateWStringFromUTF32 optimisation
Avoid UTF-32 to UTF-8 conversion then get string from UTF-8
Issue #2369
2022-09-22 18:54:49 +01: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
ee9e436971 Fix -Wmisleading-indentation in Octave wrappers 2022-09-20 22:31:50 +01:00
William S Fulton
623b7d97a7 Remove swig.spec file
Discussion #2316
2022-09-20 22:31:50 +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
e407ccd4fe Move SWIG_Octave_Raise into a function
For efficiency and to fix some warnings
2022-09-19 14:48:33 +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
034e2358f9 Add Racket throws typemaps for char * 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
Vadim Zeitlin
b9fa8c23bb Make method wrappers suffix optional and disabled by default
Unfortunately the changes of 26bf86322 (Use SWIG-specific for
non-overloaded synthesized functions too, 2021-11-09) did break some
existing code bases using SWIG as they hardcoded the old wrapper
function names.

So turn this off by default and add a global variable allowing to enable
this, which can be done for a specific language only. This is ugly but,
unfortunately, there is no way to use the Language object from the C
function Swig_MethodToFunction(), so the only alternative would be to
add another parameter to it, but it already has 6 of them, so it
wouldn't really be that much better.

See #2366, #2368, #2370.
2022-09-19 12:40:03 +12:00
Markus Friedrich
d1b7765838 Extended the documentation for octave operator overloading
Octave has more operators than C++. These operators can be overloaded for
the type swig_ref using the standard Octave Object Oriented Programming mechanism.
This is now added to the documentation.
2022-09-18 20:19:39 +02: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
f0af17b324 Correct error handling in Guile pointer conversion 2022-09-16 19:13:02 +01:00
William S Fulton
c5610fd4b3 Guile - Add error checking to SWIGTYPE and SWIGTYPE & in typemaps
To prevent seg faults when passing #nil to these parameter types.
2022-09-16 18:52:52 +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
William S Fulton
de65875955 .gitignore for Lua examples 2022-09-16 08:02:51 +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
Olly Betts
7eb54a38b1 Note workaround for -DFOO change
Code relying on FOO being defined as empty needs to change, but can
just use -DFOO= instead and remain compatible with older SWIG.

Fixes #2363
2022-09-14 10:11:36 +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
c09020853d Update comments re _DEBUG redefinition before including Python.h 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
dcb2544a43 Visual C++ debug builds linking to Python release builds
Only use the corecrt.h workaround for #2090 when using
SWIG_PYTHON_INTERPRETER_NO_DEBUG as the problem seems to only
occur when undefining _DEBUG.

Also extend workaround for Visual Studio 2019 version 16.10 and 16.11
as per #2174 (_MSC_VER=1929).
2022-09-09 19:03:40 +01:00
William S Fulton
26c0a0c152 CHANGES file tweaks 2022-09-09 19:01:54 +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
db432300a9
Merge pull request #2344 from clintonstimpson/py3-slice-object
Use PyObject instead of PySliceObject throughout with Python 3.2+
2022-09-08 20:14:12 +01:00
William S Fulton
c79f7f3d85 Merge branch 'rvalue-move'
* rvalue-move:
  rvalue reference outputs
  Remove broken %implicitconv for const SWIGTYPE &&
  Remove unnecessary const SWIGTYPE & typemap
  Temporarily remove rvalue reference python runtime test
  std::auto_ptr emulation fix in test case
  Ocaml typemap typo fix
  Fix Racket tests using schemerunme directory
  Docs on rvalue parameter changes
  Test/fixes to handle NULL pointer for unique_ptr/auto_ptr
  Octave - SWIG now marshalls a C/C++ NULL pointer into the null matrix, []
  Racket - NULL pointer handling
  SWIGTYPE && input typemaps now assume object has been moved - Go and OCaml
  SWIGTYPE && input typemaps now assume object has been moved
  SWIGTYPE && input typemaps now assume object has been moved - Java
  Cosmetic stray semi-colon removal after %typemap using quotes
  Cosmetic stray semi-colon removal after %typemap
2022-09-08 19:50:31 +01:00
William S Fulton
7ff686c5c1
Merge pull request #2352 from clintonstimpson/py_version_tag
Python:  Use PyType_Modified() instead of modifying flags.
2022-09-08 19:47:04 +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
Clinton Stimpson
e683168018 Use PyObject instead of PySliceObject throughout with Python 3.2+
This supports use of the Py_LIMITED_API.
2022-09-05 22:04:51 -06:00
William S Fulton
c5495fea79 Remove broken %implicitconv for const SWIGTYPE &&
Typemaps should be for SWIGTYPE &&, not just const SWIGTYPE &&.
Needs updating for new approach where the proxy object is moved
for a parameter containing an rvalue reference.
2022-09-05 09:20:59 +01:00
William S Fulton
859264ab94 Remove unnecessary const SWIGTYPE & typemap
This is a duplicate of SWIGTYPE & and the typemap rules result
in SWIGTYPE & being used if there is no const SWIGTYPE & tyemap.
2022-09-05 08:23:58 +01:00
William S Fulton
3ad1626dd3
Merge pull request #2351 from sashashura/patch-1
GitHub Workflows security hardening
2022-09-03 06:16:09 +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
de13a0020b Ocaml typemap typo fix 2022-09-03 05:37:13 +01:00
Clinton Stimpson
2a0abbb7f6 Python: Use PyType_Modified() instead of modifying flags.
Closes #2345
Also supported with Py_LIMITED_API
2022-09-02 15:54:28 -06:00