Commit graph

5,543 commits

Author SHA1 Message Date
Seth R Johnson
0268dde201 Extend diamond multi test to fix go 2022-02-15 07:53:46 -05:00
Seth R Johnson
b08713f09f Add test of null shared pointers emitted from C++
This tests nulls emitted as pointers and values of shared pointers,
created from null, from references, and from default constructors.
2022-02-12 19:40:03 -05:00
Seth R Johnson
01995ec14f Add test cases for reference/const-reference of integers 2022-02-12 19:40:03 -05:00
Seth R Johnson
47eb9c8078 Extend "ignore" parameter test
- Ensure that `argout` is called even when a parameter is ignored
- Ensure that ignored parameters with default arguments are handled
  correctly
2022-02-12 19:40:03 -05:00
Seth R Johnson
ef112087cc Add test of callback with enum argument
This is an odd use case often with numerical solver flags
that's not covered in the existing test suite.
2022-02-12 19:40:03 -05:00
Seth R Johnson
77cdba81ad Add test case for very simple director classes
Test both abstract and concrete base classes, with simple int/bool data.
This level of complexity is very helpful when setting up director
functionality for a new target language.
2022-02-12 19:40:03 -05:00
Seth R Johnson
266766d7c7 Test identity operation on class references 2022-02-12 19:40:03 -05:00
Seth R Johnson
0da8a9bb44 Test ability to manipulate a daughter class from its base class wrapper
Even in the case of just creating a `DerivedClass` this test says:
```
swig/python detected a memory leak of type 'DerivedClass *', no destructor found.
```
even though the destructor is defined in the base class.
2022-02-12 19:40:03 -05:00
Seth R Johnson
fb0cddfd2b Add C "contract" test
Tests that the `%contract` code (viz., each target language's
implementation of SWIG_contract_assert) compiles in C as expected. Update
the note in the source code since `%contract` is in the official
documentation.
2022-02-12 19:40:03 -05:00
Seth R Johnson
c9fbb81e4a Mark in-header function definitions as "inline"
Otherwise, generating the `clientdata_prop` modules will duplicate symbols,
leading to linker errors if the resulting modules are linked (or possibly
loaded) simultaneously.
2022-02-12 19:40:03 -05:00
Seth R Johnson
a8e73e3ad7 Test scope resolution of global struct A 2022-02-12 19:40:03 -05:00
Seth R Johnson
fc2b90acd1 Add a "diamond" pattern to multi-impmort test
This tests whether multiple modules can correctly import
the same common module.

```
a -> d
  -> b -> c -> d*
```
2022-02-12 19:40:03 -05:00
Seth R Johnson
c2c3f968df "Include what you use" for tests
Using strcpy/strlen in global namespace requires `<string.h>`. Include
explicitly instead of assuming another SWIG or library header brings it
in.
2022-02-12 17:46:20 -05:00
Olly Betts
31af3ce9bf Avoid -Wempty-body warnings from SWIG_contract_assert 2022-02-11 18:39:08 +13:00
Olly Betts
b624d17f3f Merge branch 'swig-fortran/extern-c-int'
Fixes #2199
2022-02-11 08:28:27 +13:00
Seth R Johnson
c21b4a5529 Fix cpp11_thread_local test 2022-02-11 08:25:03 +13:00
Seth R Johnson
2ecc5bc214 Don't warn about legal extern "C++" {} block 2022-02-11 08:25:03 +13:00
Seth R Johnson
4bdf454e97 Add extern C thread_local test cases 2022-02-11 08:25:03 +13:00
Olly Betts
89a0a3c5f7
Merge pull request #2197 from swig-fortran/rename-warn
Print rename warnings except anonymous template methods
2022-02-10 16:15:10 +13:00
Dimitris Apostolou
40c3bf30b2 Fix typos 2022-02-10 16:12:24 +13:00
Olly Betts
bb15c4eccf [Tcl] Fix Tcl generic input typemap for std::vector
Fixes https://sourceforge.net/p/swig/bugs/1207/
Fixes https://sourceforge.net/p/swig/bugs/1213/
2022-02-10 09:55:58 +13:00
Olly Betts
1d088d7124 Fix comments about version Tcl bug fixed in 2022-02-08 16:39:42 +13:00
William S Fulton
d59cbf1c39 Fragments: additional testing and documentation enhancements
Add test for original syntax when using a single fragment key containing
the list of dependent fragments. I couldn't find a test for this.

Spaces in the fragment list don't seem to work - document it.
2022-02-07 21:45:33 +00:00
William S Fulton
013be550ed Merge branch 'fragment-typemap' into upstream-master
* fragment-typemap:
  Add documentation
  Enable multiple 'fragment' keywords to be attached to typemaps
2022-02-07 20:35:08 +00:00
Seth R Johnson
befc9bc1f0 Mark 'externc' storage for variables 2022-02-06 20:49:01 -05:00
Olly Betts
467c530e65 Remove support for the "command" encoder
The "command" encoder was mostly intended for use in `%rename` - most
uses can be achieved using the "regex" encoder, so we recommend using
that instead.

The "command" encoder suffers from a number of issues - as the
documentation for it admitted, "[it] is extremely slow compared to all
the other [encoders] as it involves spawning a separate process and
using it for many declarations is not recommended" and that it "should
generally be avoided because of performance considerations".

But it's also not portable.  The design assumes that `/bin/sh` supports
`<<<` but that's a bash-specific feature so it doesn't work on platforms
where `/bin/sh` is not bash - it fails on Debian, Ubuntu and probably
some other Linux distros, plus most non-Linux platforms.  Microsoft
Windows doesn't even have a /bin/sh as standard.

Finally, no escaping of the passed string is done, so it has potential
security issues (though at least with %rename the input is limited to
valid C/C++ symbol names).

Fixes #1806
2022-02-07 09:47:01 +13:00
Seth R Johnson
018254cca3 Reformat name warnings to reduce changes 2022-02-06 13:51:37 -05:00
Seth R Johnson
307c9814a0 Prevent "__dummy_0__" template methods from matching name warnings 2022-02-06 13:51:37 -05:00
Seth R Johnson
de78b80de9 Renames performed by %namewarn with rename= are printed in warning message
This is necessary for regex-like renames (where you can't use the #define trick
as is done in many of the %keywordwarn directives). It's now unnecessary to print
the "renaming to '`x`'" code explicitly by the kw.swg files.
2022-02-06 13:51:37 -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
Seth R Johnson
325056453a Enable multiple 'fragment' keywords to be attached to typemaps
This is consistent with the use of `%fragment`. Previously only the last
`fragment=` keyword would be added.
2022-02-05 19:03:43 -05: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