Commit graph

4,294 commits

Author SHA1 Message Date
Olly Betts
2425c8d6d8 Don't handle cases like -1U as Python constants 2017-06-23 14:54:50 +12:00
Michael Thon
80ffb169c1 [Python] fix and improve default argument handling
1. Fix negative octals. Currently not handled correctly by `-py3`
   (unusual case, but incorrect).
2. Fix arguments of type "octal + something" (e.g. `0640 | 04`).
   Currently drops everything after the first octal. Nasty!
3. Fix bool arguments "0 + something" (e.g. `0 | 1`) are always
   "False" (unusual case, but incorrect).
4. Remove special handling of "TRUE" and "FALSE" from
   `convertValue` since there's no reason these have to match
   "true" and "false".
5. Remove the Python 2 vs. Python 3 distinction based on the
   `-py3` flag. Now the same python code is produced for default
   arguments for Python 2 and Python 3. For this, octal default
   arguments, e.g. 0644, are now wrapped as `int('644', 8)`. This
   is required, as Python 2 and Python 3 have incompatible syntax
   for octal literals.

Fixes #707
2017-06-23 13:38:49 +12:00
William S Fulton
687cf9c9c1 Add missing %python:maybecall to operator overloads.
This ensures NotImplemented is returned on error so that the Python
interpreter will handle the operators correctly instead of throwing an
exception. NotImplemented was not being returned for non-builtin wrappers
when the operator overload did not have a function overload.

See PEP 207 and https://docs.python.org/3/library/constants.html#NotImplemented

Mentioned in SF patch #303 and SF bug #1208.
2017-06-19 19:25:27 +01:00
William S Fulton
11aa71b939 Make sure warning and error messages are not split up
They could be split up by other processes writing to stdout
at the same time.
2017-06-16 19:24:48 +01:00
William S Fulton
6a7cd97fe9 Fix R function pointer wrappers containing lvalue and rvalue reference parameters 2017-06-16 07:41:05 +01:00
William S Fulton
9d5d991f83 Merge branch 'master' of git+ssh://github.com/swig/swig
* 'master' of git+ssh://github.com/swig/swig:
  update changes referencing issue
  fix Scilab 6.0.0 linking issue

Conflicts:
	CHANGES.current
2017-06-05 20:58:12 +01:00
William S Fulton
57a89f987d Fix %import and %fragment forced inclusion to not generate code. 2017-06-03 18:37:05 +01:00
William S Fulton
9f55985a6c Remove unused code 2017-06-03 18:37:05 +01:00
Clément DAVID
9278593dc4 fix Scilab 6.0.0 linking issue 2017-05-30 14:42:44 +02:00
William S Fulton
a2d65ca3bb Merge branch 'asibross-master' into director-smartptr-ownership
* asibross-master:
  Missing smart pointer handling in Java director extra methods implementation.

Conflicts:
	Source/Modules/java.cxx
