Commit graph

4,665 commits

Author SHA1 Message Date
William S Fulton
ee17f8d04f C#, D, Java methodmodifiers on destructors
Add support so that the %csmethodmodifiers, %dmethodmodifiers,
%javamethodmodifiers can modify the method modifiers for the destructor wrappers
in the proxy class: dispose, Dispose, delete. With this feature, it is now possible
to make a C# proxy class sealed, eg when wrapping a class X, the virtual method modifiers
can be removed using:

  %typemap(csclassmodifiers) X "public sealed class"
  %csmethodmodifiers X::~X "public /*virtual*/";
2018-05-11 18:09:51 +01:00
William S Fulton
8555973a48 test-suite fixes (Java directors) for compilers that don't support varargs 2018-05-06 09:46:37 +01:00
William S Fulton
50cb18087d test-suite fixes (2) for compilers that don't support varargs
Split director_exception testcase into two so that testing throw(),
with no arguments, that is nothrows, can be tested separately to throw()
taking arguments. [The throw keyword needs to be removed for C++
compilation in C++11 and later when it was deprecated.]
2018-05-06 09:46:37 +01:00
William S Fulton
196a965067 test-suite fixes for compilers that don't support vararg macros
Split TESTCASE_THROW into multiple macros taking different number of arguments.
Fixes Visual Studio compiler errors.
2018-05-06 09:46:37 +01:00
William S Fulton
7ecf6a71b0 test-suite support for gcc-8 targeting C++11 and C++14
Some code in this test case is actually only supported in c++17...

cpp11_lambda_functions_wrap.cxx:275:87: error: the type ‘const<lambda(int, int)>’ of ‘constexpr’ variable ‘lambda18’ is not literal
 CONSTEXPR auto lambda18 = [] (int x, int y) mutable TESTCASE_THROW(int) { return x+y; };
                                                                                       ^
cpp11_lambda_functions_wrap.cxx:275:28: note: ‘<lambda(int, int)>’ is not literal because:
 CONSTEXPR auto lambda18 = [] (int x, int y) mutable TESTCASE_THROW(int) { return x+y; };
                            ^
cc1plus: note:   ‘<lambda(int, int)>’ is a closure type, which is only literal in C++17 and later
cpp11_lambda_functions_wrap.cxx:278:89: error: the type ‘const Space1::<lambda(int, int)>’ of ‘constexpr’ variable ‘Space1::lambda19’ is not literal
   CONSTEXPR auto lambda19 = [] (int x, int y) mutable TESTCASE_THROW(int) { return x+y; };
2018-05-04 20:02:13 +01:00
William S Fulton
6cc6d21bd2 test-suite fix for c++17 and throw macro 2018-05-04 20:02:13 +01:00
William S Fulton
e6b3a88f8a test-suite support for C++17: switch testing of the deprecated C++17 'register' keyword from C++ to C 2018-05-04 20:02:13 +01:00
William S Fulton
c9a10eb726 Examples update to support C++17: exception specification throw removal 2018-05-04 20:02:13 +01:00
William S Fulton
63f7315c8a test-suite support for C++17 (Java): exception specification throw removal 2018-05-04 20:02:13 +01:00
William S Fulton
35b792daed test-suite support for C++17: exception specification throw removal 2018-05-04 20:02:13 +01:00
Olly Betts
2ab3f4d744 [Python] Suppress new pycodestyle warning
E252 missing whitespace around parameter equals
2018-04-19 08:41:25 +12:00
William S Fulton
5ccae6eac6 Merge branch 'goatshriek-ruby-alias'
* goatshriek-ruby-alias:
  Fix ruby %alias directive for native c functions
2018-04-07 12:34:08 +01:00
Olly Betts
3bea8f6b7e [Ruby] Pass Qnil instead of NULL to rb_funcall()
This silences GCC -Wconversion-null warning (on by default with recent
GCC).
2018-04-03 18:01:58 +12:00
Joel Anderson
a1cea4f483 Fix ruby %alias directive for native c functions
Using the %alias directive on native C functions causes swig to segfault due to
a dereference of klass (which is NULL for native C functions) in the
defineAliases function of the Ruby module. This commit adds support for an alias
of native C functions for both separate module as well as global functions, as
well as three test cases for the %alias directive of the Ruby module.

