Commit graph

3,086 commits

Author SHA1 Message Date
Simon Marchetto
adc4b788df Merge remote-tracking branch 'origin/master' into gsoc2012-scilab
Conflicts:
	.gitignore
	.travis.yml
	configure.ac
2015-01-26 10:50:20 +01:00
Olly Betts
8fe85e764f Eliminate "found" flag for simpler, clearer code 2015-01-24 15:12:29 +13:00
Olly Betts
2a43178021 Fix comment grammar 2015-01-24 14:57:05 +13:00
DavidMazary
3667d0c583 Remove unused assignment
The value of module_head is not used after this assignment in this branch of the function.
2015-01-23 15:58:50 -05:00
William S Fulton
d3051c5b04 Merge branch 'ConroyJ-master'
* ConroyJ-master:
  Updated usage string for -cppcast/-nocppcast in octave.cxx
  Attempting fixes for Octave shared_ptr support
2015-01-22 20:06:55 +00:00
William S Fulton
fd8dcf44bf C++11 strongly typed enum fixes for directors
Tests added for previous commit. Further refinements to patch #308 and
fixes #307.
2015-01-15 19:48:07 +00:00
Ahti Legonkov
6a7250d71b Fix #307. 2015-01-14 18:59:53 +02:00
Olly Betts
0dd685bad2 Fix PHP crash in director_finalizer 2015-01-14 15:38:55 +13:00
William S Fulton
9d87b9f099 Revert introduction of python:defaultargs feature
See issue #294
2015-01-12 21:35:47 +00:00
Thomas Trocha
4e7af7db80 [lua/luarun] change return type from int to void on functions not returning anything
Using emscripten compiler to crosscompile to javascript lead to "traps" on this functions which results in a crash
2015-01-11 15:34:07 +01:00
William S Fulton
38ba81811e Fix Python default argument handing broken since swig-3.0.3
Default values are no longer generated as Python code by default.
They must be explicitly turned on using the "python:defaultargs" feature.

Closes #294
Closes #296

The problems in these two issues when "python:defaultargs" is turned
on still need to be fixed and should be addressed in separate patches.
The important thing is the default code generation is now fixed.
2015-01-09 00:34:17 +00:00
Olly Betts
9ca6f78b07 Update link to point to 3.0 docs 2015-01-08 11:16:48 +13:00
Simon Marchetto
78705a5175 gateway source is moved into wrapper source 2015-01-07 18:04:29 +01:00
Jeremy
e301457a43 Attempting fixes for Octave shared_ptr support 2015-01-05 10:53:06 -05:00
William S Fulton
cb4d0dbba5 %constant and structs support for Lua 2014-12-29 17:36:56 +00:00
Robert Stone
03570f85f2 [Perl] tidy "warning: duplicate 'extern' declaration specifier" when building generated code under clang 2014-12-27 20:45:11 -08:00
William S Fulton
1db561cf08 Improve Python builtin and %constant structs
Tweak to previous commit from issue #250 for C compatibility.
Set self to zero too.
2014-12-18 07:01:08 +00:00
Paweł Tomulik
0ad384bb28 fixed python global object constants
Fix for Python and -builtin
Fix from Github issue #250
2014-12-18 07:01:08 +00:00
William S Fulton
cf3be359cf Add c++11 strongly typed enum support for Guile 2014-11-28 23:27:22 +00:00
William S Fulton
b45c3737c8 Add c++11 strongly typed enum support for D 2014-11-28 08:13:27 +00:00
William S Fulton
3efd3affbd Add c++11 strongly typed enum support for PHP 2014-11-27 19:59:20 +00:00
David Nadlinger
278308cfd3 D: Fix exception handling support.
The original code was ported from the C# module. It looks like it
tried to avoid reading TLS data by using a shared counter. However,
without also synchronizing on the counter check (or using atomics)
the code is racy. While the races might be benign (the thread that
sets the exception also increments the counter, so when there is
actually an exception, the visible value will always be non-zero
even if it is outdated), they are still undefined behavior,
strictly speaking. Additionally, just using TLS isn't expensive
either.
2014-11-06 23:04:36 +01:00
David Nadlinger
95e8db7c62 D: Fix class/method name ambiguity in test-suite/c_delete.i.
There might be other cases where this happens when $dclassname
is used for code emitted into the proxy class itself, but so
far, there are none in the test suite or any bug reports.
2014-11-06 23:04:35 +01:00
William S Fulton
6029b2f7d8 Fix for 'self' being used as a parameter name 2014-10-30 07:22:59 +00:00
William S Fulton
ede1e9544c Fix R Lib files and testcase failing due to new preprocessor checks
Fixes unknown preprocessor directive error introduced in #217
commit 255c929c56
These were probably intended as script comments using # when C/C++
comments using // or /* */ should have been used.
2014-10-29 23:11:09 +00:00
William S Fulton
7d4af72dde Revert "Fix when is 'self' used as a parameter name in Python"
This reverts commit a6efdb7999.
2014-10-29 09:42:11 +00:00
William S Fulton
a6efdb7999 Fix when is 'self' used as a parameter name in Python
Fix corner case for variable names called 'self' after merging in patch #201
2014-10-28 07:07:44 +00:00
David Nadlinger
732bb8f8ec Merge pull request #205 from timotheecour/dev
Use core.atomic.atomicOp to mutate shared variables
2014-10-24 20:17:38 +02:00
Simon Marchetto
aba56486fe scilab: fix std::string length issue 2014-10-23 11:08:34 +02:00
Simon Marchetto
06614ebb79 scilab: fix compilation warnings in primitive_types test 2014-10-21 10:03:29 +02:00
William S Fulton
3dcc501ac0 Spelling fix 2014-10-21 07:55:07 +01:00
Simon Marchetto
f93e23b32f scilab: fix matrix2 example compilation warnings 2014-10-20 17:44:46 +02:00
Simon Marchetto
d3afd65698 scilab: fix compilation error in scilab 5.3.3 2014-10-20 17:03:17 +02:00
Simon Marchetto
20fc167624 scilab: support typed constants (U UL L) in scilabconst(1) 2014-10-16 16:00:51 +02:00
Ian Lance Taylor
0577ff2220 [Go] Adjust last patch to avoid write-after-write data race on global
variable.  Only set the variable if another global variable is true,
but that variable is always false.  The effect is that the variable is
never written, but as far as the compiler is concerned it might escape.
2014-10-14 10:05:43 -07:00
Simon Marchetto
6791e3ac7a scilab: fix SWIG_SciString_FromChar compilation error on some compilers 2014-10-14 09:26:12 +02:00
William S Fulton
a89a892843 Fixes when using python -builtin and STL container wrappers.
Deletion of single elements previously failed.
Test case li_std_containers_int now works.
2014-10-07 20:58:40 +01:00
Oliver Buchtala
53d7fc8a16 Merge branch 'Richie765-master'
Conflicts:
	CHANGES.current
