Commit graph

3,390 commits

Author SHA1 Message Date
Mark Dufour
21f532975f [Coverity] fix issue reported for SWIG_Python_ConvertFunctionPtr
Fix Coverity issue reported for SWIG_Python_ConvertFunctionPtr:

"Execution cannot reach this statement: *ptr = vptr;"

Because if 'ty' is null, then desc becomes null and we return with
SWIG_ERROR. So 'ty' cannot be null at 'if (ty)'.
2017-02-19 09:47:34 +13:00
Mark Dufour
9825fcbab5 [Coverity] fix issue reported for SWIG_Python_FixMethods
Fix Coverity issue reported for SWIG_Python_FixMethods:

"buffer_size: Calling strncpy with a source string whose length
(10 chars) is greater than or equal to the size argument (10)
will fail to null-terminate buff."

The issue is only reported for the "swig_ptr: " line, but for
consistency we replace both occurrences of strncpy with memcpy.
2017-02-15 15:58:26 +13:00
William S Fulton
de6476f321 Merge branch 'tamuratak-fix_std_unordred'
* tamuratak-fix_std_unordred:
  Move cpp11_hash_tables test to Ruby makefile until other languages work
  Cosmetic changes in C++11 std_unordered support files
  [ruby] add tests for unordered containers.
  [ruby] support for std unordered containers.
  use equal_range instead of upper_bound. unordered containers do not have the upper_bound method.
  fix a %fragment argument.
  use %std_container_methods_without_reverse_iterators
  fix Lib/std/std unordered containers
2017-02-10 19:49:10 +00:00
William S Fulton
50f556de39 Cosmetic changes in C++11 std_unordered support files 2017-02-10 19:26:02 +00:00
Jean-Claude Manoli
18ac3030df Replace ICollection with IEnumerable<T>
Adding a constructor that accepts IEnumerable<T> avoids the boxing and unboxing overhead of the original constructor, when the type parameter is a value type. This also allows passing IList<T>, which does not implement ICollection (ironically the generated type implements IList<T>).

Kept the original constructor for backward compatibility, but replaced ICollection with IEnumerable for added flexibility.
2017-02-05 08:02:14 +01:00
Takashi Tamura
d29a325b99 [ruby] support for std unordered containers. 2017-01-29 11:17:18 +09:00
Takashi Tamura
37af90a50e use equal_range instead of upper_bound.
unordered containers do not have the upper_bound method.
2017-01-29 11:11:55 +09:00
Takashi Tamura
b8cf6412e8 fix a %fragment argument. 2017-01-29 10:56:36 +09:00
Takashi Tamura
88a76de9fe use %std_container_methods_without_reverse_iterators 2017-01-29 09:47:18 +09:00
Takashi Tamura
9cb90982ee fix Lib/std/std unordered containers 2017-01-28 16:51:21 +09:00
Brian Caine
892f3592cc Redid the source and the text to check for SCM_MAJOR_VERSION >= 2 2017-01-27 19:06:33 +00:00
Brian Caine
a4ec4df5c9 Disabled pointer conversion when the relevant macros are unavailable (for Guile 1.8) 2017-01-27 19:05:59 +00:00
William S Fulton
65689af848 Refactor std_container iterator functions
This is for future improvements in the C++11 unordered containers which
do not have reverse iterators.
2017-01-27 18:45:22 +00:00
William S Fulton
8a4ab380a1 Java director typemaps and test tweak
- Fix java_director_typemaps test name clash ensuring parallel tests work
- Replace assert with code that is guaranteed to run
- Nicer generated code from directorargout typemap
2017-01-24 23:47:30 +00:00
Andrey Starodubtsev
519f296579 WIP: #704 (java directorargout + java/typemaps.i fixes)
- failed tests fixed
2017-01-22 18:14:38 +03:00
Andrey Starodubtsev
7cb2663132 WIP: #704 (java directorargout + java/typemaps.i fixes)
- avoid JCALL calls in generated code
- avoid redundant blocks in generated code
2017-01-22 13:41:53 +03:00
Andrey Starodubtsev
710804c88f WIP: #704 (java directorargout + java/typemaps.i fixes)
- reverted changes in javahead.swg
2017-01-22 13:41:44 +03:00
Andrey Starodubtsev
2013b703c2 Merge branch 'master' into directorargout_and_java_typemaps 2017-01-22 13:04:05 +03:00
Karl Wette
e24ec40895 Octave: add support for version 4.2
- .travis.yml:
  - ppa:kwwette/octaves has Octave version 4.2, also run C++11 tests