Fixes:
mod.i
%module ruby_alias
%alias get_my_name "nickname,fullname";
%inline %{
const char *get_my_name(){
  return "Chester Tester";
}
%}
$ swig -ruby mod.i
Segmentation fault

Signed-off-by: Joel Anderson <joelanderson333@gmail.com>
2018-03-22 08:05:01 -04:00
William S Fulton
98ebd56942 Remove c++11 override in testcase 2018-03-09 18:27:16 +00:00
William S Fulton
b4f4ce4fd5 Fix Java swigReleaseOwnership() and swigTakeOwnership() regression
Fixes segfault when using non-director classes.
Restores a dynamic_cast which was previously removed.
The dynamic_cast is not needed for the swig_connect_director call ...
we'll have to find another solution for #449 for Java.

Closes #1184
2018-03-09 08:13:41 +00:00
Olly Betts
1915740af8 preproc.i: Also note URL for "// in macro" PR 2018-03-08 06:12:01 +13:00
Olly Betts
ba3773e1be preproc.i: Shorten classname for scilab
Errors were:

../../../../../../Examples/test-suite/scilab/../preproc.i:400: Error: Wrapping functions names for member 'tcxMessageTestSlashSlash.mHeader' will exceed 24 characters, please rename the container of member 'tcxMessageTestSlashSlash'.
../../../../../../Examples/test-suite/scilab/../preproc.i:408: Error: Wrapping functions names for member 'tcxMessageBugSlashSlash.mBid' will exceed 24 characters, please rename the container of member 'tcxMessageBugSlashSlash'.
2018-03-08 06:10:08 +13:00
Olly Betts
d5e012f70f Add test coverage for // comment fix 2018-03-07 14:49:08 +13:00
William S Fulton
72964a1faf Don't accept some invalid preprocessor code
Whitespace or non-numeric characters are required after a preprocessor
directive that requires an expression.
2018-01-16 08:07:37 +00:00
William S Fulton
532999f4f2 Improve error message when preprocessor expressions result in a floating point constant
Instead of a syntax error, the error is now:
  Warning 202: Error: 'Floating point constant in preprocessor expression'
2018-01-15 08:09:14 +00:00
William S Fulton
ea5b55ecf4 Fix floating point division by zero in preprocessor expressions.
Closes #1183
2018-01-15 07:51:18 +00:00
William S Fulton
07a30249f4 Fix seg fault parsing invalid exponents
Add error message when exponents are incomplete,
for example 5e and 5.e
2018-01-14 19:36:09 +00:00
William S Fulton
af8d176c40 java_throws testcase warning fix 2018-01-12 23:10:02 +00:00
William S Fulton
368cd3b52c Add ToArray test for C# std::vector wrapper 2018-01-12 18:26:47 +00:00
William S Fulton
49af1907b8 Add missing Java throws clause for interfaces when using the %interface family of macros.
Fixes #1156.
2018-01-12 07:34:32 +00:00
William S Fulton
c44adff7b9
Merge pull request #1177 from Sigill/sigabrt_rubyunlinkobject_fix
Do not abort when unlinking non-data ruby objects
2018-01-07 12:23:47 +00:00
William S Fulton
0d588d19ad Fix out of source clean target in import_packages Makefile 2018-01-07 00:57:23 +00:00
William S Fulton
3066f8950c Minor tweaks in import_packages Makefile 2018-01-06 23:19:04 +00:00
William S Fulton
b0c910ac96 Fix out of source import_packages Makefile 2018-01-06 23:12:52 +00:00
William S Fulton
830422a87b Fix Makefile and skip testing python-2.4 for import_packages test 2018-01-05 20:17:08 +00:00
William S Fulton
6607acdf3a Merge branch 'davedissian-redundant-typedef-fix'
* davedissian-redundant-typedef-fix:
  Add more runtime typedef_classforward_same_name runtime testing
  Fixed 'typedef class Foo Foo;' edge case by iterating through linked list.
  Added test case for a forward declaration in a typedef with the same name
