SWIG_NOEXCEPT is generated instead of throw() which is deprecated in
c++11. If c++11 or later is being used, then this macro expands to
noexcept instead of throw().
Affects director code only.
Also fix up some testcase to not use throw() when using c++11 or later.
Tested with clang and -Wdeprecated-dynamic-exception-spec as gcc
doesn't seem to warn for this deprecation.
Closes#3027
We had versions of it for octave, python, ruby and scilab, which were
exactly the same except for using explicit target language types instead
of SWIG_Object (which is an equivalent type for all these languages),
and except that scilab passed by const reference (but SwigSciObject is
actually an int so there's no benefit to passing by const reference).
This fixes a missing definition of this fragment for SWIG/R which was
triggering a warning when you did `%include std_deque.i` in SWIG/R:
Warning 490: Fragment 'StdDequeTraits' not found.
* Improve mutex for director use:
- Use C++ 11 mutex and lock classes.
Most compilers support C++ 11 by default.
Leave Win32 and POSIX support for older compiler.
- Use a single file for Python and Ruby.
- Use macro also for guard definition instead of using '#ifdef'.
- Rename old '__THREAD__' to 'SWIG_THREADS' to
avoid collide with other libraries.
- Remove the use of '__PTHREAD__' as it may collide with other libraries.
- Remove mutex from OCaml, as it is not used in Director class.
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
* Fixes follow @wsfulton.
Improve description of director_guard.swg.
Remove duplicate line.
Change to SWIG_GUARD_DEFINITION and SWIG_GUARD_DECLARATION
as full English words are much more easily understood
than abbreviations.
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
---------
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
* char_binary_java_fix-tidyup:
Move SWIGStringWithLengthHelper to csharphead.swg
cdata whitespace/cosmetic fixups
cdata doc updates
Rename `typemaps/cdata_struct.swg` to `typemaps/cdata_begin.swg`. And `typemaps/cdata.swg` to `typemaps/cdata.swg`. Move `cdata_apply.swg` content to `typemaps/cdata.swg`.
Group the C# marshalling of STRING-LENGTH typemap into C# class named SWIGStringWithLengthHelper.
Leave Length & string reverse order typemap in typemaps/strings.swg
Support old C# as "LPUTF8Str" was add in 2017.
Improve documentation. Follow @wsfulton reviews.
Use a dummy for MzScheme and untested OCaml cdate. To prevent compilation error.
Further fixing follow reviews.
Reorganise raw data typemap, so typemaps folder contain only common part. Improve document.
Inline SWIG_string_to_utf8_bytes SWIG_utf8_bytes_to_string code
Fixes of STRING/BYTES LENGTH typemaps.
Conflicts:
CHANGES.current
For Javascript, MzScheme, Python, Ruby.
Removes the vast majority of the /*@SWIG:...*/ locator strings in the
generated wrappers for these 4 languages to help with reproducible builds.
Issue #202
Fix Java STRING LENGTH typemap.
Use string type in static typed languages (Java, C#, D and Go).
Add BYTES LENGTH typemap and apply it for binary data.
Use byte type in static typed languages.
Add li_cdata_cpp, li_cdata and char_binary
tests for most of languages(apart from R and experimental).
Fix the director_binary_string test and add it to C#, D, Go,
Perl, PHP, Python, Ruby and octave.
Update documents.
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
Fix setslice(), reinitialise iterator to begin after calling erase().
Fix comparison of integer expressions of different signedness
in getslice() functions.
Fix __setitem__() resize use with new item only if any.
In RubySequence_Cont structure, use standard 'size_t' for size_type.
Add 'li_std_containers_int' test to ruby.
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
* ruby-lower-bound-checking:
Ruby: Add check for lower bounds of unsigned long (long) parameters
Ruby: Add test case for checking bounds of integral function parameters
in the %array_functions and %array_class macros.
Affects C#, D, Go, Guile, Java, Javascript, Lua, Ocaml, R, Racket.
Closes#1680
If the old types are required for backwards compatibility, use %apply to
restore the old types as follows:
%include "carrays.i"
%apply int { size_t nelements, size_t index }
... %array_functions and %array_class ...
%clear size_t nelements, size_t index; # To be safe in case used elsewhere
* issue/2625:
Enhanced std::map for non-default constructible types changes entry
Add missing exception.i for std::map wrappers for MzScheme and Guile
std::map wrappers and non-default constructible
Fixed make file ordering
Fixed line endings
Added unit test
Using #ifdef instead of #if to prevent warnings
Fix for #2625 Using c++17 insert_or_assign for std::map when available.
Conflicts:
CHANGES.current
Fix deprecation warnings about ANYARGS when compiling C++ code for
SWIG-generated Ruby wrappers with Ruby 3.x.
This is a recurrence of a problem fixed in 4.0.2. Our fix was
conditional on RB_METHOD_DEFINITION_DECL being defined, but Ruby
3.0 stopped defining this.
We aim to produce code that works with C90 or C++98 so we can't
assume snprintf() is available, but it almost always is (even
on systems from before it was standardised) so having a way to
use it is helpful.
Enable this automatically if the compiler claims conformance
with at least C90 or C++98 and check SWIG_HAVE_SNPRINTF to allow
turning on manually, but disable if SWIG_NO_SNPRINTF if defined.
The fallback is to call sprintf() without a buffer size check -
checking after the call is really shutting the stable door after
the horse has bolted, and most of our uses either have a fixed maximum
possible size or dynamically allocate a buffer that's large enough.
Fixes: #2502 (sprintf deprecation warnings on macos)
Fixes: #2548
For implementing full move semantics when passing parameters by value.
Based on SWIGTYPE && and std::unique_ptr typemaps which implement move
semantics.
Added for all languages, but untested for: Go, Ocaml, R, Scilab (and
unlikely to be fully functional for same reasons as for std::unique_ptr
support).
Issue #999
The directorin typemaps in the director methods now use std::move on the
input parameter when copying the object from the stack to the heap prior
to the callback into the target language, thereby taking advantage of
move semantics if available.
Enhance SWIGTYPE "out" typemaps to use std::move when copying
objects, thereby making use of move semantics when wrapping a function returning
by value if the returned type supports move semantics.
Wrapping functions that return move only types 'by value' now work out the box
without having to provide custom typemaps.
The implementation removed all casts in the "out" typemaps to allow the compiler to
appropriately choose calling a move constructor, where possible, otherwise a copy
constructor. The implementation alsoand required modifying SwigValueWrapper to
change a cast operator from:
SwigValueWrapper::operator T&() const;
to
#if __cplusplus >=201103L
SwigValueWrapper::operator T&&() const;
#else
SwigValueWrapper::operator T&() const;
#endif
This is not backwards compatible for C++11 and later when using the valuewrapper feature
if a cast is explicitly being made in user supplied "out" typemaps. Suggested change
in custom "out" typemaps for C++11 and later code:
1. Try remove the cast altogether to let the compiler use an appropriate implicit cast.
2. Change the cast, for example, from static_cast<X &> to static_cast<X &&>, using the
__cplusplus macro if all versions of C++ need to be supported.
Issue #999Closes#1044
More about the commit:
Added some missing "varout" typemaps for Ocaml which was falling back to
use "out" typemaps as they were missing.
Ruby std::set fix for SwigValueWrapper C++11 changes.