Commit graph

22,408 commits

Author SHA1 Message Date
Olly Betts
9f87d81fae Clean up testcase source whitespace 2021-12-23 16:18:07 +13:00
Olly Betts
860731e0ea Remove redundant test cases
With C++ comments changed to C comments, these are now identical to
the two cases just above, aside from the `2` suffix on the names.

Follow-on for #2027.
2021-12-23 11:55:47 +13:00
William S Fulton
2d76057571 preproc_cpp test for testing preprocessor and C++
Move C++ comment testing into here.
See 7a9bf3307f.
2021-12-22 19:06:00 +00:00
Olly Betts
1b22fef8ad [php] Add missing runmes for overload_* testcases 2021-12-22 13:40:29 +13:00
William S Fulton
7a9bf3307f Remove C++ comments from preproc C test
Closes issue #2127
2021-12-21 22:36:42 +00:00
Olly Betts
69b580dfb6 [php] Use SWIG_TypeCheckStruct to check types
We have the swig_type_info available and SWIG_TypeCheckStruct
is more efficient because it uses a pointer comparison instead of the
string comparison SWIG_TypeCheck uses (this change speeds up `make
check-php-test-suite` by about 10%).
2021-12-19 13:45:25 +13:00
Olly Betts
a7f2c3d19b [php] Add overload_simple_runme.php 2021-12-18 18:45:52 +13:00
Olly Betts
7d75e3eb7e [PHP] Add new PHP 8.1 keyword
Add PHP keyword 'readonly' (added in 8.1) to the list SWIG knows to
automatically rename.  This keyword is special in that PHP allows it to
be used as a function (or method) name.
2021-12-18 15:30:38 +13:00
Olly Betts
6f016f3a38 TODO: Remove stale PHP entry
Ref count destroying has worked for years (and is explicitly tested
by swig_exception_runme.php).
2021-12-18 15:01:04 +13:00
Olly Betts
dee8b65823 [php] Always use <?php to start .php file
A few files had just <? which only works when the short_open_tag option
is on.  It is on by default (at least in current PHP versions) and we
explicitly tell PHP not to read php.ini, but the PHP docs recommended to
avoid it, and PHP can be built with --disable-short-tags.
2021-12-18 15:00:56 +13:00
Olly Betts
cc5395a669 [php] Add more checks to some PHP testcases 2021-12-18 14:38:49 +13:00
Olly Betts
f04d741d1c [php] Actually implement abstract_inherit_runme.php
The previous version didn't really test anything useful.  Now we
check that trying to instantiate any of the abstract classes fails
with the expected error.
2021-12-18 14:09:56 +13:00
Olly Betts
847f0a6806 Merge branch 'php-codegen-improvements' 2021-12-18 12:32:22 +13:00
Olly Betts
499fb74707 Remove unused Printf parameters 2021-12-18 11:24:00 +13:00
Olly Betts
4672318b42 Make some generated variables static 2021-12-17 22:32:34 +13:00
Olly Betts
cf802c63f2 Improve naming of zend_class_entry structs
Previously the zend_class_entry for Foo was named SWIGTYPE_Foo_ce, but
this can collide in some cases - e.g. if there's a class named p_Foo
then its zend_class entry will be SWIGTYPE_p_Foo_ce, but that's the same
as the swig_type_info for a class named p_Foo_ce.
2021-12-17 17:14:54 +13:00
Olly Betts
f976927d52 Fix source code comment typo 2021-12-17 14:54:05 +13:00
Olly Betts
78f5404727 Improve generated object handlers
Do more initialisation at module load time.

Use a shared set of handlers for cases when the C/C++ object is
destroyed with free().

Most of the code in the free_obj and create_object handlers is the
same for every wrapped class so factor that out into common functions.
2021-12-17 14:50:49 +13:00
Olly Betts
5da86a1413 Make some generated functions static 2021-12-17 09:38:44 +13:00
Olly Betts
6253583809 Rename php_fetch_object with swig_ prefix
We shouldn't be using symbols starting `php` as that risks collisions
with future symbols defined by PHP.
2021-12-17 09:37:00 +13:00
Olly Betts
9ffa15b307 Tweak source whitespace to match SWIG conventions 2021-12-15 19:40:06 +13:00
Olly Betts
6ef820acf9 [php] Simplify creating overload dispatch name 2021-12-15 19:30:17 +13:00
Olly Betts
7418da9e5d Fix transposed outputs in internals doc 2021-12-15 19:25:53 +13:00
tytan652
fa2f9dc5da [lua] Fix maybe-uninitialized warning in generated code 2021-12-15 09:31:13 +13:00
Olly Betts
98b8578731 [php] Tidy up code which processes in typemaps
The only functional change is that we now recover after
WARN_TYPEMAP_IN_UNDEF better (or at least like most of the other
SWIG backends do).
2021-12-13 16:02:12 +13:00
Olly Betts
4c7febfb80 Make DOH Char macro more robust
For example, `Char(foo)[0]` now works to get the first character
of DOH String `foo`.

