Commit graph

5,174 commits

Author SHA1 Message Date
William S Fulton
1b0a9ccfc5 Typo fixes 2022-02-20 16:45:11 +00:00
William S Fulton
9b131a03d5 Fix warning suppression for WARN_PARSE_USING_UNDEF
New warnings for unknown using declarations since fix in previous commit
2022-02-20 16:45:10 +00:00
William S Fulton
cb963a1440 Using declarations fix in symbol tables
Implementation is very similar to typedef implementation.
Issue #655 and closes #1488.
Testcase using_member.i.
Better implementation to that reverted in previous commit 3f36157b.
Symbol tables shown with -debug-csymbols and -debug-symbols now correct
and are similar to when using a typedef.
2022-02-20 15:33:32 +00:00
William S Fulton
3f36157b39 Revert recent using-declarations code changes
Reverts code changes from 7b5a615e50
merge commit in preparation for better fix.
Issue #655 and issue #1488.
2022-02-20 11:12:16 +00:00
Olly Betts
d9ced1e56d Coding style tweaks 2022-01-30 10:55:00 +13:00
Frank Schlimbach
4ce2964ab8 adding support for structs, docu 2022-01-30 10:55:00 +13:00
Frank Schlimbach
63452e9fc1 better handling of using directives 2022-01-30 10:55:00 +13:00
Shengqiu Li
d3383e254d [Go] Fix overloaded functions with noncapitalized class as parameter type
Fixes #676 #677
2022-01-29 22:19:15 +13:00
Olly Betts
7ec2f89fe2
Remove redundant NULL checks before free()/delete (#2184)
Remove redundant NULL checks before free()/delete

The ISO C and C++ standards guarantee that it's safe to call these
on a NULL pointer, so it's not necessary for the calling code to
also check.

Fixes https://sourceforge.net/p/swig/feature-requests/70/
2022-01-29 22:03:48 +13:00
Olly Betts
cb1c60e3d8 [python] Fix GCC -Wunused-variable with -builtin
Fixes #1697
2022-01-27 22:34:30 +13:00
Olly Betts
bb011e28a9 Try to fix Bison portability issue
YYEOF works as a token for "end of file" on my dev box but fails in
CI.  I assume it must be a Bison version difference.

Based on the Bison manual, I'm trying this fix (which also works on my
dev box).
2022-01-27 20:17:21 +13:00
Olly Betts
282e4ed4ab Issue error for missing ; after %constant
Previously there was no warning or error, no files were produced,
but exit status was 0.

Fixes #346
2022-01-27 15:35:24 +13:00
Olly Betts
0a7192ce8b [doxygen] Fix crash on unclosed HTML tag
Fixes #1935
2022-01-26 15:12:21 +13:00
Olly Betts
e9a1aa0f9f [python] Reject -builtin with -noproxy
This option combination doesn't make sense, and result in code which
doesn't compile.

Fixes #1990
2022-01-26 14:32:32 +13:00
Olly Betts
e03ef3ecb6 Support foo.bar in constant expressions 2022-01-26 12:43:45 +13:00
Olly Betts
98e1251772 Handle ellipsis as a token in the scanner
This is more correct (previously SWIG incorrectly accepted 3 periods
with whitespace between as an ellipsis) and helps avoid conflicts in
the grammar.
2022-01-26 12:31:52 +13:00
Olly Betts
7ab24e7e86 Support most cases of sizeof applied to an expression
Previously there was only support for `sizeof(<type>)` and expressions
which syntactically look like a type (such as `sizeof(foo)`).

Fixes #2091.
2022-01-25 23:47:01 +13:00
Olly Betts
f2de21eb83 Parse common cases of < and > comparisons
Adding full support for these in expressions seems hard to do without
introducing conflicts into the parser grammar, but in fact all reported
cases have had parentheses around the comparison and we can support that
with a few restrictions on the left side of `<`.

