Commit graph

2,458 commits

Author SHA1 Message Date
Olly Betts
9086eb351c Merge pull request #413 from LindleyF/master
Don't include an STL header in SWIG.
2015-05-08 11:57:13 +12:00
Lindley French
8f19d77fec Don't include an STL header in SWIG. 2015-05-07 11:29:47 -07:00
Olly Betts
c2972b8bf0 [Python] Deal with an integer as the default value of a bool
parameter in the C++ prototype.  Fixes github #327, reported by
Greg Allen.
2015-05-07 16:25:32 +12:00
Olly Betts
8fc7796643 Merge pull request #403 from LindleyF/master
Zero-initialize swig_override in the director constructor.
2015-05-07 13:26:04 +12:00
Lindley French
159b3c7958 Use a bitset which is automatically initialized to 0, instead of a bool array which is not. 2015-05-06 11:33:28 -07:00
William S Fulton
428b6176df Add support for friend templates, including operator overloading.
Closes #196.
2015-05-05 06:48:25 +01:00
Ian Lance Taylor
48263f4802 [Go] Make sure that arguments for which use memcpy when calling C are
still live after the call.  This ensures that they will not be
collected if the GC runs during the call.
2015-05-04 15:11:31 -07:00
Lindley French
5f0181bfdd Too hard to conditionally define the memset....instead just make sure the array is defined even if it's unused. 2015-05-01 12:40:07 -07:00
Lindley French
e8ca8fb2e6 Only output memset if the array exists. 2015-04-30 23:14:48 -07:00
Lindley French
8acca78953 Zero-initialize swig_override in the director constructor. 2015-04-30 21:16:30 -07:00
Vadim Zeitlin
6988b00aba Fix handling of default arguments after ignored ones in Python.
Don't skip checking subsequent arguments just because one of them has "in"
typemap with numinputs=0 attribute.

Add a unit test showing the problem which is relatively rare as it doesn't
happen for the class methods and is hidden unless autodoc feature is used for
the global functions.

Closes #377.
2015-04-27 23:17:14 +02:00
William S Fulton
d64c241e1c gcc-5.1 warning fixes 2015-04-26 01:18:26 +01:00
William S Fulton
416277b3a5 Python code generated with '-builtin -modernargs' segfaults for any method taking zero arguments.
Also fixes: "SystemError: error return without exception set" during error checking
when using just -builtin and the incorrect number of arguments is passed to a class
method expecting zero arguments.

Closes #256
Closes #382
2015-04-24 21:08:17 +01:00
William S Fulton
e4d02d20ad Warning fix for VC++ 2015-04-23 19:21:59 +01:00
Vadim Zeitlin
5569d91bd0 Fix handling of "default" typemap in Python.
Use "compact" arguments form for the function if "default" typemap is defined
for any of its arguments to allow omitting this argument when calling it from
Python.

Closes #377.
2015-04-23 15:11:05 +02:00
Vadim Zeitlin
2369e2c500 No changes, just added an explanatory comment to Python module.
Explain a bit better when and why do we decide to use "*args" in the generated
Python code.
2015-04-23 15:11:02 +02:00
Vadim Zeitlin
0eae8a8efa Fix handling of NULL default argument values for pointer types.
Accept not only manifest pointer types (such as e.g. "void *") but also types
that are typedefs for pointer types when checking whether C++ value of 0 must
be represented as 0 or None in Python.

Closes #365, #376.
2015-04-23 15:11:02 +02:00
William S Fulton
55e7264d43 Clearer warning message for badly constructed typecheck typemaps 2015-04-14 07:34:40 +01:00
William S Fulton
439313c7f4 Merge pull request #281 from ivan4th/master
CFFI: handle array struct/union members.

I don't know how to test this, but merging anyway.
2015-04-11 22:57:30 +01:00
William S Fulton
b886a54fce Merge branch 'amaeldoe-master'
* amaeldoe-master:
  Add python runtime test for dynamically added attributes
  Attribute of SWIG wrapped classes instances were overwritten on __init__()
  Fix SwigPyObject->dict memory leak
  Make __dict__ accessible for Python builtin classes
2015-04-11 12:37:11 +01:00
Yoann Vandoorselaere
92b88db7ab Make __dict__ accessible for Python builtin classes
Attribute set within instance of a SWIG Python wrapped class are
stored in SwigPyObject->dict, which tp_dictoffset slot is pointing to.

However, SWIG wrapped classes did not have a __dict__ attribute.
Inheriting subclasses did not get the attribute either because the
SWIG wrapped classes initialize the tp_dictoffset slot:

From http://bugs.python.org/issue16272:

"If a type defines a nonzero tp_dictoffset, that type is responsible for
defining a `__dict__` slot as part of the tp_getset structures. Failure to
do so will result in the dict being inaccessible from Python via
`obj.__dict__` from instances of the type or subtypes."

