| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add Swig_obligatory_macros which must be called by each
target language to define SWIG_VERSION correctly
in the generated code, as well as the language specific
macro SWIGXXX where XXX is the target language name.
Drop the #ifdef SWIGXXX that was previously generated -
I can't see the point of this and if users are defining
this macro somehow, then users will need to change this
Closes #1050
|
| |
|
|
|
|
|
|
|
|
| |
Fix when using templates with more than one template parameter
and used as an input parameter in a virtual method in a
director class (problem affecting most of the scripting languages).
Fixes #2160
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ensure that SWIG_VERSION is defined both at SWIG-time and in the
generated C/C++ wrapper code (it was only defined in the wrapper
for some target languages previously).
SWIGGO and SWIGJAVASCRIPT are now defined in the generated wrappers
to match behaviour for all other target languages.
Stop defining SWIGVERSION in the wrapper. This only happened as a
side-effect of how SWIG_VERSION was defined but was never documented and
is redundant.
The new testcase also checks that SWIG is defined at SWIG-time but not
in the generated wrapper, and that exactly one of a list of
target-language specific macros is defined.
Fixes #1050
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Typemaps should be for SWIGTYPE &&, not just const SWIGTYPE &&.
Needs updating for new approach where the proxy object is moved
for a parameter containing an rvalue reference.
|
|
|
|
|
| |
This is a duplicate of SWIGTYPE & and the typemap rules result
in SWIGTYPE & being used if there is no const SWIGTYPE & tyemap.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replicated Java implementation.
Fully implemented for:
- C#
- D
- Guile
- Javascript (UTL)
- Lua
- MzScheme
- Octave (UTL)
- Perl (UTL)
- PHP
- Python (UTL)
- Ruby (UTL)
- Tcl (UTL)
PHP std::auto_ptr std::unique_ptr minor tweaks and testcase corrections
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Equivalent to Java/C# implementation.
|
|
|
|
|
|
|
| |
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 #999
Closes #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.
|
|
|
|
|
| |
Use separate warning for char * and wchar_t * typemaps
SWIGWARN_TYPEMAP_CHARLEAK_MSG and SWIGWARN_TYPEMAP_WCHARLEAK_MSG
|
|
|
|
|
|
|
| |
clang defines __GNUC__ and __GNUC_MINOR__ as if it were GCC 4.2.1
and has since clang 2.4, which was before __has_builtin() was added.
Closes #1239
|
| |
|
|\
| |
| |
| |
| |
| | |
* doc-work:
Move the attribute.i docs into Library.html
Move %attribute documentation into the manual
|
| |
| |
| |
| |
| |
| |
| | |
It's fairly hidden where it is, put it where users can see it more
easily.
Fixes #2166
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previously, the emitted constructors were incomplete prototypes. When
compiling the wrapper code using gcc 6 and -Wstrict-prototypes, the
following warnings were emitted:
warning: function declaration isn’t a prototype [-Wstrict-prototypes]
See #801
|
|/
|
|
|
|
|
|
|
| |
Remove redundant NULL checks before free()/delete
The ISO C and C++ standards guarantee that it's safe to call these
on a NULL pointer, so it's not necessary for the calling code to
also check.
Fixes https://sourceforge.net/p/swig/feature-requests/70/
|
|
|
|
|
|
| |
Use sizeof variable name rather than variable type.
Workaround Visual C++ unable to parse some complex C++11 types, such as
sizeof(short (Funcs::*)(bool) const &&)
|
|
|
|
|
|
| |
AccessorName was being used instead of AttributeName.
Closes #1872.
|
|
|
|
|
|
|
|
|
| |
The typecheck typemaps succeed for non pointers (SWIGTYPE, SWIGTYPE&,
SWIGTYPE&&) when the equivalent to C NULL is passed from the target
language. This commit implements a fix for Python to not accept a Python
None for non-pointer types.
Issue #1202
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The -cppcast option is still turned on by default. The -nocppcast option
to turn off the use of c++ casts (const_cast, static_cast etc) has been
removed. However, defining SWIG_NO_CPLUSPLUS_CAST will still generate C casts
instead of C++ casts for C++ wrappers.
This a revert of commit fc79264a48f186f8bbd367e91fa9dbf9758aa092:
"Revert "Remove -cppcast and -nocppcast command line options""
The Scilab and Javascript casting problems are now fixed, so -cppcast
is now switched on as default.
|
|
|
|
|
|
|
|
|
| |
The function pointer typemaps were not being used when the function
pointer is const, like ADD_BY_VALUE_C in the funcptr_cpp.i testcase:
%constant int (* const ADD_BY_VALUE_C)(const int &, int) = addByValue;
Problem affecting Javascript and observable when running test-suite with -cppcast.
|
|
|
|
|
|
| |
This reverts commit c06f2b4497bffeb185dbf0e65dc925514537ef37.
More work to be done as it breaks Scilab and Javascript tests.
|
|
|
|
|
|
|
| |
The -cppcast option is still turned on by default. The -nocppcast option
to turn off the use of c++ casts (const_cast, static_cast etc) has been
removed. However, defining SWIG_NO_CPLUSPLUS_CAST will still generate C casts
instead of C++ casts for C++ wrappers.
|
|
|
|
|
|
| |
Fixes testcase overload_numeric with -std=c++98 (clang and gcc 6 and later)
Issue #1239
|
| |
|
|
|
|
|
|
| |
returning pointers by reference.
Closes #1167
|
| |
|
|
|
|
|
|
|
|
| |
Use std::move on this pointer as the default approach to supporting
rvalue ref-qualifiers if a user really wants to wrap.
std::move requires <memory> headers so add swigfragments.swg for all
languages to use common fragments. Just header file fragments for now.
|
|
|
|
| |
Also fix Go wrapping of member const function pointers.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- .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
|
| |
|
|
|
|
|
| |
Fixes https://github.com/swig/swig/issues/615,
https://github.com/swig/swig/pull/788 and https://github.com/swig/swig/pull/849.
|
| |
|
|
|
|
|
|
| |
For consistency to previous fixes:
https://github.com/swig/swig/pull/208
https://github.com/swig/swig/issues/440
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The vector of pointers (just fixed) were not working correctly because the
descriptors returned from swig::type_info() were sometimes returning
zero. Zero should only be used for void * as the subsequent call to
SWIG_ConvertPtr will blindly cast the pointer without checking
descriptor.
std::vector<void *> does not work and will require further changes:
specializing traits_info<void *> to return 0 and traits_asptr<void *>.
I tried this and traits_asptr<void> also needs to be added in which
seems odd and requires further investigation...
Lib/python/pystdcommon.swg:
template <> struct traits_info<void *> {
static swig_type_info *type_info() {
static swig_type_info *info = 0;
}
};
Lib/std/std_common.i:
template <>
struct traits_asptr<void *> {
static int asptr(PyObject *obj, void ***val) {
void **p;
swig_type_info *descriptor = 0;
int res = SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0);
if (SWIG_IsOK(res)) {
if (val) *val = p;
}
return res;
}
};
// this is needed, but am not sure this is expected
template <>
struct traits_asptr<void> {
static int asptr(PyObject *obj, void **val) {
void **p;
swig_type_info *descriptor = 0;
int res = SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0);
if (SWIG_IsOK(res)) {
if (val) *val = p;
}
return res;
}
};
|
|
|
|
| |
This file has code that looks like it was migrated to Lib/std/std_common.i
|
|
|
|
|
|
| |
by value.
Closes #434
|
| |
|
|
|
|
| |
Follow-up fix for https://github.com/swig/swigissues/615
|
|
|
|
| |
Fixes https://github.com/swig/swig/issues/615 reported by jplesnik.
|
|
|
|
|
| |
New fragment to check if long long is available using LLONG_MAX
AsVal and From functions for ptrdiff_t and size_t now use long long if available and sizeof(ptrdiff_t) > sizeof(long)
|
| |
|
| |
|
|\
| |
| |
| |
| |
| | |
Conflicts:
.travis.yml
Examples/test-suite/common.mk
|