Fixes #80 and #635.  Also https://sourceforge.net/p/swig/bugs/1139/
2022-01-25 14:09:41 +13:00
William S Fulton
017900d57e Extern template tweaks
Document extern template functions support.
Extern templates result in new warning to differentiate
from template explicit instantiation definition warning.
2022-01-25 00:28:08 +00:00
William S Fulton
40b8416213 Merge branch 'cpp11-explicit-function-template-instantiation' into upstream-master
* cpp11-explicit-function-template-instantiation:
  parser(C++11) : explicit template function support, see https://github.com/swig/swig/issues/2131
2022-01-24 22:41:27 +00:00
Olly Betts
66488e677d [php] Make zend_function_entry arrays const 2022-01-24 14:09:36 +13:00
William S Fulton
543994c8ee Merge branch 'pcre2' into upstream-master
* pcre2:
  Add changes entry for PCRE2
  Call -pcreversion during appveyor testing
  Few more PCRE to PCRE2 changes
  PCRE2
2022-01-22 16:35:51 +00:00
romin.tomasetti
8be363eae3 parser(C++11) : explicit template function support, see https://github.com/swig/swig/issues/2131 2022-01-22 15:05:23 +00:00
Olly Betts
7b929dce82 [php] Fix director upcall check
This resolves an issue uncovered by adding a _runme.php for testcase
director_alternating.
2022-01-22 20:01:00 +13:00
Olly Betts
9b10534879 [php] Make internal function wrappers static 2022-01-22 13:03:58 +13:00
William S Fulton
f8e4a5cc25 Few more PCRE to PCRE2 changes 2022-01-21 18:35:20 +00:00
Julien Schueller
15515f390c PCRE2
Closes #2120
2022-01-21 07:46:08 +01:00
Olly Betts
1c76000e38 [php] Add type declarations for optional params too
See #2151
2022-01-21 16:34:59 +13:00
Olly Betts
91470ca62d [php] Actually generate parameter type declarations 2022-01-21 13:27:54 +13:00
Olly Betts
d43f28a666 [php] Use -prefix setting in type declarations 2022-01-21 11:08:24 +13:00
Olly Betts
c417250b4e [php] Allow testing if an object is SWIG-wrapped
Since the switch to wrapping classes using PHP's C API, we now
internally need to be able to tell if a PHP object is of or derived
from a class that is wrapped by SWIG so we know if we can offset the
zend_object pointer to get to the swig_object_wrapper.  If we try to
do this to an object which isn't wrapped by SWIG then we invoke C/C++
undefined behaviour (and typically get a segmentation fault).

This check is implemented by having a SWIG\wrapped empty interface which
we make all SWIG-wrapped classes implement simply so we can test for it
to detect such classes.

Fixes #2125
2022-01-20 14:42:02 +13:00
Olly Betts
1f1349741f
[php] Generate PHP type declarations
We now automatically generate PHP type declarations for PHP >= 8.0.

The generated code still compiles with PHP 7.x but without type declarations.
2022-01-20 10:07:44 +13:00
Olly Betts
748a9a5452 [perl] Require at least Perl 5.8.0
As discussed and agreed in #1629, it's become hard to test with Perl
5.6 or earlier, such old versions are no longer in active use, and
4.1.0 is an appropriate time to make such a change.

I've dropped the compatibility code that was obvious to me, but there's
probably more that can be cleaned up now.
2022-01-19 10:07:30 +13:00
William S Fulton
3aa302c08f %callback and Python class access for C++ static member functions fixes
Fix access to C++ static member functions using Python class
staticmethod syntax, such as Klass.memberfunction instead of
Klass_memberfunction, when using -fastproxy and -builtin in
combination with %callback.

The docstring containing the callback pointers were not being patched
during module initialisation.
2022-01-14 23:00:59 +00:00
William S Fulton
627f7214db [Python] Add missing Python kwargs builtin support
Accept keyword arguments accessing C++ static member functions when
using -builtin and kwargs feature and Python class staticmethod syntax.
The missing keyword argument support was only when using the
class staticmethod syntax, not when using the flat static method
syntax.
2022-01-14 23:00:42 +00:00
William S Fulton
3200a815d4
Merge pull request #2095 from vadz/extend-suffix
Use suffix for static methods added by %extend
2022-01-08 21:11:14 +00: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
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
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