Previously this gave a confusing error because it expanded to
`(char *) Data(foo)[0]` and the `[0]` binds more tightly
than the `(char *)`.
2021-12-13 09:33:26 +13:00
Olly Betts
94ad89284d [php] Remove redundant in typemap for bool
This typemap which would wrap C++ bool as PHP int is later overridden
by another which wraps it as PHP bool.  The current result is what
we want so just remove the redundant one.
2021-12-13 09:31:11 +13:00
Olly Betts
b78f0ee263 [php] Add runme for long_long testcase 2021-12-13 09:30:42 +13:00
Olly Betts
48bb7e0e95 Simplify PHP backend code 2021-12-13 09:27:58 +13:00
Olly Betts
7d70402306 Update PHP source comment
We no longer wrap anything as a PHP resource.
2021-12-13 09:27:58 +13:00
Olly Betts
bf68b377e6 Remove unused code from PHP backend
These are leftovers from the work on wrapping using only PHP's C API.
2021-12-13 09:27:58 +13:00
Olly Betts
4467c94fe9 Fix removeNode() to really unset previousSibling
There was a typo in attribute name so we attempted to remove the
non-existent attribute prevSibling instead.
2021-12-10 18:34:21 +13:00
Olly Betts
fd013c344a [php] Remove unused variable
SWIG_module_entry hasn't actually been used for any of git history
which is over 19 years.
2021-12-10 17:10:35 +13:00
Olly Betts
c60507ef70 [php] configure: Check for php8.1 binary 2021-12-08 13:10:38 +13:00
Olly Betts
c0c7a8dba0 [php] Fix two incorrect PHP 8 conditionals
The correct macro to test is PHP_MAJOR_VERSION so these two PHP 8 cases
weren't ever used, which hid that the PHP8 version of the code was
broken in one of them.

Highlighted in #2113.
2021-12-08 13:10:38 +13:00
William S Fulton
7246cfa6c6
Merge pull request #2116 from vstinner/python311
Add Python 3.11 support: use Py_SET_TYPE()
2021-12-07 20:32:31 +00:00
Victor Stinner
e902ab5160 Add Python 3.11 support: use Py_SET_TYPE()
On Python 3.9 and newer, SwigPyBuiltin_SetMetaType() now calls
Py_SET_TYPE(). Py_TYPE() can no longer be usd as an l-value on
Python 3.11:

* https://docs.python.org/dev/c-api/structures.html#c.Py_SET_TYPE
* https://docs.python.org/dev/whatsnew/3.11.html#c-api-changes
2021-12-06 23:17:33 +01:00
William S Fulton
e0935404a8 Add Octave 6 to changes file 2021-12-05 22:31:05 +00:00
William S Fulton
5ada46bcce Whitespace consistency fix in CI-linux-install.sh 2021-12-05 22:26:25 +00:00
William S Fulton
3947df87a2 GHA: Test Octave 6.4 2021-12-05 22:24:51 +00:00
Robert Fries
983b91694f Additional changes due to name changes in octave-6 * is_map to isstruct, is_object to isobject 2021-12-05 22:19:46 +00:00
Robert Fries
81f9e6600f Octave module lets examples and tests work with Octave-6 * Try-catch replacement for check of error_state * Add execute method in addition to call * Replace oct_mach_info with octave::mach_info * Call from interpreter: global_varval global_assign * Assign a global name requires locating the stack which requires interpreter to tree evaluator to callStack * Do not use discard_error_messages or discard_warning_messages 2021-12-05 22:19:46 +00:00
Robert Fries
852eab7db3 Allow swig wrapped modules to compile with -Bsymbolic 2021-12-05 22:19:40 +00:00
Olly Betts
883b42dc70 [php] Ensure _runme.php calls check::done()
This function doesn't do anything currently so these missing calls are a
latent issue.  It could be used for e.g. memory leak checking in the
future though, and it's potentially a useful place to add code when
debugging.
2021-12-05 12:40:44 +13:00
Olly Betts
ee3c9bd697 [php] Check fooCount() in newobject1_runme.php 2021-12-05 12:40:44 +13:00
William S Fulton
8432d3f89b GHA: Test currently supported php versions 7.0-8.1 2021-12-04 09:35:51 +00:00
William S Fulton
5bdc20781b Remove bom in Windows.html 2021-12-02 11:53:13 +00:00
William S Fulton
a5f85beb2d HTML doc fixes 2021-12-02 11:38:41 +00:00
William S Fulton
e2384796f0 Add Python embedded interpreters fix to changes file 2021-12-02 09:01:31 +00:00
William S Fulton
be51cb6a6e Merge branch 'fix-crash-2101'
* fix-crash-2101:
  Added extern "C" block that was removed in previous commit.
  Fixed crashes when using embedded Python interpreters.
2021-12-02 09:01:18 +00:00