Commit graph

5,568 commits

Author SHA1 Message Date
William S Fulton
961424a986 Fix line/file info for methods added by using declarations 2022-02-26 20:07:58 +00:00
William S Fulton
eb32a6298d Add omitted testcase cpp_using_rename.i 2022-02-26 20:01:57 +00:00
William S Fulton
79a1bbee8b Using declarations in inheritance hierarchy improvements.
- Improved documentation for using declarations.
- Issue new warning WARN_LANG_USING_NAME_DIFFERENT when there
  is a conflict in the target language name to be used when
  introducing a method via a using declaration. Previously
  the method was silently ignored. Issue #1840. Issue #655.
2022-02-26 12:46:06 +00:00
Olly Betts
e36e898c0a
Merge pull request #2205 from swig-fortran/extend-tests
Fix and add additional tests to test suite
2022-02-25 10:16:22 +13:00
Olly Betts
7f37bfe2b5 Mark error messages more consistent
Always include English name of a mentioned character.
2022-02-25 10:07:17 +13:00
Olly Betts
e95af9c474 Merge branch 'scilab-6' of https://github.com/davidcl/swig
Fixes #1751
2022-02-24 10:45:13 +13:00
Olly Betts
4986b8793d Emit preprocessor expr error for unary + on string
Previously other unary operators on a string all gave an error, but
unary + was handled as a no-op and so didn't.
2022-02-24 09:50:22 +13:00
Olly Betts
74d12d8c4c Don't report "Warning 202: Error: ..."
An invalid preprocessor expression is reported as a pair of
warnings with the second giving a more detailed message from the
expression evaluator.  Previously SWIG prefixed the second message
with "Error:" - that was confusing as it's actually only a warning
by default so we've now dropped this prefix.

Before:

x.i:1: Warning 202: Could not evaluate expression '1.2'
x.i:1: Warning 202: Error: 'Floating point constant in preprocessor expression'

Now:

x.i:1: Warning 202: Could not evaluate expression '1.2'
x.i:1: Warning 202: Floating point constant in preprocessor expression

See #1465
2022-02-24 08:40:27 +13:00
Olly Betts
0deb8a855d Add another testcase for #1384
A string in parentheses could be treated as an integer (depending on
the state the stack was left in by previously evaluated expressions).
2022-02-24 08:30:32 +13:00
Olly Betts
204a5f7bf3 Fix a preprocessor expression evaluation bug
A subexpression in parentheses lost its string/int type flag and
instead used whatever type was left in the stack entry from
previous use.  In practice we mostly got away with this because
most preprocessor expressions are integer, but it could have
resulted in a preprocessor expression incorrectly evaluating as
zero.  If -Wextra was in use you got a warning:

Warning 202: Error: 'Can't mix strings and integers in expression'

Fixes #1384
2022-02-23 18:53:59 +13:00
Olly Betts
471b9f734e Fix comment and testsuite check message typos 2022-02-23 17:40:09 +13:00
Clément DAVID
62d3bc04ff Scilab - pass tests on 5.5.2, 6.0.2 and 6.1.0 2022-02-21 10:02:03 +01:00
Clément DAVID
ce6c0c47f6 Add Scilab 5.5.2 6.0.2 and 6.1.0 from upstream
This commit log Scilab version at ./configure to ease maintenance. It
uses Scilab include next to the bin directory which will work for both
system-wide install and binaries from scilab.org.

SCILAB_VERSION is define as an automake variable for easier
failure investigation.

Note: the Ubuntu Scilab version is used when available, in the current
CI config there is:
 * Scilab 5.5 from scilab.org
 * Scilab 6.0 from Ubuntu 18.04
 * Scilab 6.1 from Ubuntu 20.04
2022-02-21 10:01:27 +01:00
William S Fulton
5e85cf617a Fix linker error in constant_expr testcase 2022-02-20 17:57:38 +00:00
William S Fulton
d2e9b80be3 Merge branch 'using-declarations' into upstream-master
* using-declarations:
  Typo fixes
  Fix warning suppression for WARN_PARSE_USING_UNDEF
  Using declarations fix in symbol tables
  Revert recent using-declarations code changes

Conflicts:
	CHANGES.current
2022-02-20 17:04:56 +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
Olly Betts
1707d6b89b [PHP] Fix cleanup code handling issues
Fix to call cleanup code in exception situations and not to invoke
the freearg typemap twice in certain situations.

Fixes https://sourceforge.net/p/swig/bugs/1211/
2022-02-17 13:52:44 +13:00
Olly Betts
dffa74bbe5 php/cpp_basic_runme.php: Add new class to list 2022-02-16 11:17:51 +13:00
Seth R Johnson
0268dde201 Extend diamond multi test to fix go 2022-02-15 07:53:46 -05:00
Olly Betts
a7ff0da1f3 Improve parsing of % followed immediately by identifier
If it's not a recognised directive the scanner now emits MODULO and then
rescans what follows, and if the parser then gives a syntax error we
report it as an unknown directive. This means that `a%b` is now allowed
in an expression, and that things like `%std::vector<std::string>` now
give an error rather than being quietly ignored.

Fixes #300
Fixes #368
2022-02-15 15:09:44 +13:00
Olly Betts
fd6c0255a2 Remove superfluous semicolons 2022-02-15 14:00:12 +13:00
William S Fulton
8e4868af75 More director const std::string& testing and C# leak fix
Issue #998
2022-02-13 23:00:04 +00:00
Seth R Johnson
8cf62a3325 Remove assertions from python test cases 2022-02-14 10:33:10 +13:00
William S Fulton
88f1389f80 director_property testcase for C# and Java
Testing std::string as director method parameter
2022-02-13 16:08:57 +00: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
William S Fulton
f32a20fc2f Enhance Python director_property test 2022-02-12 12:17:43 +00:00
William S Fulton
86eaf30735 director string testing additions
Add test for C# based on Java example to test strings in and out.
Memory cleanup for Java test.
2022-02-12 12:09:01 +00: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