Commit Graph

5514 Commits

Author SHA1 Message Date
Seth R Johnson befc9bc1f0 Mark 'externc' storage for variables 2022-02-06 20:49:01 -05:00
Olly Betts d47970e2fd Fix problem with recent commit
I failed to fully remove the conditional from one example in
1a03840172.
2022-02-06 16:50:30 +13:00
Olly Betts b06ab566cb -DFOO on the SWIG command line now sets FOO to 1
This is consistent with C/C++ compiler preprocessors.  Previously
SWIG set FOO to an empty value.

Fixes #2193
2022-02-06 10:18:49 +13:00
Olly Betts f85626207c
Merge pull request #2194 from swig-fortran/mark-noassign
Auto-detect non-assignable classes
2022-02-06 09:44:29 +13:00
Olly Betts 1a03840172 [octave] Simply checks on exist()
As suggested by kwwette in #1672, just check exist() is non-zero in
cases where the non-zero value returned varies depending on Octave
version.
2022-02-06 09:03:16 +13:00
Seth R Johnson 5b7edebdba Placate scilab character limit 2022-02-04 14:54:11 -05:00
Seth R Johnson 5a2656ab80 Don't mark as "noassign" when a variable is immutable
I had assumed member variables could only be noassign by being "const",
but I had forgotten about the `%immutable` keyword being applied via
SWIG.
2022-02-04 14:03:01 -05:00
Seth R Johnson 03dd2ec39d Auto-detect non-assignable classes
Classes with references or const data are now marked as 'noassign'.
This renders many explicit `private: operator=` declarations redundant.
2022-02-04 09:51:18 -05:00
Olly Betts a60655a86b Merge branch 'octave-4-4-bugfix' of https://github.com/friedrichatgc/swig
Fixes #1672
2022-02-04 16:36:05 +13:00
Olly Betts 07f3637f06 [PHP] Remove useless shadowed variable in example 2022-02-03 23:04:58 +13:00
Olly Betts ebbf2e6077 Allow method calls in expressions
This allows default parameter values containing method calls to be
parsed and handled - e.g. `x->foo(3,4)` and `y.z()`.
Fixes #660 and https://sourceforge.net/p/swig/bugs/1081/
2022-02-03 17:20:30 +13:00
Olly Betts 20588a4dc7 Uncomment line in testcase which now works
03ef3ecb6e86aa78a64119f30e683ee474ddb56 added support for ID PERIOD ID
in an expression.
2022-02-03 17:20:30 +13:00
Olly Betts 2e98189564 [Ruby] Fix remove of prefix from method name
The prefix is now only removed at the start.

Fixes https://sourceforge.net/p/swig/bugs/1136/
2022-02-02 15:53:23 +13:00
Olly Betts 27a3d16ac6 Allow object reference in C++ trailing return type
Fixes #231
2022-02-02 11:31:45 +13:00
Olly Betts 9d06d4ac45 [Tcl] Add changed file missed recent commit
This should have been in 6f4adde4b4
2022-02-01 16:00:12 +13:00
Olly Betts 3e019977c5
Merge pull request #1398 from swig-fortran/missing-includes
Add missing includes to library and test cases
2022-02-01 14:05:17 +13:00
Olly Betts 6f4adde4b4 [Tcl] Fix std_vector typecheck typemaps
In some cases the typecheck typemap would try to access the first
element of an empty Tcl list.

Fixes https://sourceforge.net/p/swig/bugs/1309/
2022-02-01 13:09:00 +13:00
Olly Betts 7813793511 [R] Fix CopyToR() generated for struct in namespace
Fixes https://sourceforge.net/p/swig/bugs/1147/
2022-01-31 12:05:09 +13:00
Olly Betts 25f996a5c8 [python] Replace uses of assert in testsuite
We're not supposed to assert for this, as mentioned in #1488.
2022-01-30 13:38:56 +13: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
Olly Betts d2d2bfa05f Add CHANGES entry and regression test for #676 2022-01-29 22:35:29 +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 f0c0816cde Update out-of-date docs re _runme3.py 2022-01-27 16:10:10 +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 07f5b37c30 Fix invalid code in testcase typemap_qualifier_strip.i
This testcase was using a pointer to a variable which had gone out
of scope, which is undefined behaviour.  The test was only passing
because the tests are compiled without optimisation by default and
the memory where this value lived happened to remain intact in that
case with current versions of compilers we test with.  Running the
testsuite with CXXFLAGS=-O2 causes this test to fail.

Fix by extending the lifetime of the variable to the whole wrapper
function.

Fixes #1925
2022-01-26 15:39:38 +13:00
Olly Betts f104c4411f Rename variable in director_thread test
This avoids a clash with thread_terminate defined in an AIX include
file.

Fixes #1921
2022-01-26 15:23:46 +13:00
Olly Betts 0a7192ce8b [doxygen] Fix crash on unclosed HTML tag
Fixes #1935
2022-01-26 15:12:21 +13:00
Olly Betts ccd313ac64 Move new testcase which needs C++11
I don't see how to easily write this without constexpr.
2022-01-26 13:25:36 +13:00
Olly Betts e03ef3ecb6 Support foo.bar in constant expressions 2022-01-26 12:43:45 +13:00
Olly Betts 6db66bc350 Drop is_python_modern() in testcase
Python is always "modern" since e4fceee12f.
2022-01-26 12:30:44 +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 6f952806e4 Enable testcase for `%`
This was commented out with a FIXME, but actually works.  Probably
fixed back in 2009 by 02eb6a81d1836cc7d39c171cb9074fbd98c01828!
2022-01-25 14:09:49 +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 901d1fc061 Fix comment typo 2022-01-24 12:16:26 +13: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 5656da3f31 [php] Add runmes for more director testcases 2022-01-22 21:12:13 +13: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 87c2e7d71a [php] Fix long long handling on 32 bit platforms
The typemaps for long long and unsigned long long didn't handle a
string input correctly, and long_long_runme.php had a flawed test
in this case.

Fixes #2155
2022-01-22 13:09:34 +13:00
Olly Betts 4d3d4839b0 [python] Add multivalue_runme.py 2022-01-21 11:10:30 +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
William S Fulton 76d5a9ec27 gcc-12 warning fix in test-case
Closes #2145
2022-01-18 21:37:02 +00: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
Markus Friedrich d0121bff6e Use a different assert in octave check 'module_path' for some octave version
Octave >= 4.4 < 6 seem to handle the SWIG generated .oct files differently.
Before the .oct file e.g. swigexample.oct is loaded exists('swigexample')
returns 3 (name is a ‘.oct’ or ‘.mex’ file in Octave’s path.)
After loading swigexample.oct exists('swigexample') returns 1 (name is a variable.)
Whereas all other octave version return always 3.
isglobal('swigexample') return always true.
2022-01-16 22:15:48 +01:00
Markus Friedrich a5774a9d0f Fixed octave version check and enabled VPATH build for check-octave-operator example 2022-01-16 09:58:25 +01:00