2018-01-06 15:27:52 +00:00
William S Fulton
aef25cff0c Add missing default_arg_expressions.i testcase 2018-01-05 18:31:48 +00:00
William S Fulton
ef378407d0 Fix parsing of default argument expressions containing ->. 2018-01-05 07:58:25 +00:00
William S Fulton
cd9b7c3c34 std_basic_string.i fixes
- Remove python code from octave's std_basic_string.i
- Correctly return an error to fix error handling when using std::basic_string in
  overloaded methods - issue #1171.
2018-01-04 07:00:26 +00:00
William S Fulton
ce6960de92 Add more runtime typedef_classforward_same_name runtime testing 2017-12-31 16:37:27 +00:00
William S Fulton
3c30dec661 Remove php5 generated files inadvertently checked in 2017-12-31 16:19:39 +00:00
William S Fulton
aff36823df Complete switch from pep8 to pycodestyle for Python testing 2017-12-31 16:19:39 +00:00
William S Fulton
0b0aed6842 Fix pycodestyle 'E722 do not use bare except' 2017-12-31 16:19:39 +00:00
David Avedissian
6b2bcfed0b Added test case for a forward declaration in a typedef with the same
name
2017-12-27 16:36:45 +00:00
Cyrille Faucheux
a4884e45e1 Do not abort when unlinking non-data ruby objects
Fixes issue #1168.
Remove a call to abort() (introduced by commit
0e725b5d9b) made when SWIG_RubyUnlinkObjects()
is called on non T_DATA objects. It can happen when the destruction of T_DATA
objects is deferred: the Ruby GC first turn them to T_ZOMBIE, then calls their
free method (SWIG_RubyUnlinkObjects()).
2017-12-27 14:40:26 +01:00
William S Fulton
b0e29fbdf3 Add missing checks for failures in calls to PyUnicode_AsUTF8String.
Previously a seg fault could occur when passing invalid UTF8 strings (low
surrogates), eg passing u"\udcff" to the C layer (Python 3).
2017-12-04 20:14:04 +00:00
William S Fulton
069ce1f6e9 Merge branch 'java-director-exceptions'
* java-director-exceptions:
  Add recent Java director enhancements to the changes file
  Replace DirectorException::raiseJavaException with DirectorException::throwException
  Improve Java director exception customization documentation
  Add Swig::DirectorException directorthrows typemap for Java
  Cosmetic whitespace improvement in generated code from throws typemaps.
  Tidy up director_exception testcase
  Changes to use common DirectorException class
  Improved Java director exceptions documentation
  Java director exception handling improvements
2017-11-29 20:32:40 +00:00
William S Fulton
901f8357b0 Replace DirectorException::raiseJavaException with DirectorException::throwException
This is part of a plan to provide a common DirectorException api for
throwing the target language exception raised during a director method call.
2017-11-29 20:32:15 +00:00
William S Fulton
91080872a8 Tidy up director_exception testcase 2017-11-29 20:32:15 +00:00
William S Fulton
923091da13 Changes to use common DirectorException class
Add director.swg for Go as was completely absent.
This is just the start of a common exception handling approach to directors.
An exception thrown in a Java director method will be propogated back to
Java via a C++ DirectorException.
DirectorException throws typemap for Java is fully working, all other languages need work.
DirectorException throws typemap for Perl added just to fix compilation errors.
Add director_exception_catches test.
2017-11-29 20:31:55 +00:00
Joseph C Wang
4e8c515d36 add new tests and coercion files for null fix #1124 2017-11-26 03:43:39 +08:00
Joseph C Wang
5525abfea8 add support files and regression tests for #1124 2017-11-25 01:37:14 +08:00
William S Fulton
7aa28e37ec Java director exception handling improvements
When a director method throws an exception and it is caught by DirectorException
and passed back to Java using DirectorException::raiseJavaException, the Java
stack trace now contains the original source line that threw the exception.

Director exception handling code improved slightly to add some missing
ExceptionClear calls before calling JNI code.
2017-11-10 19:50:22 +00:00
William S Fulton
dafe2d6949 Add director typemaps for pointer const ref types 2017-10-24 23:47:40 +01:00