Commit graph

2,728 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
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
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
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
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
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
Andrey Starodubtsev
347aa187d5 WIP: #704 (java directorargout + java/typemaps.i fixes)
- use `makeParameterName` instead of plain `Getattr("name")` as
  @wsfulton suggested
2017-01-22 13:05:46 +03:00
Andrey Starodubtsev
4ba9de370e Merge branch 'master' into directorargout_and_java_typemaps 2017-01-21 17:41:31 +03:00
William S Fulton
0e48622ca3 Merge branch 'wkalinin-override_fix'
* wkalinin-override_fix:
  test case added for "override" from imported module
  #733 - wrong "override" calculation in import mode
2017-01-16 19:48:19 +00:00
William S Fulton
3d2e57b0f2 Add %proxycode directive for adding code into proxy classes for C#, D and Java 2017-01-13 20:43:50 +00:00
Olly Betts
0aac18b2a1 [PHP] destroy_globals function is empty, so drop
We can just pass NULL instead.
2016-12-30 16:02:01 +13:00
Olly Betts
36ee653d3b Omit module functions when there's no code
MSHUTDOWN, RINIT, RSHUTDOWN and MINFO are often empty, so check and
omit them if this is the case, and set the module structure entry to
NULL instead.  Reduces code size, number of external functions on the
module, and runtime overhead a little (RINIT and RSHUTDOWN are called
on every request when used with a webserver).
2016-12-30 15:36:08 +13:00
Olly Betts
cf60bb8895 [php7] Drop special code for PHP < 5.4 2016-12-30 14:56:53 +13:00
Olly Betts
4a2ede0820 [PHP7] Remove lingering generated ZTS code
ZTS is gone in PHP7 so these are dead code.
2016-12-30 12:41:19 +13:00
William S Fulton
01fa85bda7 Add %feature("csdirectordelegatemodifiers") for C#
Enable customization of the delegate access modifiers generated in director classes.
Fixes https://github.com/swig/swig/issues/748
2016-12-24 17:14:36 +00:00
Joseph Wang
14a5f9e11d Merge pull request #839 from richardbeare/RsetMethods
Corrected generation of "set" methods for R.
2016-12-21 21:52:27 +08:00
Olly Betts
7a3cfdb013 Fix GCC 7 warnings
From -Wimplicit-fallthrough which is now enabled by -W.
2016-12-21 13:05:20 +13:00
Olly Betts
f474577d5b Fix "set but not used" warning 2016-12-13 13:58:51 +13:00