- configure.ac:
  - prefer Octave program "octave-cli" to "octave"
  - extract any -std=* flags from CXX, add to OCTAVE_CXXFLAGS
- Lib/typemaps/fragments.swg:
  - SWIG_isfinite_func(): extern "C++" is required as this fragment can
    end up inside an extern "C" { } block
- Lib/octave:
  - add std_wstring.i (copied from std_string.i) for C++11 tests
- Lib/octave/octrun.swg:
  - move Octave version-checking macros to octruntime.swg
  - Octave single()/double() functions now call .as_single()/.as_double()
    methods; redirect calls to __float__() method as per .scalar_value()
  - << and >> operators are no longer supported by Octave
- Lib/octave/octruntime.swg:
  - move Octave version-checking macros here for conditional #includes
  - #include interpreter.h instead of #toplev.h
  - #include call-stack.h (now needed for octave_call_stack)
  - unwind_protect is now in octave:: namespace
  - error_state and warning_state are deprecated; use try/catch to catch
    errors in feval() instead
  - always set octave_exit = ::_Exit, to try to prevent segfault on exit
- Lib/octave/octopers.swg:
  - << and >> operators are no longer supported by Octave
- Lib/octave/exception.i:
  - Add macro SWIG_RETHROW_OCTAVE_EXCEPTIONS which rethrows any
    exceptions raised by Octave >= 4.2
- Examples/test-suite/exception_order.i:
  - Use macro SWIG_RETHROW_OCTAVE_EXCEPTIONS to rethrow exceptions
    raised by error() function in Octave >= 4.2
- Update Doc/Manual/Octave.html and CHANGES.current
2017-01-22 11:53:12 +13:00
Andrey Starodubtsev
4ba9de370e Merge branch 'master' into directorargout_and_java_typemaps 2017-01-21 17:41:31 +03:00
William S Fulton
d9db3cf628 Add some missing SWIGINTERN usage 2017-01-17 20:08:46 +00:00
William S Fulton
449aa08124 %extend changes and remove default use of javatype, dtype, cstype %typemaps
1) The %extend directive can now optionally support one of the 'class', 'struct' or 'union'.
2) The SWIG library no longer uses the javatype, dtype or cstype typemaps, thereby
   completely freeing them up for users to use without having to replicate the library
   code that they previously added

Tested by changes to test: java_lib_arrays
2017-01-15 16:50:24 +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
Karl Wette
a699944c95 Revert "Lib/octave/octopers.swg: update %ignoreoperator() calls"
This reverts commit 2bc66ab755.
2017-01-07 17:53:35 +13:00
Karl Wette
2bc66ab755 Lib/octave/octopers.swg: update %ignoreoperator() calls
- Need to use *::operator... to match C++ operator... methods
2017-01-06 22:57:41 +13:00
William S Fulton
84c0cb2fe0 Merge branch 'ajrheading1-remove-unary-binary-function'
* ajrheading1-remove-unary-binary-function:
  Remove inheritance from std::unary_function and std::binary_function, they are deprecated in C++11 and already removed in Visual C++ '15' running with /std:c++latest
