This reverts commit 0ff9a0959a.
The modified fix breaks Java and C#, where C constant expressions
get used in the generated target language code in some cases.
Revert this fix for now.
No need to check for NULL before calling delete/free.
Anyone using typemaps_string_alloc with custom allocators and
deallocators need to ensure the custom allocators behave in the
same way as the standard deallocators in this respect.
* unique_ptr-inputs:
std::unique_ptr std::auto_ptr tidyup
Add support for std::auto_ptr inputs
Cosmetic formatting and doc updates in std_unique_ptr.i files
Add Perl support for std::unique_ptr inputs
Add Ruby support for std::unique_ptr inputs
Add Python support for std::unique_ptr inputs
Add C# support std::unique_ptr inputs
Java unique_ptr test ownership enhancement to test
Java unique_ptr enhance test for double release
SWIGTYPE && input typemaps now assume object has been moved
Add Java support for std::unique<T> for input parameters.
Closes#692
Conflicts:
CHANGES.current
This OS has been unsupported for over 20 years. We stopped providing
macswig builds more than 20 years ago too:
https://sourceforge.net/projects/swig/files/macswig/
The required SIOUX library doesn't seem to be available anywhere
now either.
Closes#2323
Avoid using reserved identifiers such as `_DOHINT_H` (fixes#1989),
fix cases where the name doesn't match the filename, and make the naming
more consistent and less likely to collide with include guards in other
headers.
Change these typemaps to assume that after a function call,
the parameter has been moved. The parameter's proxy class
that owns the C++ object thus has the underlying pointer set
to null so the object cannot be used again and the object is deleted.
Scrap new javarelease typemap and move contents into javabody typemap.
This works by transferring ownership of the underlying C++ memory
from the target language proxy class to an instance of the unique_ptr
which is passed to the wrapped function via std::move.
The proxy class has a new swigRelease() method which sets the
underlying C++ pointer for the proxy class to null, so working
in much the same way as std::unique_ptr::release(). Any attempt at
using the proxy class will be the same as if the delete() function
has been called on the proxy class. That is, using a C++ null pointer,
when a non-null pointer is usually expected.
This commit relies on the previous commit that uses std::move
on the temporary variable used for the wrapped function's input parameter
as std::unique_ptr is not copyable, it has move-only semantics.
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.
Since the recent inclusion of <utility>, the warning suppressions in
swiglabels.swg stopped working as they appear after this include file.
In particular, The _MSC_VER warnings were not working.
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.
* java-director-leak:
Cosmetic tidyup in SWIG_JAVA_DETACH_ON_THREAD_END code
Java: Move auxiliary methods into JObjectWrapper.
Java: Option to detach from the JVM in the thread destructor.
Conflicts:
CHANGES.current
* more_argcargv:
Document argc argv library
argcargv.i cosmetic updates
Typemaps for (int ARGC, char **ARGV) fixup
Fix argcargv.i in Perl5, Tcl, PHP Add missing type map for type check. Add testing of argcargv.i for Perl5, Tcl, PHP and Ruby.
Add Lua test for argcargv.i
Add argcargv.i to more languages: Perl 5, Tcl, PHP
Add argcargv.i to Lua