aboutsummaryrefslogtreecommitdiff
path: root/Lib/typemaps
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/typemaps')
-rw-r--r--Lib/typemaps/attribute.swg138
-rw-r--r--Lib/typemaps/carrays.swg12
-rw-r--r--Lib/typemaps/cpointer.swg8
-rw-r--r--Lib/typemaps/cstrings.swg22
-rw-r--r--Lib/typemaps/enumint.swg2
-rw-r--r--Lib/typemaps/exception.swg3
-rw-r--r--Lib/typemaps/fragments.swg4
-rw-r--r--Lib/typemaps/implicit.swg2
-rw-r--r--Lib/typemaps/inoutlist.swg4
-rw-r--r--Lib/typemaps/primtypes.swg8
-rw-r--r--Lib/typemaps/ptrtypes.swg26
-rw-r--r--Lib/typemaps/std_string_view.swg16
-rw-r--r--Lib/typemaps/std_strings.swg25
-rw-r--r--Lib/typemaps/string.swg1
-rw-r--r--Lib/typemaps/strings.swg23
-rw-r--r--Lib/typemaps/swigmacros.swg10
-rw-r--r--Lib/typemaps/swigmove.swg19
-rw-r--r--Lib/typemaps/swigobject.swg6
-rw-r--r--Lib/typemaps/swigtype.swg111
-rw-r--r--Lib/typemaps/swigtypemaps.swg1
-rw-r--r--Lib/typemaps/typemaps.swg4
-rw-r--r--Lib/typemaps/valtypes.swg7
-rw-r--r--Lib/typemaps/void.swg4
-rw-r--r--Lib/typemaps/wstring.swg1
24 files changed, 183 insertions, 274 deletions
diff --git a/Lib/typemaps/attribute.swg b/Lib/typemaps/attribute.swg
index 988113991..abdf44dfd 100644
--- a/Lib/typemaps/attribute.swg
+++ b/Lib/typemaps/attribute.swg
@@ -7,132 +7,6 @@
/*
The following macros convert a pair of set/get methods
into a "native" attribute.
-
- Use %attribute when you have a pair of get/set methods to a primitive type
- like in:
-
- %attribute(A, int, a, get_a, set_a);
-
- struct A
- {
- int get_a() const;
- void set_a(int aa);
- };
-
- If you don't provide a 'set' method, a 'read-only' attribute
- is generated, ie, like in:
-
- %attribute(A, int, c, get_c);
-
- Use %attributeref when you have const/non-const reference access methods
- for primitive types or class/structs, like in:
-
- %attributeref(A, int, b);
-
- struct A
- {
- const int& b() const;
- int& b();
- };
-
- %attributeref(B, int, c);
-
- struct B
- {
- int& c();
- };
-
- You can also use
-
- %attributeref(Class, AttributeType, AttributeName, AccessorMethod)
-
- if the internal C++ reference methods have a different name from the
- attribute you want, so
-
- %attributeref(B, int, d, c);
-
- is the same as the last example, but instead of the attribute 'c' being
- called 'c', it is called 'd'.
-
- Now you can use the attributes like so:
-
- x = A()
- x.a = 3 # calls A::set_a
- print x.a # calls A::get_a
-
- x.b = 3 # calls A::b()
- print x.b # calls A::b() const
-
- Use %attribute2 instead of %attribute to indicate that reference-pointer
- translation is required. You use %attribute2 instead of %attribute in
- cases like this:
-
- %attribute2(MyClass, MyFoo, Foo, GetFoo, SetFoo);
- %inline %{
- struct MyFoo {
- int x;
- };
- class MyClass {
- MyFoo foo;
- public:
- MyFoo& GetFoo() { return foo; }
- void SetFoo(const MyFoo& other) { foo = other; }
- };
- %}
-
- Here, the data type of the property is a wrapped type (MyFoo) and on the
- C++ side it is passed by reference. The problem is that the SWIG wrapper will
- pass around a pointer (MyFoo *) which is not compatible with the reference
- type of the accessors (MyFoo &). Therefore, if you use %attribute, you'll get
- an error from your C/C++ compiler. %attribute2 translates between a pointer
- and a reference to eliminate the error. In case you're confused, let's make it
- simple: just use %attribute at first, but if the C/C++ compiler gives an error
- while compiling the wrapper, try %attribute2 instead.
-
- NOTE: remember that if the type contains commas, such as 'std::pair<int,int>',
- you need to use the macro like:
-
- %attributeref(A, %arg(std::pair<int,int>), pval);
-
- where %arg() 'normalizes' the type to be understood as a single
- argument, otherwise the macro will get confused by the comma.
-
- The %attributeval is the same as %attribute, but should be used when the type
- is a class/struct (ie a non-primitive type) and when the get and set methods
- return/pass by value. The following is very similar to the above example, but
- note that the access is by value rather than reference.
-
- %attributeval(MyClassVal, MyFoo, ReadWriteFoo, GetFoo, SetFoo);
- %attributeval(MyClassVal, MyFoo, ReadOnlyFoo, GetFoo);
- %inline %{
- class MyClassVal {
- MyFoo foo;
- public:
- MyFoo GetFoo() { return foo; }
- void SetFoo(MyFoo other) { foo = other; }
- };
- %}
-
- The %attributestring is the same as %attributeval, but should be used for string
- class types, which are unusual as they are a class on the C++ side, but normally an
- immutable/primitive type in the target language. Example usage for std::string:
-
- %include <std_string.i>
- %attributestring(MyStringyClass, std::string, ReadWriteString, GetString, SetString);
- %attributestring(MyStringyClass, std::string, ReadOnlyString, GetString);
- %inline %{
- class MyStringyClass {
- std::string str;
- public:
- MyStringyClass(const std::string &val) : str(val) {}
- std::string GetString() { return str; }
- void SetString(std::string other) { str = other; }
- };
- %}
-
- The %attributestring also works for class types that have %naturalvar turned
- on and so is also useful for shared_ptr which has %naturalvar turned on in %shared_ptr.
-
*/
//
@@ -224,20 +98,10 @@
#if #AccessorMethod != ""
%attribute_custom(%arg(Class), %arg(AttributeType), AttributeName, AccessorMethod, AccessorMethod, &self_->AccessorMethod(), self_->AccessorMethod() = *val_)
#else
- %attribute_custom(%arg(Class), %arg(AttributeType), AccessorName, AccessorName, AccessorName, &self_->AccessorName(), self_->AccessorName() = *val_)
+ %attribute_custom(%arg(Class), %arg(AttributeType), AttributeName, AttributeName, AttributeName, &self_->AttributeName(), self_->AttributeName() = *val_)
#endif
%enddef
-// deprecated (same as %attributeref, but there is an argument order inconsistency)
-%define %attribute_ref(Class, AttributeType, AccessorMethod, AttributeName...)
- #if #AttributeName != ""
- %attribute_custom(%arg(Class), %arg(AttributeType), AttributeName, AccessorMethod, AccessorMethod, self_->AccessorMethod(), self_->AccessorMethod() = val_)
- #else
- %attribute_custom(%arg(Class), %arg(AttributeType), AccessorMethod, AccessorMethod, AccessorMethod, self_->AccessorMethod(), self_->AccessorMethod() = val_)
- #endif
-%enddef
-
-
%define %attributeval(Class, AttributeType, AttributeName, GetMethod, SetMethod...)
%{
#define %mangle(Class) ##_## AttributeName ## _get(self_) new AttributeType(self_->GetMethod())
diff --git a/Lib/typemaps/carrays.swg b/Lib/typemaps/carrays.swg
index 462d60bc2..d02e70fab 100644
--- a/Lib/typemaps/carrays.swg
+++ b/Lib/typemaps/carrays.swg
@@ -11,10 +11,10 @@
* Generates functions for creating and accessing elements of a C array
* (as pointers). Creates the following functions:
*
- * TYPE *new_NAME(int nelements)
+ * TYPE *new_NAME(size_t nelements)
* void delete_NAME(TYPE *);
- * TYPE NAME_getitem(TYPE *, int index);
- * void NAME_setitem(TYPE *, int index, TYPE value);
+ * TYPE NAME_getitem(TYPE *, size_t index);
+ * void NAME_setitem(TYPE *, size_t index, TYPE value);
*
* ----------------------------------------------------------------------------- */
@@ -51,10 +51,10 @@ void NAME##_setitem(TYPE *ary, size_t index, TYPE value);
* interface:
*
* struct NAME {
- * NAME(int nelements);
+ * NAME(size_t nelements);
* ~NAME();
- * TYPE getitem(int index);
- * void setitem(int index, TYPE value);
+ * TYPE getitem(size_t index);
+ * void setitem(size_t index, TYPE value);
* TYPE * cast();
* static NAME *frompointer(TYPE *t);
* }
diff --git a/Lib/typemaps/cpointer.swg b/Lib/typemaps/cpointer.swg
index 94bbbd6bc..a5ac07d85 100644
--- a/Lib/typemaps/cpointer.swg
+++ b/Lib/typemaps/cpointer.swg
@@ -55,7 +55,7 @@ typedef struct {
return %new_instance(TYPE);
}
~NAME() {
- if ($self) %delete($self);
+ %delete($self);
}
}
@@ -105,7 +105,7 @@ typedef struct {
%define %pointer_functions(TYPE,NAME)
%{
- static TYPE *new_##NAME() {
+ static TYPE *new_##NAME(void) {
return %new_instance(TYPE);
}
@@ -114,7 +114,7 @@ typedef struct {
}
static void delete_##NAME(TYPE *obj) {
- if (obj) %delete(obj);
+ %delete(obj);
}
static void NAME ##_assign(TYPE *obj, TYPE value) {
@@ -126,7 +126,7 @@ typedef struct {
}
%}
-TYPE *new_##NAME();
+TYPE *new_##NAME(void);
TYPE *copy_##NAME(TYPE value);
void delete_##NAME(TYPE *obj);
void NAME##_assign(TYPE *obj, TYPE value);
diff --git a/Lib/typemaps/cstrings.swg b/Lib/typemaps/cstrings.swg
index 0aca61101..7a7e2c1f9 100644
--- a/Lib/typemaps/cstrings.swg
+++ b/Lib/typemaps/cstrings.swg
@@ -50,7 +50,7 @@
*
* %cstring_bounded_output(Char *outx, 512);
* void foo(Char *outx) {
- * sprintf(outx,"blah blah\n");
+ * strcpy(outx,"blah blah\n");
* }
*
*/
@@ -59,7 +59,7 @@
%typemap(in,noblock=1,numinputs=0) TYPEMAP (Char temp[MAX+1]) {
$1 = ($1_ltype) temp;
}
-%typemap(freearg,match="in") TYPEMAP "";
+%typemap(freearg,match="in") TYPEMAP ""
%typemap(argout,noblock=1,fragment= #SWIG_FromCharPtr ) TYPEMAP {
$1[MAX] = 0;
%append_output(SWIG_FromCharPtr($1));
@@ -85,7 +85,7 @@
%typemap(in,noblock=1,numinputs=0) TYPEMAP(Char temp[SIZE]) {
$1 = ($1_ltype) temp;
}
-%typemap(freearg,match="in") TYPEMAP "";
+%typemap(freearg,match="in") TYPEMAP ""
%typemap(argout,noblock=1,fragment= #SWIG_FromCharPtrAndSize) TYPEMAP {
%append_output(SWIG_FromCharPtrAndSize($1,SIZE));
}
@@ -122,7 +122,7 @@
temp[n - 1] = 0;
$1 = ($1_ltype) temp;
}
-%typemap(freearg,match="in") TYPEMAP "";
+%typemap(freearg,match="in") TYPEMAP ""
%typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP {
$1[MAX] = 0;
%append_output(SWIG_FromCharPtr($1));
@@ -160,7 +160,7 @@
if (alloc == SWIG_NEWOBJ) %delete_array(t);
$1[n-1] = 0;
}
-%typemap(freearg,match="in") TYPEMAP "";
+%typemap(freearg,match="in") TYPEMAP ""
%typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP {
%append_output(SWIG_FromCharPtr($1));
%delete_array($1);
@@ -175,7 +175,7 @@
*
* %cstring_output_maxsize(Char *outx, int max) {
* void foo(Char *outx, int max) {
- * sprintf(outx,"blah blah\n");
+ * strcpy(outx,"blah blah\n");
* }
*/
@@ -205,7 +205,7 @@
*
* %cstring_output_withsize(Char *outx, int *max) {
* void foo(Char *outx, int *max) {
- * sprintf(outx,"blah blah\n");
+ * strcpy(outx,"blah blah\n");
* *max = strlen(outx);
* }
*/
@@ -239,7 +239,7 @@
* %cstring_output_allocate(Char **outx, free($1));
* void foo(Char **outx) {
* *outx = (Char *) malloc(512);
- * sprintf(outx,"blah blah\n");
+ * strcpy(outx,"blah blah\n");
* }
*/
@@ -247,7 +247,7 @@
%typemap(in,noblock=1,numinputs=0) TYPEMAP($*1_ltype temp = 0) {
$1 = &temp;
}
-%typemap(freearg,match="in") TYPEMAP "";
+%typemap(freearg,match="in") TYPEMAP ""
%typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP {
if (*$1) {
%append_output(SWIG_FromCharPtr(*$1));
@@ -266,7 +266,7 @@
* %cstring_output_allocate_size(Char **outx, int *sz, free($1));
* void foo(Char **outx, int *sz) {
* *outx = (Char *) malloc(512);
- * sprintf(outx,"blah blah\n");
+ * strcpy(outx,"blah blah\n");
* *sz = strlen(outx);
* }
*/
@@ -275,7 +275,7 @@
%typemap(in,noblock=1,numinputs=0) (TYPEMAP, SIZE) ($*1_ltype temp = 0, $*2_ltype tempn) {
$1 = &temp; $2 = &tempn;
}
-%typemap(freearg,match="in") (TYPEMAP,SIZE) "";
+%typemap(freearg,match="in") (TYPEMAP,SIZE) ""
%typemap(argout,noblock=1,fragment=#SWIG_FromCharPtrAndSize)(TYPEMAP,SIZE) {
if (*$1) {
%append_output(SWIG_FromCharPtrAndSize(*$1,*$2));
diff --git a/Lib/typemaps/enumint.swg b/Lib/typemaps/enumint.swg
index d048bb6bf..b7e2956a2 100644
--- a/Lib/typemaps/enumint.swg
+++ b/Lib/typemaps/enumint.swg
@@ -29,7 +29,7 @@
%typemap(varin,fragment=SWIG_AsVal_frag(int),noblock=1) enum SWIGTYPE {
if (sizeof(int) != sizeof($1)) {
%variable_fail(SWIG_AttributeError,"$type", "arch, read-only $name");
- } else {
+ } else {
int ecode = SWIG_AsVal(int)($input, %reinterpret_cast(&$1,int*));
if (!SWIG_IsOK(ecode)) {
%variable_fail(ecode, "$type", "$name");
diff --git a/Lib/typemaps/exception.swg b/Lib/typemaps/exception.swg
index b60a32996..aece8326f 100644
--- a/Lib/typemaps/exception.swg
+++ b/Lib/typemaps/exception.swg
@@ -19,6 +19,7 @@
#endif
#define %varnullref_fmt(_type,_name) %nullref_fmt() %varfail_fmt(_type, _name)
#define %outnullref_fmt(_type) %nullref_fmt() %outfail_fmt(_type)
+#define %releasenotownedfail_fmt(_type,_name,_argn) "in method '" `_name` "', cannot release ownership as memory is not owned for argument " `_argn`" of type '" `_type`"'"
/* setting an error */
#define %error(code,msg...) SWIG_Error(code, msg)
@@ -30,7 +31,7 @@
%define_as(SWIG_exception_fail(code, msg), %block(%error(code, msg); SWIG_fail))
-%define_as(SWIG_contract_assert(expr, msg), if (!(expr)) { %error(SWIG_RuntimeError, msg); SWIG_fail; } else)
+%define_as(SWIG_contract_assert(expr, msg), do { if (!(expr)) { %error(SWIG_RuntimeError, msg); SWIG_fail; } } while (0))
}
diff --git a/Lib/typemaps/fragments.swg b/Lib/typemaps/fragments.swg
index e83f415c4..e76a694ee 100644
--- a/Lib/typemaps/fragments.swg
+++ b/Lib/typemaps/fragments.swg
@@ -120,10 +120,6 @@ inline int SWIG_isfinite_func(T x) {
# define SWIG_isfinite(X) (SWIG_isfinite_func(X))
# elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
# define SWIG_isfinite(X) (__builtin_isfinite(X))
-# elif defined(__clang__) && defined(__has_builtin)
-# if __has_builtin(__builtin_isfinite)
-# define SWIG_isfinite(X) (__builtin_isfinite(X))
-# endif
# elif defined(_MSC_VER)
# define SWIG_isfinite(X) (_finite(X))
# elif defined(__sun) && defined(__SVR4)
diff --git a/Lib/typemaps/implicit.swg b/Lib/typemaps/implicit.swg
index 2fc3108e7..5536e0a22 100644
--- a/Lib/typemaps/implicit.swg
+++ b/Lib/typemaps/implicit.swg
@@ -27,7 +27,7 @@
get(2.0) ==> get(A(2.0))
get(B()) ==> get(A(B()))
- and swig will construct an 'A' temporal variable using the
+ and swig will construct an 'A' temporary variable using the
corresponding implicit constructor.
diff --git a/Lib/typemaps/inoutlist.swg b/Lib/typemaps/inoutlist.swg
index 23fda85f3..6c7604a99 100644
--- a/Lib/typemaps/inoutlist.swg
+++ b/Lib/typemaps/inoutlist.swg
@@ -221,10 +221,6 @@ this :
x = neg(x)
-Note : previous versions of SWIG used the symbol 'BOTH' to mark
-input/output arguments. This is still supported, but will be slowly
-phased out in future releases.
-
*/
%define %_value_inout_typemap(Type)
diff --git a/Lib/typemaps/primtypes.swg b/Lib/typemaps/primtypes.swg
index dd80eb775..85a0b8d9b 100644
--- a/Lib/typemaps/primtypes.swg
+++ b/Lib/typemaps/primtypes.swg
@@ -252,9 +252,11 @@ SWIGINTERNINLINE int
SWIG_CanCastAsInteger(double *d, double min, double max) {
double x = *d;
if ((min <= x && x <= max)) {
- double fx = floor(x);
- double cx = ceil(x);
- double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+ double fx, cx, rd;
+ errno = 0;
+ fx = floor(x);
+ cx = ceil(x);
+ rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
if ((errno == EDOM) || (errno == ERANGE)) {
errno = 0;
} else {
diff --git a/Lib/typemaps/ptrtypes.swg b/Lib/typemaps/ptrtypes.swg
index e8439e6dc..8619b3180 100644
--- a/Lib/typemaps/ptrtypes.swg
+++ b/Lib/typemaps/ptrtypes.swg
@@ -35,7 +35,7 @@
$1 = *ptr;
if (SWIG_IsNewObj(res)) %delete(ptr);
}
- %typemap(freearg) Type "";
+ %typemap(freearg) Type ""
%typemap(in,fragment=frag) const Type & (int res = SWIG_OLDOBJ) {
Type *ptr = (Type *)0;
res = asptr_meth($input, &ptr);
@@ -184,13 +184,33 @@
%enddef
/*---------------------------------------------------------------------
+ * typemap definition for types with from method for ptr types
+ * Same as typemaps_from but without varout typemap
+ *---------------------------------------------------------------------*/
+
+%define %ptr_typemaps_from(FromMeth, FromFrag, Type...)
+ %value_out_typemap(%arg(FromMeth), %arg(FromFrag), Type);
+ /* No varout typemap */
+ %value_constcode_typemap(%arg(FromMeth), %arg(FromFrag), Type);
+ %value_directorin_typemap(%arg(FromMeth), %arg(FromFrag), Type);
+ %value_throws_typemap(%arg(FromMeth), %arg(FromFrag), Type);
+ %value_output_typemap(%arg(FromMeth), %arg(FromFrag), Type);
+%enddef
+
+/*---------------------------------------------------------------------
* typemap definition for types with asptr/from methods
*---------------------------------------------------------------------*/
%define %typemaps_asptrfrom(CheckCode, AsPtrMeth, FromMeth, AsPtrFrag, FromFrag, Type...)
%typemaps_asptr(%arg(CheckCode), %arg(AsPtrMeth), %arg(AsPtrFrag), Type)
+ %ptr_typemaps_from(%arg(FromMeth), %arg(FromFrag), Type);
+ %ptr_inout_typemap(Type);
+%enddef
+
+// Same as typemaps_asptrfrom but defines a varout typemap to wrap with value semantics instead of the default pointer semantics
+%define %_typemaps_asptrfrom(CheckCode, AsPtrMeth, FromMeth, AsPtrFrag, FromFrag, Type...)
+ %typemaps_asptr(%arg(CheckCode), %arg(AsPtrMeth), %arg(AsPtrFrag), Type)
%typemaps_from(%arg(FromMeth), %arg(FromFrag), Type);
- %value_output_typemap(%arg(FromMeth), %arg(FromFrag), Type);
%ptr_inout_typemap(Type);
%enddef
@@ -199,7 +219,7 @@
*---------------------------------------------------------------------*/
%define %typemaps_asptrfromn(CheckCode, Type...)
-%typemaps_asptrfrom(%arg(CheckCode),
+%_typemaps_asptrfrom(%arg(CheckCode),
%arg(SWIG_AsPtr(Type)),
%arg(SWIG_From(Type)),
%arg(SWIG_AsPtr_frag(Type)),
diff --git a/Lib/typemaps/std_string_view.swg b/Lib/typemaps/std_string_view.swg
new file mode 100644
index 000000000..24f57c6c0
--- /dev/null
+++ b/Lib/typemaps/std_string_view.swg
@@ -0,0 +1,16 @@
+//
+// string_view
+//
+
+
+%include <typemaps/std_strings.swg>
+
+%fragment("<string_view>");
+
+namespace std
+{
+ %naturalvar string_view;
+ class string_view;
+}
+
+%typemaps_std_string_view(std::string_view, char, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, %checkcode(STRINGVIEW));
diff --git a/Lib/typemaps/std_strings.swg b/Lib/typemaps/std_strings.swg
index e9c23ba91..842545826 100644
--- a/Lib/typemaps/std_strings.swg
+++ b/Lib/typemaps/std_strings.swg
@@ -45,6 +45,16 @@ SWIG_From_dec(String)(const String& s)
}
%enddef
+%define %std_string_view_from(String, SWIG_FromCharPtrAndSize, Frag)
+%fragment(SWIG_From_frag(String),"header",fragment=Frag) {
+SWIGINTERNINLINE SWIG_Object
+SWIG_From_dec(String)(const String& s)
+{
+ return SWIG_FromCharPtrAndSize(s.data() ? s.data() : "", s.size());
+}
+}
+%enddef
+
%define %std_string_asval(String)
%fragment(SWIG_AsVal_frag(String),"header", fragment=SWIG_AsPtr_frag(String)) {
SWIGINTERN int
@@ -76,3 +86,18 @@ SWIG_AsVal_dec(String)(SWIG_Object obj, String *val)
%typemaps_asptrfromn(%arg(CheckCode), String);
%enddef
+
+
+/* An empty string_view returns NULL from data() but SWIG_FromCharPtrAndSize()
+ * implementations treat that as invalid and return None/Null/undef or similar
+ * in the target language so we can't just use %typemaps_std_string.
+ */
+%define %typemaps_std_string_view(String, Char, AsPtrMethod, FromMethod, CheckCode)
+
+%std_string_asptr(String, Char, AsPtrMethod, #AsPtrMethod)
+%std_string_asval(String)
+%std_string_view_from(String, FromMethod, #FromMethod)
+
+%typemaps_asptrfromn(%arg(CheckCode), String);
+
+%enddef
diff --git a/Lib/typemaps/string.swg b/Lib/typemaps/string.swg
index 4b7072365..72f4aa5b5 100644
--- a/Lib/typemaps/string.swg
+++ b/Lib/typemaps/string.swg
@@ -30,6 +30,7 @@ SWIG_strnlen(const char* s, size_t maxlen)
%include <typemaps/strings.swg>
%typemaps_string(%checkcode(STRING), %checkcode(CHAR),
+ SWIGWARN_TYPEMAP_CHARLEAK_MSG,
char, Char, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize,
strlen, SWIG_strnlen,
"<limits.h>", CHAR_MIN, CHAR_MAX)
diff --git a/Lib/typemaps/strings.swg b/Lib/typemaps/strings.swg
index 87e97dd74..1237d98df 100644
--- a/Lib/typemaps/strings.swg
+++ b/Lib/typemaps/strings.swg
@@ -19,6 +19,7 @@
%define %_typemap_string(StringCode,
Char,
+ WarningLeakMsg,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
SWIG_CharPtrLen,
@@ -78,7 +79,7 @@
if (!SWIG_IsOK(res)) {
%variable_fail(res,"$type","$name");
}
- if ($1) SWIG_DeleteCharArray($1);
+ SWIG_DeleteCharArray($1);
if (alloc == SWIG_NEWOBJ) {
$1 = cptr;
} else {
@@ -86,7 +87,7 @@
}
}
-%typemap(varin,fragment=#SWIG_AsCharPtrAndSize,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * {
+%typemap(varin,fragment=#SWIG_AsCharPtrAndSize,warning=WarningLeakMsg) const Char * {
Char *cptr = 0; size_t csize = 0; int alloc = SWIG_NEWOBJ;
int res = SWIG_AsCharPtrAndSize($input, &cptr, &csize, &alloc);
if (!SWIG_IsOK(res)) {
@@ -108,7 +109,7 @@
/* memberin */
%typemap(memberin,noblock=1) Char * {
- if ($1) SWIG_DeleteCharArray($1);
+ SWIG_DeleteCharArray($1);
if ($input) {
size_t size = SWIG_CharPtrLen(%reinterpret_cast($input, const Char *)) + 1;
$1 = ($1_type)SWIG_NewCopyCharArray(%reinterpret_cast($input, const Char *), size, Char);
@@ -117,7 +118,7 @@
}
}
-%typemap(memberin,noblock=1,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * {
+%typemap(memberin,noblock=1,warning=WarningLeakMsg) const Char * {
if ($input) {
size_t size = SWIG_CharPtrLen(%reinterpret_cast(%reinterpret_cast($input, const Char *), const Char *)) + 1;
$1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char);
@@ -129,7 +130,7 @@
/* globalin */
%typemap(globalin,noblock=1) Char * {
- if ($1) SWIG_DeleteCharArray($1);
+ SWIG_DeleteCharArray($1);
if ($input) {
size_t size = SWIG_CharPtrLen(%reinterpret_cast(%reinterpret_cast($input, const Char *), const Char *)) + 1;
$1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char);
@@ -138,7 +139,7 @@
}
}
-%typemap(globalin,noblock=1,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * {
+%typemap(globalin,noblock=1,warning=WarningLeakMsg) const Char * {
if ($input) {
size_t size = SWIG_CharPtrLen($input) + 1;
$1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char);
@@ -265,7 +266,7 @@
}
$1 = %reinterpret_cast(temp, $1_ltype);
}
-%typemap(freearg) Char [ANY], const Char [ANY] "";
+%typemap(freearg) Char [ANY], const Char [ANY] ""
%typemap(in,noblock=1,fragment=#SWIG_AsCharArray) const Char (&)[ANY] (Char temp[$1_dim0], int res)
{
@@ -275,7 +276,7 @@
}
$1 = &temp;
}
-%typemap(freearg) const Char (&)[ANY] "";
+%typemap(freearg) const Char (&)[ANY] ""
%typemap(out,fragment=#SWIG_FromCharPtrAndSize,fragment=#SWIG_CharBufLen)
Char [ANY], const Char[ANY]
@@ -501,6 +502,7 @@
#ifndef %_typemap2_string
%define %_typemap2_string(StringCode, CharCode,
+ WarningLeakMsg,
Char, CharName,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
@@ -591,6 +593,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
%_typemap_string(StringCode,
Char,
+ WarningLeakMsg,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
SWIG_CharPtrLen,
@@ -609,6 +612,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
* ------------------------------------------------------------ */
%define %typemaps_string(StringCode, CharCode,
+ WarningLeakMsg,
Char, CharName,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
@@ -616,6 +620,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
SWIG_CharBufLen,
FragLimits, CHAR_MIN, CHAR_MAX)
%_typemap2_string(StringCode, CharCode,
+ WarningLeakMsg,
Char, CharName,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
@@ -631,6 +636,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
* ------------------------------------------------------------ */
%define %typemaps_string_alloc(StringCode, CharCode,
+ WarningLeakMsg,
Char, CharName,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
@@ -640,6 +646,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
SWIG_DeleteCharArray,
FragLimits, CHAR_MIN, CHAR_MAX)
%_typemap2_string(StringCode, CharCode,
+ WarningLeakMsg,
Char, CharName,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
diff --git a/Lib/typemaps/swigmacros.swg b/Lib/typemaps/swigmacros.swg
index 687b0680e..b772eb04b 100644
--- a/Lib/typemaps/swigmacros.swg
+++ b/Lib/typemaps/swigmacros.swg
@@ -109,16 +109,6 @@ nocppval
#endif
%enddef
-/* insert the SWIGVERSION in the interface and the wrapper code */
-#if SWIG_VERSION
-%insert("header") {
-%define_as(SWIGVERSION, SWIG_VERSION)
-%#define SWIG_VERSION SWIGVERSION
-}
-#endif
-
-
-
/* -----------------------------------------------------------------------------
* Casting operators
* ----------------------------------------------------------------------------- */
diff --git a/Lib/typemaps/swigmove.swg b/Lib/typemaps/swigmove.swg
new file mode 100644
index 000000000..b0a296850
--- /dev/null
+++ b/Lib/typemaps/swigmove.swg
@@ -0,0 +1,19 @@
+/* -----------------------------------------------------------------------------
+ * swigmove.swg
+ *
+ * Input typemaps library for implementing full move semantics when passing
+ * parameters by value.
+ * ----------------------------------------------------------------------------- */
+
+%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "$1_type", $symname, $argnum);
+ } else {
+ %argument_fail(res, "$1_type", $symname, $argnum);
+ }
+ }
+ if (!argp) { %argument_nullref("$1_type", $symname, $argnum); }
+ SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp);
+}
diff --git a/Lib/typemaps/swigobject.swg b/Lib/typemaps/swigobject.swg
index b1e6dc9d8..26c6ba8ed 100644
--- a/Lib/typemaps/swigobject.swg
+++ b/Lib/typemaps/swigobject.swg
@@ -2,7 +2,7 @@
* Language Object * - Just pass straight through unmodified
* ------------------------------------------------------------ */
-%typemap(in) SWIG_Object "$1 = $input;";
+%typemap(in) SWIG_Object "$1 = $input;"
%typemap(in,noblock=1) SWIG_Object const & ($*ltype temp)
{
@@ -30,8 +30,8 @@
#if defined(SWIG_DIRECTOR_TYPEMAPS)
-%typemap(directorin) SWIG_Object "$input = $1;";
-%typemap(directorout) SWIG_Object "$result = $input;";
+%typemap(directorin) SWIG_Object "$input = $1;"
+%typemap(directorout) SWIG_Object "$result = $input;"
#endif /* SWIG_DIRECTOR_TYPEMAPS */
diff --git a/Lib/typemaps/swigtype.swg b/Lib/typemaps/swigtype.swg
index 581de1a90..ba8ce3c1f 100644
--- a/Lib/typemaps/swigtype.swg
+++ b/Lib/typemaps/swigtype.swg
@@ -9,7 +9,7 @@
}
$1 = %reinterpret_cast(argp, $ltype);
}
-%typemap(freearg) SWIGTYPE * "";
+%typemap(freearg) SWIGTYPE * ""
%typemap(in, noblock=1) SWIGTYPE [] (void *argp = 0, int res = 0) {
res = SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags);
@@ -18,7 +18,7 @@
}
$1 = %reinterpret_cast(argp, $ltype);
}
-%typemap(freearg) SWIGTYPE [] "";
+%typemap(freearg) SWIGTYPE [] ""
%typemap(in, noblock=1) SWIGTYPE *const& (void *argp = 0, int res = 0, $*1_ltype temp) {
@@ -29,7 +29,7 @@
temp = %reinterpret_cast(argp, $*ltype);
$1 = %reinterpret_cast(&temp, $1_ltype);
}
-%typemap(freearg) SWIGTYPE *const& "";
+%typemap(freearg) SWIGTYPE *const& ""
/* Reference */
@@ -41,7 +41,7 @@
if (!argp) { %argument_nullref("$type", $symname, $argnum); }
$1 = %reinterpret_cast(argp, $ltype);
}
-%typemap(freearg) SWIGTYPE & "";
+%typemap(freearg) SWIGTYPE & ""
#if defined(__cplusplus) && defined(%implicitconv_flag)
%typemap(in,noblock=1,implicitconv=1) const SWIGTYPE & (void *argp = 0, int res = 0) {
@@ -56,51 +56,23 @@
{
if (SWIG_IsNewObj(res$argnum)) %delete($1);
}
-#else
-%typemap(in,noblock=1) const SWIGTYPE & (void *argp, int res = 0) {
- res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags);
- if (!SWIG_IsOK(res)) {
- %argument_fail(res, "$type", $symname, $argnum);
- }
- if (!argp) { %argument_nullref("$type", $symname, $argnum); }
- $1 = %reinterpret_cast(argp, $ltype);
-}
#endif
/* Rvalue reference */
-%typemap(in, noblock=1) SWIGTYPE && (void *argp = 0, int res = 0) {
- res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags);
+%typemap(in, noblock=1, fragment="<memory>") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor, SWIG_POINTER_RELEASE | %convertptr_flags);
if (!SWIG_IsOK(res)) {
- %argument_fail(res, "$type", $symname, $argnum);
- }
- if (!argp) { %argument_nullref("$type", $symname, $argnum); }
- $1 = %reinterpret_cast(argp, $ltype);
-}
-%typemap(freearg) SWIGTYPE && "";
-
-#if defined(__cplusplus) && defined(%implicitconv_flag)
-%typemap(in,noblock=1,implicitconv=1) const SWIGTYPE && (void *argp = 0, int res = 0) {
- res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags | %implicitconv_flag);
- if (!SWIG_IsOK(res)) {
- %argument_fail(res, "$type", $symname, $argnum);
- }
- if (!argp) { %argument_nullref("$type", $symname, $argnum); }
- $1 = %reinterpret_cast(argp, $ltype);
-}
-%typemap(freearg,noblock=1,match="in",implicitconv=1) const SWIGTYPE &&
-{
- if (SWIG_IsNewObj(res$argnum)) %delete($1);
-}
-#else
-%typemap(in,noblock=1) const SWIGTYPE && (void *argp, int res = 0) {
- res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags);
- if (!SWIG_IsOK(res)) {
- %argument_fail(res, "$type", $symname, $argnum);
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "$type", $symname, $argnum);
+ } else {
+ %argument_fail(res, "$type", $symname, $argnum);
+ }
}
if (!argp) { %argument_nullref("$type", $symname, $argnum); }
$1 = %reinterpret_cast(argp, $ltype);
+ rvrdeleter.reset($1);
}
-#endif
+%typemap(freearg) SWIGTYPE && ""
/* By value */
#if defined(__cplusplus) && defined(%implicitconv_flag)
@@ -146,9 +118,15 @@
}
/* Return by value */
+#ifdef __cplusplus
%typemap(out, noblock=1) SWIGTYPE {
- %set_output(SWIG_NewPointerObj(%new_copy($1, $ltype), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags));
+ %set_output(SWIG_NewPointerObj((new $1_ltype($1)), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags));
}
+#else
+%typemap(out, noblock=1) SWIGTYPE {
+ %set_output(SWIG_NewPointerObj(%new_copy($1, $1_ltype), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags));
+}
+#endif
/* -----------------------------------------------------------------------------
* --- Variable input ---
@@ -194,12 +172,8 @@
if ($input) {
size_t ii = 0;
for (; ii < (size_t)$1_dim0; ++ii) {
- if ($input[ii]) {
- size_t jj = 0;
- for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = $input[ii][jj];
- } else {
- %variable_nullref("$type","$name");
- }
+ size_t jj = 0;
+ for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = $input[ii][jj];
}
} else {
%variable_nullref("$type","$name");
@@ -210,12 +184,8 @@
if ($input) {
size_t ii = 0;
for (; ii < (size_t)$1_dim0; ++ii) {
- if ($input[ii]) {
- size_t jj = 0;
- for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = $input[ii][jj];
- } else {
- %variable_nullref("$type","$name");
- }
+ size_t jj = 0;
+ for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = $input[ii][jj];
}
} else {
%variable_nullref("$type","$name");
@@ -230,12 +200,8 @@
} else if (inp) {
size_t ii = 0;
for (; ii < (size_t)$1_dim0; ++ii) {
- if (inp[ii]) {
- size_t jj = 0;
- for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = inp[ii][jj];
- } else {
- %variable_nullref("$type", "$name");
- }
+ size_t jj = 0;
+ for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = inp[ii][jj];
}
} else {
%variable_nullref("$type", "$name");
@@ -389,6 +355,7 @@
int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL);
$1 = SWIG_CheckState(res);
}
+
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) const SWIGTYPE && {
void *vptr = 0;
int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL);
@@ -411,7 +378,7 @@
/* directorin */
%typemap(directorin,noblock=1) SWIGTYPE {
- $input = SWIG_NewPointerObj(%as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags);
+ $input = SWIG_NewPointerObj((new $1_ltype(SWIG_STD_MOVE($1))), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags);
}
%typemap(directorin,noblock=1) SWIGTYPE * {
@@ -534,7 +501,7 @@
* ------------------------------------------------------------ */
%typemap(throws,noblock=1) SWIGTYPE {
- %raise(SWIG_NewPointerObj(%new_copy($1, $ltype),$&descriptor,SWIG_POINTER_OWN), "$type", $&descriptor);
+ %raise(SWIG_NewPointerObj(%new_copy($1, $1_ltype),$&descriptor,SWIG_POINTER_OWN), "$type", $&descriptor);
}
%typemap(throws,noblock=1) SWIGTYPE * {
@@ -562,29 +529,29 @@
* ------------------------------------------------------------ */
%typemap(in) SWIGTYPE (CLASS::*) {
- int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($type),$descriptor);
+ int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($1),$descriptor);
if (!SWIG_IsOK(res)) {
%argument_fail(res,"$type",$symname, $argnum);
}
}
%typemap(out,noblock=1) SWIGTYPE (CLASS::*) {
- %set_output(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor));
+ %set_output(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor));
}
%typemap(varin) SWIGTYPE (CLASS::*) {
- int res = SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($type), $descriptor);
+ int res = SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($1), $descriptor);
if (!SWIG_IsOK(res)) {
%variable_fail(res, "$type", "$name");
}
}
%typemap(varout,noblock=1) SWIGTYPE (CLASS::*) {
- %set_varoutput(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor));
+ %set_varoutput(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor));
}
%typemap(constcode,noblock=1) SWIGTYPE (CLASS::*) {
- %set_constant("$symname", SWIG_NewMemberObj(%as_voidptr(&$value), sizeof($type), $descriptor));
+ %set_constant("$symname", SWIG_NewMemberObj(%as_voidptr(&$value), sizeof($value), $descriptor));
}
#if defined(SWIG_DIRECTOR_TYPEMAPS)
@@ -592,13 +559,13 @@
/* directorin */
%typemap(directorin,noblock=1) SWIGTYPE (CLASS::*) {
- $input = SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor);
+ $input = SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor);
}
/* directorout */
%typemap(directorout) SWIGTYPE (CLASS::*) {
- int swig_res = SWIG_ConvertMember($input,%as_voidptr(&$result), sizeof($type), $descriptor);
+ int swig_res = SWIG_ConvertMember($input,%as_voidptr(&$result), sizeof($result), $descriptor);
if (!SWIG_IsOK(swig_res)) {
%dirout_fail(swig_res,"$type");
}
@@ -703,9 +670,15 @@
/* INSTANCE typemap */
+#ifdef __cplusplus
+%typemap(out,noblock=1) SWIGTYPE INSTANCE {
+ %set_output(SWIG_NewInstanceObj((new $1_ltype($1)), $&1_descriptor, SWIG_POINTER_OWN | %newinstance_flags));
+}
+#else
%typemap(out,noblock=1) SWIGTYPE INSTANCE {
%set_output(SWIG_NewInstanceObj(%new_copy($1, $1_ltype), $&1_descriptor, SWIG_POINTER_OWN | %newinstance_flags));
}
+#endif
%typemap(out,noblock=1) SWIGTYPE *INSTANCE, SWIGTYPE &INSTANCE, SWIGTYPE INSTANCE[] {
%set_output(SWIG_NewInstanceObj(%as_voidptr($1), $1_descriptor, $owner | %newinstance_flags));
diff --git a/Lib/typemaps/swigtypemaps.swg b/Lib/typemaps/swigtypemaps.swg
index 4e5bb2b04..733e5acd0 100644
--- a/Lib/typemaps/swigtypemaps.swg
+++ b/Lib/typemaps/swigtypemaps.swg
@@ -140,6 +140,7 @@
#define %argument_nullref(type, name, argn) SWIG_exception_fail(SWIG_ValueError, %argnullref_fmt(type, name, argn))
#define %variable_fail(code, type, name) SWIG_exception_fail(%default_code(code), %varfail_fmt(type, name))
#define %variable_nullref(type, name) SWIG_exception_fail(SWIG_ValueError, %varnullref_fmt(type, name))
+#define %releasenotowned_fail(code, type, name, argn) SWIG_exception_fail(%default_code(code), %releasenotownedfail_fmt(type, name, argn))
#if defined(SWIG_DIRECTOR_TYPEMAPS)
#define %dirout_fail(code, type) SWIG_DirOutFail(%default_code(code), %outfail_fmt(type))
diff --git a/Lib/typemaps/typemaps.swg b/Lib/typemaps/typemaps.swg
index 4629e8dfa..7d013b045 100644
--- a/Lib/typemaps/typemaps.swg
+++ b/Lib/typemaps/typemaps.swg
@@ -140,10 +140,6 @@ to a Tcl variable you might do this :
x = neg(x)
-Note : previous versions of SWIG used the symbol 'BOTH' to mark
-input/output arguments. This is still supported, but will be slowly
-phased out in future releases.
-
*/
diff --git a/Lib/typemaps/valtypes.swg b/Lib/typemaps/valtypes.swg
index 11eac5985..7623ff049 100644
--- a/Lib/typemaps/valtypes.swg
+++ b/Lib/typemaps/valtypes.swg
@@ -38,7 +38,7 @@
}
$1 = %static_cast(val,$ltype);
}
- %typemap(freearg) Type "";
+ %typemap(freearg) Type ""
%typemap(in,noblock=1,fragment=frag) const Type & ($*ltype temp, Type val, int ecode = 0) {
ecode = asval_meth($input, &val);
if (!SWIG_IsOK(ecode)) {
@@ -47,7 +47,7 @@
temp = %static_cast(val, $*ltype);
$1 = &temp;
}
- %typemap(freearg) const Type& "";
+ %typemap(freearg) const Type& ""
%enddef
/* out */
@@ -180,6 +180,7 @@
/*---------------------------------------------------------------------
* typemap definition for types with from method
*---------------------------------------------------------------------*/
+
%define %typemaps_from(FromMeth, FromFrag, Type...)
%value_out_typemap(%arg(FromMeth), %arg(FromFrag), Type);
%value_varout_typemap(%arg(FromMeth), %arg(FromFrag), Type);
@@ -191,7 +192,7 @@
/*---------------------------------------------------------------------
- * typemap definition for types with alval/from method
+ * typemap definition for types with asval/from method
*---------------------------------------------------------------------*/
%define %typemaps_asvalfrom(CheckCode, AsValMeth, FromMeth,
diff --git a/Lib/typemaps/void.swg b/Lib/typemaps/void.swg
index bbd68ed87..795992bf4 100644
--- a/Lib/typemaps/void.swg
+++ b/Lib/typemaps/void.swg
@@ -10,7 +10,7 @@
%argument_fail(res, "$type", $symname, $argnum);
}
}
-%typemap(freearg) void * "";
+%typemap(freearg) void * ""
%typemap(in,noblock=1) void * const& ($*ltype temp = 0, int res) {
res = SWIG_ConvertPtr($input, %as_voidptrptr(&temp), 0, $disown);
@@ -19,7 +19,7 @@
}
$1 = &temp;
}
-%typemap(freearg) void * const& "";
+%typemap(freearg) void * const& ""
/* out */
diff --git a/Lib/typemaps/wstring.swg b/Lib/typemaps/wstring.swg
index cd409d1ce..d99c0bb38 100644
--- a/Lib/typemaps/wstring.swg
+++ b/Lib/typemaps/wstring.swg
@@ -31,6 +31,7 @@ SWIG_wcsnlen(const wchar_t* s, size_t maxlen)
%include <typemaps/strings.swg>
%typemaps_string(%checkcode(UNISTRING), %checkcode(UNICHAR),
+ SWIGWARN_TYPEMAP_WCHARLEAK_MSG,
wchar_t, WChar, SWIG_AsWCharPtrAndSize, SWIG_FromWCharPtrAndSize,
wcslen, SWIG_wcsnlen,
"<wchar.h>", WCHAR_MIN, WCHAR_MAX)