2016-12-31 00:10:26 +00:00
Olly Betts
26a01e1b83 [PHP7] Fix segfault on module unload
Register internal 'swig_runtime_data_type_pointer' constant as
"CONST_PERSISTENT" to avoid segmentation fault on module unload.  Fixes
https://github.com/swig/swig/issues/859 reported by Timotheus Pokorra -
thanks also to Javier Torres for a minimal reproducer.
2016-12-30 16:05:53 +13:00
Anthony Heading
1871acd4bc Remove inheritance from std::unary_function and std::binary_function,
they are deprecated in C++11 and already removed in Visual C++ '15'
running with /std:c++latest

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3145.html
2016-12-29 00:56:46 -05:00
William S Fulton
c7eab6e5f0 Remove cdata.i module not supported message 2016-12-24 16:08:58 +00:00
William S Fulton
4963a7f88f Fix Python 2 builtin tp_hash hashfunc closure regression when using "python:slot"
Closes https://github.com/swig/swig/issues/843
2016-12-23 23:41:07 +00:00
William S Fulton
94e7482e48 Remove illegal operator overload names in R
https://github.com/swig/swig/pull/853
2016-12-22 19:59:58 +00:00
William S Fulton
f9158e525f Revert "Merge pull request #853 from ivannp/underscores"
This reverts commit a964098754, reversing
changes made to bda3a11f9e.

SWIG should only provide default operator names that provide special
standard or conventional meaning in the target language.
2016-12-22 19:47:54 +00:00
Joseph Wang
a964098754 Merge pull request #853 from ivannp/underscores
Renamed all operators beginning with underscore.
2016-12-21 21:59:32 +08:00
Olly Betts
76d1aac47a Fix isfinite() checks to work with all C++11 compilers
Fixes https://github.com/swig/swig/issues/615,
https://github.com/swig/swig/pull/788 and https://github.com/swig/swig/pull/849.
2016-12-21 11:22:26 +13:00
Simon Marchetto
e517128e08 [Scilab] fix compilation, missing return 2016-12-20 10:09:07 +01:00
Simon Marchetto
94bee6b35a [Scilab] put typemap int/double check into function (to reduce generated code size) 2016-12-19 15:04:30 +01:00
Simon Marchetto
4d46527c9c scilab: clean 2016-12-19 15:04:30 +01:00
William S Fulton
6f0af6bec6 Merge branch 'ezralanglois-fix-memory-leak'
* ezralanglois-fix-memory-leak:
  Replicate Python memory leak fix in std::pair for Octave and Ruby
  Fix memory leak in std::pair Python binding

Conflicts:
	CHANGES.current
2016-12-18 20:02:40 +00:00
William S Fulton
364fa82499 Replicate Python memory leak fix in std::pair for Octave and Ruby
https://github.com/swig/swig/pull/851
2016-12-18 20:00:40 +00:00
William S Fulton
bdf71b0067 Zero initialize %array_functions and %array_class 2016-12-18 17:50:47 +00:00
William S Fulton
cc56765a7a Zero initialize newly created arrays
For consistency to previous fixes:
https://github.com/swig/swig/pull/208
https://github.com/swig/swig/issues/440
2016-12-18 17:50:47 +00:00
Tsutomu IKEGAMI
b630cc603c Fix %array_class in carrays.i for Python -builtin
Closes https://github.com/swig/swig/issues/446
2016-12-18 17:49:47 +00:00
Ivan Popivanov
5ec5266284 Renamed all operators beginning with underscore. 2016-12-17 16:26:10 -08:00
Robert Langlois
631f0c34cc Fix memory leak in std::pair Python binding 2016-12-17 13:27:25 -08:00
Brian Caine
391bb79cba Added support for guile's native pointer type 2016-12-16 15:15:13 +13:00
Simon Marchetto
88b4827d87 scilab: SWIG_ptr() accepts mlist typed pointers and converts them to pointers 2016-12-15 23:57:42 +01:00
Olly Betts
23c0865831 SWIG_Tcl_ObjectDelete: Fix potential NULL pointer dereferences 2016-12-13 12:19:50 +13:00
Olly Betts
a5a6da9547 Fix comment typo 2016-12-13 12:19:09 +13:00
Olly Betts
971b94f5fe Remove dead assignment 2016-12-13 11:29:30 +13:00
Olly Betts
2e98fddd78 Remove pointless casting away of const 2016-12-13 09:34:48 +13:00