2014-09-30 18:46:25 +02:00
Richard
00457b6599 Making generated code more readable 2014-09-30 12:33:49 -03:00
Oliver Buchtala
2f26948ac5 Merge branch 'patch-1' of git://github.com/zittix/swig into zittix-patch-1 2014-09-30 17:02:14 +02:00
Simon Marchetto
3997b03f4c scilab: fix int typemaps (functions and fragment names) 2014-09-29 14:56:28 +02:00
William S Fulton
54118d1d61 Merge branch 'tsuna-master'
* tsuna-master:
  Initialize C++ arrays created by array_functions' new_foo().
2014-09-27 16:51:47 +01:00
William S Fulton
1fea434400 Merge branch 'lefticus-ruby_macos_static_data_conflicts'
* lefticus-ruby_macos_static_data_conflicts:
  Fix shared data problem on MacOS 10.9 with xcode 5.1
2014-09-27 15:12:04 +01:00
William S Fulton
0d34a0f0bf Merge branch 'pingany-director_local_jstring_leak'
* pingany-director_local_jstring_leak:
  Use more conventional naming for generated Java LocalRefGuard variables
  Make more use of LocalRefGuard in Java
  fixup! Patch of http://sourceforge.net/p/swig/mailman/message/29816385
  Patch of http://sourceforge.net/p/swig/mailman/message/29816385
2014-09-27 14:33:31 +01:00
William S Fulton
f4964f5fb3 Use more conventional naming for generated Java LocalRefGuard variables 2014-09-27 14:32:03 +01:00
William S Fulton
2f5bf397ae Make more use of LocalRefGuard in Java 2014-09-27 13:56:11 +01:00
Simon Marchetto
2bfb473b6f scilab: fix li_std_string_extra test, missing std_char_traits.i 2014-09-26 11:11:44 +02:00
Simon Marchetto
95c842a9c0 scilab: fix li_std_string_extra, missing lib std_basic_string.i 2014-09-26 09:03:09 +02:00
Ian Lance Taylor
4b64ce71a3 [Go] Adjust generated code to work with upcoming Go 1.4 release. 2014-09-25 12:10:11 -07:00
Thomas Maslach
de6b433cb1 Fix Python crash when using -threads iterating containers
Also fixes li_std_vector_enum testcase when run with -threads.

Patch supplied on swig-devel mailing list on 12 Sep with details...

==============================================
I just wanted to mention that I found a crash issue in bug..

I am using SWIG 2.0.11 with python and have –threads enabled.  I have a C++ std::vector that I instantiate in SWIG with %template.  I also have a method in a class that returns this vector.  I also include std_vector.i, btw..

When I iterate like so:

children = Action.getActionList()
for child in children:
  pass

Everything is fine..

When I iterate like this:

for child in Action.getActionList()
  pass

Product crashes.

The problem is the following.  This code gets called first:

SWIGINTERN PyObject *_wrap_delete_SwigPyIterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;

  if(!PyArg_UnpackTuple(args,(char *)"delete_SwigPyIterator",1,1,&obj0)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SwigPyIterator" "', argument " "1"" of type '" "swig::SwigPyIterator *""'");
  }
  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    delete arg1;
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}

Note the SWIG_PYTHON_THREAD_BEGIN_ALLOW/END_ALLOW. In between those two statements, we delete arg1.  That in turn will eventually end up in this code:

namespace swig {
  class SwigPtr_PyObject {
  protected:
    PyObject *_obj;

  public:
    … snip! …
    ~SwigPtr_PyObject()
    {
      Py_XDECREF(_obj);
    }

Uh-oh!  We call Py_XDECREF when we aren’t supposed to because we are in a SWIG_PYTHON_THREAD_BEGIN_ALLOW/END_ALLOW section!

This takes care of the issue:

namespace swig {
  class SwigPtr_PyObject {
  protected:
    PyObject *_obj;

  public:
    … snip! …
    ~SwigPtr_PyObject()
    {
      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
      Py_XDECREF(_obj);
      SWIG_PYTHON_THREAD_END_BLOCK;
    }

There are several other methods in this class that use the Python API, but don’t have the BEGIN/END block defined.  I’m not sure if they are required for all of them, but I believe they are..

I have attached a modified pyclasses.swg with what I believe are the correct changes.  This code is from 2.0.11, but as far as I can tell, it’s the same as what is in 3.0.2…

Apologies for not doing more here (making/running tests, getting it in the code repository, etc..), but I’m under some pressure to get some unrelated things done…
2014-09-23 22:33:25 +01:00