2017-05-25 08:00:35 +01:00
William S Fulton
05badeb1a4 Remove undocumented features used in directors
The jsdowncast and csdowncast features are not documented and I think
these are a relic of something that was never finished.
2017-05-21 17:43:06 +01:00
William S Fulton
b90a8d7444 Remove unnecessary dynamic_cast in C#/D/Java directors
Also revert the removal of dynamic_cast in the csdowncast feature.
2017-05-21 17:42:27 +01:00
William S Fulton
7f2849cb0a Merge branch 'Sghirate-master'
* Sghirate-master:
  [C#] static_cast for native directors
2017-05-21 00:22:17 +01:00
William S Fulton
81ba06e59e Fix Python negative unsigned default values
Closes #993
2017-05-21 00:02:08 +01:00
Julien Schueller
ed54cc904c Fix E731: do not assign a lambda expression
https://www.python.org/dev/peps/pep-0008/#programming-recommendations
2017-05-19 22:49:23 +02:00
Olly Betts
9a0180c56c Merge pull request #970 from nihal95/master
Adds pragma version directive for php5 and php7.  Fixes #360.
2017-05-16 17:47:35 +12:00
William S Fulton
320df84607 Add missing return for pure virtual director wrappers for D and C# 2017-05-13 23:17:02 +01:00
William S Fulton
ebd37155a8 Fix potential use of uninitialized variables in directors 2017-05-13 22:40:59 +01:00
William S Fulton
731f175d21 propagate c++11 noexcept to director classes for Go 2017-05-13 18:13:53 +01:00
William S Fulton
f6d10278f8 Merge branch 'yag00-master'
* yag00-master:
  Add raise methods for throwing c++ exceptions in C#, Java, D
  php5: propagate c++11 noexcept to director classes
  Revert "java : noexcept method can't raise Swig::DirectorException"
  Revert "csharp : noexcept method can't raise Swig::DirectorPureVirtualException"
  csharp : noexcept method can't raise Swig::DirectorPureVirtualException
  java : noexcept method can't raise Swig::DirectorException
  #526 : propagate c++11 noexcept to director classes
  #526 : propagate c++11 noexcept to director classes test case
2017-05-13 17:05:25 +01:00
William S Fulton
07ab80b49e Add raise methods for throwing c++ exceptions in C#, Java, D
The director c++ exceptions are thrown in a helper method instead of in
the director overloaded method. This circumvents compiler warnings about
throwing exceptions when the method has an exception specification or
noexcept. If the exception is thrown, abort will still be called!
In Java, the "director:noexcept" typemap can be used to do something
else. This typemap should be ported to the other languages too.
2017-05-13 17:01:15 +01:00
William S Fulton
971404485f php5: propagate c++11 noexcept to director classes 2017-05-13 16:59:36 +01:00
William S Fulton
cedfbfbee8 Revert "java : noexcept method can't raise Swig::DirectorException"
This reverts commit e13eaaae21.
2017-05-13 16:16:29 +01:00
William S Fulton
e429a891c9 Revert "csharp : noexcept method can't raise Swig::DirectorPureVirtualException"
This reverts commit 9dcf10138e.
2017-05-13 16:16:17 +01:00
Nihal
eb9e72f3b2 Add new pragma to specify version to PHP5 and PHP7 extensions.
See issue #360, feature request to have version in php5 and php7 extensions.
2017-05-08 11:43:38 +05:30
Nihal
3adf88e9ef Refactor to generate init section before the code.
Prerequisite to address issue #360, feature request of adding extension version.
This change has been taken from Sources/Modules/php.cxx - PHP7 Backend.
2017-05-07 17:49:02 +05:30
Christophe Duvernois
9dcf10138e csharp : noexcept method can't raise Swig::DirectorPureVirtualException 2017-04-28 11:45:36 +02:00
Christophe Duvernois
e13eaaae21 java : noexcept method can't raise Swig::DirectorException 2017-04-28 11:45:02 +02:00
Christophe Duvernois
4777a0ad3c #526 : propagate c++11 noexcept to director classes 2017-04-27 23:37:15 +02:00
Philip Herron
624ec3e1b7 Fix bug with comments inline in macros
- commit fixes #974
2017-04-27 15:35:13 +01:00
Simon Marchetto
c06c9b3853 [Scilab] New parameter targetversion to specify the Scilab target version (5, 6, ..) for code generation
With Scilab 6 target specified, identifier names truncation is disabled (no longer necessary)

Signed-off-by: Simon Marchetto <simon.marchetto@scilab-enterprises.com>
2017-04-12 13:54:42 +02:00
William S Fulton
29af5c7aec Merge branch 'srepmub-coverity_args_check'
* srepmub-coverity_args_check:
  [Coverity] fix issue reported for wrapper argument checking
2017-03-24 07:26:54 +00:00
William S Fulton
dcc5911839 Fix handling of typedef'd function pointers for Go
Add equivalent runtime tests for Python and Java
2017-03-17 07:49:21 +00:00
William S Fulton
72ba741d1c Fix wrapping of references/pointers and qualifiers to member pointers
Also fix Go wrapping of member const function pointers.
2017-03-16 21:04:38 +00:00
William S Fulton
b851e45e0a Fix seg fault for global declarations declared erroneously without a name 2017-03-10 23:25:31 +00:00
William S Fulton
4f235027f4 Improved member function pointer parsing
Add support for parsing member function pointers with qualifiers,
references and pointers, eg

short (Funcs::* const parm)(bool)
2017-03-10 23:25:31 +00:00
William S Fulton
0ccef1424a C++11 alternate syntax for function declarations improvements
Functions can now be declared const/noexcept/final etc
2017-03-10 23:25:31 +00:00
William S Fulton
fc638814ae Add support for unnamed parameters: member const function pointers 2017-03-10 23:25:31 +00:00
William S Fulton
5aff26fcb5 Add support for parsing and wrapping member const function pointers 2017-03-10 23:25:31 +00:00
Mark Dufour
13eeebd2fb [Coverity] fix issue reported for wrapper argument checking
Fix Coverity issue reported for wrapper argument checking:

"Null-checking args suggests that it may be null, but it has already
been dereferenced on all paths leading to the check."

So 'args' is null checked, but after dereferencing it with
PyTuple_Check(args).
2017-03-06 14:07:47 +01:00
Asen Alexandrov
a6e9c087d8 [Issue 905] Add recognition for throw (.+) final|override in parser.y
PROBLEM:
 There is a small ommission in parser.y, which will lead
 to syntax errors in cases when non-empty throw declaration is
 followed by `override`, `final` or both. E.g. in cases like:

       void finalOverriden() throw(std::exception) final override;

SOLUTION:
 - Add a `THROW LPAREN parms RPAREN virt_specifier_seq` to
   exception_specification in Source/CParse/parser.y
 - Add several methods in test-suite/cpp11_final_override.i
   to verify the fix works.
2017-02-27 10:08:23 +13:00
William S Fulton
dee6b075a8 Fix seg fault parsing unterminated raw string literals 2017-02-09 22:02:20 +00:00
William S Fulton
d387e749f5 Warning fix for visual c++ 2017-02-04 19:18:54 +00:00
William S Fulton
25ac8f97f6 Fix popen pclose warnings compiling under wine
Fix i686-w64-mingw32-g++ compiler on linux warning:

In file included from Swig/swig.h:21:0,
                 from Swig/misc.c:14:
Swig/misc.c:1125:14: warning: ‘_popen’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
 extern FILE *popen(const char *command, const char *type);
              ^
Swig/misc.c:1126:12: warning: ‘_pclose’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
 extern int pclose(FILE *stream);
2017-02-04 19:18:54 +00:00
William S Fulton
9d832c30b9 Fix missing filename in error messages when writing out C# files
Closes #882
2017-01-27 18:14:23 +00:00
William S Fulton
2abdb50f60 Merge branch 'andrey-starodubtsev-directorargout_and_java_typemaps'
* andrey-starodubtsev-directorargout_and_java_typemaps:
  WIP: #704 (java directorargout + java/typemaps.i fixes)
  WIP: #704 (java directorargout + java/typemaps.i fixes)
  WIP: #704 (java directorargout + java/typemaps.i fixes)
  WIP: #704 (java directorargout + java/typemaps.i fixes)
  WIP: #704 (java directorargout + java/typemaps.i fixes)
  a lot of memory leak (local refs) fixed
  java directorargout + java/typemaps.i fixes
2017-01-24 19:04:35 +00:00
William S Fulton
d6d7afb755 Enhance %extend to extend a class with template constructors 2017-01-24 19:01:43 +00:00
William S Fulton
481ebfab45 Enhance %extend to extend a class with static template methods 2017-01-24 19:01:43 +00:00
William S Fulton
83519138e8 Tweak %extend templates
Previous commit turned on the generation of an extra extend function
wrapper of a member template function when %template was inside a %extend
block instead of calling the real member template - reversed this side
effect.
2017-01-24 19:01:43 +00:00
William S Fulton
b538070016 Enhance %extend to extend a class with template methods 2017-01-22 10:36:46 +00:00