Provide a SwigPyObject_get___dict__() function to retrieve the dict
attribute or create it when it does not exist yet (it is normally
created when setting attribute set), and a PyGetSetDef entry pointing
to this function.
2015-04-11 02:05:06 +07:00
Olly Betts
084f72452f Fix javadowncast to csdowncast in C# backend
See issue#367.
2015-03-30 08:38:24 +13:00
Olly Betts
38a75a22c9 "suppport" -> "support" 2015-03-27 12:54:47 +13:00
Olly Betts
01d0ee86e0 Fix C&P references to Python in comments 2015-03-27 12:40:42 +13:00
Olly Betts
2c08e33099 Correct java warning to save javabase not csbase 2015-03-27 12:30:19 +13:00
James Athey
7a050461c6 When warning about multiple inheritance in C#, say C# in the message instead of Java 2015-03-26 11:11:11 -04:00
Ian Lance Taylor
baf1fe036a [Go] Correct goargout typemap when matching multiple parameters. 2015-03-16 11:45:15 -07:00
William S Fulton
7fa1058a8a Configure fix and warning fix for Go 2015-03-14 23:40:30 +00:00
Ian Lance Taylor
32bb4dcd6d Merge branch 'master' of git://github.com/swig/swig 2015-03-12 08:14:17 -07:00
Ian Lance Taylor
eccfa288b8 [Go] Consistently use the same type when dispatching to an overloaded
function.
2015-03-12 08:13:16 -07:00
Olly Betts
7ba0652677 Create director_common.swg for language-indep code
Move -DSWIG_DIRECTOR_STATIC handling there, so this is now supported for
all languages with director support, not just Python and PHP.
2015-03-12 19:51:11 +13:00
Ian Lance Taylor
a6a9a89524 [Go] Fix overloading on an undefined type. 2015-03-06 17:51:30 -08:00
Ian Lance Taylor
b15a66f2ab [Go] Use imtype when checking for pointer in cgo type. Permit func,
map, chan values to be converted to pointers when using cgo.
2015-03-04 14:25:10 -08:00
Ian Lance Taylor
9ad497c08e [Go] Add -cgo option, required for Go version 1.5 and later. 2015-03-02 14:03:33 -08:00
Olly Betts
df36d84f1b Avoid debug code segfaults when top==NULL 2015-02-26 14:59:49 +13:00
Olly Betts
de1cae9319 Fix segmentation fault when top==NULL
Introduced by nested class handling (reported in issue#346 by Paweł Tomulik).
2015-02-26 14:57:19 +13:00
Ian Lance Taylor
1dd401899f [Go] Change SWIG directors to use a handle instead of a Go pointer.
In future releases of Go it will not be possible to pass Go pointers
into C/C++ code.  The handle is automatically translated back to the
Go value using a Go map.  Since directors must be explicitly deleted,
we can reliably use that call to remove the handle from the map.
2015-02-22 11:09:58 -08:00
Ian Lance Taylor
40f5b1ecc6 [Go] Fixes so that the go_subdir_import test will work with gccgo. 2015-02-22 11:01:24 -08:00
Misha Seltzer
fcf2b68e84 Fixed errors due to last sync. 2015-02-17 10:27:45 +02:00
Misha Seltzer
8da4d20308 Fixed SWIG go for cases when SWIG %import-s another package which is located in a subdirectory. 2015-02-17 10:27:45 +02:00
William S Fulton
37bd50ddf9 Guile - fix generated code for static const char member variables when defined and declared inline. 2015-02-11 23:34:23 +00:00
William S Fulton
1ef899a57b Merge branch 'stricter-warnings'
* stricter-warnings:
  Go changes for wrappers to compile as ISO C90
  Scilab typecheck typemaps fix for C90
  No error for one Javascript node warning
  Warning fix in testcase for Javascript node
  nested_extend_c testcase fix when compiled by C++ target languages
  Temporarily remove -Werror for Scilab testing
  C90 fixes for Javascript JSC
  There are a couple of testcases that aren't compliant and supression via pragmas doesn't work for gcc < 4.8
  Warning suppression change
  Scilab typemap fixes for C89
  compiler warning suppression correction in testcase
  Suppress pedantic warnings in C# testcases
  Suppress pedantic warnings in testcases
  Pedantic warning fix in testcase
  pedantic warning fix for D wrappers
  Travis testing to use testflags.py for setting CFLAGS and CXXFLAGS
  Add travis build for error-declaration-after-statement branch
2015-02-11 23:33:26 +00:00
William S Fulton
e3a8ee1927 Go changes for wrappers to compile as ISO C90
Fixes:
ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
2015-02-11 23:32:46 +00:00
William S Fulton
59ff3e6a3a C90 fixes for Javascript JSC 2015-02-11 23:32:45 +00:00
Ian Lance Taylor
1863b191bf [Go] Refactor some functions to make it easier to move to a new
approach for generating Go interfaces.  No functional changes.
2015-02-09 11:21:58 -08:00
Ian Lance Taylor
0a021a938e [Go] Remove all generated calls to _swig_makegostring, as it will no
longer as of Go 1.5.  In Go 1.5 or later user calls to
_swig_makegostring will fail at link time.

Instead, use goout and godirectorin typemaps to allocate strings in Go
code.

Change the Go typemaps support to ignore empty strings, so that we can
define empty strings for regular types so that %apply will override
the definitions for string types.

Fix the gccgo code to wrap SwigCgoCallback around all godirectorin
typemaps.

Add a few newlines after typemap code so that the typemaps don't have
to include them.
2015-02-05 10:15:37 -08:00
Ian Lance Taylor
2562c1eb41 [Go] Remove all calls to _swig_goallocate in the Go runtime, except
for the one from _swig_makegostring.  _swig_goallocate can not work
with the future Go 1.5 release.  When using Go 1.5 attempts to call
_swig_goallocate will fail at link time.
2015-02-04 16:08:44 -08:00
Ian Lance Taylor
2752d78ce6 [Go] Use a unique name for the wrapper functions, since they are
publicly visible.  This permits linking together different SWIG
wrappers in the same program if they wrap the same function.  The
unique name is generated by hashing the .swig file.
2015-02-04 13:18:00 -08:00
William S Fulton
39a75442a1 Fix Python -classic and property setting
Setting properties on classic classes was broken in swig-3.0.3 by attempting to use __setattr__. This regression is fixed now by using __dict__ again when using -classic.

Fixes patch #232.
2015-01-30 23:27:22 +00:00
William S Fulton
727d74f6be Python C89 fix mixed code and declarations compiler error in constants code from patch #250 2015-01-28 08:09:06 +00:00