From 192e00615d35d5676fe64d6e532a432906648381 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Thu, 24 Feb 2005 23:48:20 +0000 Subject: [PATCH] More fix for warnings, and add some of the ideas of the Bill's 'labels' patch git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6998 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/exception.i | 16 +-- Lib/python/director_h.swg | 205 +++++++++++++++++----------------- Lib/python/file.i | 4 +- Lib/python/pyapi.swg | 4 +- Lib/python/pycomplex.swg | 2 +- Lib/python/pycontainer.swg | 3 +- Lib/python/pyfragments.swg | 2 +- Lib/python/pyinit.swg | 2 +- Lib/python/pyprimtypes.swg | 18 +-- Lib/python/pyptrtypes.swg | 4 +- Lib/python/pystdcommon.swg | 2 +- Lib/python/pystrings.swg | 4 +- Lib/python/pyvaltypes.swg | 4 +- Lib/python/pywstrings.swg | 2 +- Lib/python/std_basic_string.i | 4 +- Lib/python/std_string.i | 4 +- Lib/python/std_wstring.i | 4 +- Lib/swig.swg | 34 ++++++ 18 files changed, 177 insertions(+), 141 deletions(-) diff --git a/Lib/exception.i b/Lib/exception.i index 1129b3bbc..64dcf4717 100644 --- a/Lib/exception.i +++ b/Lib/exception.i @@ -46,7 +46,7 @@ #ifdef SWIGPYTHON %{ -static void SWIG_exception_(int code, const char *msg) { +SWIGINTERN void SWIG_exception_(int code, const char *msg) { switch(code) { case SWIG_MemoryError: PyErr_SetString(PyExc_MemoryError,msg); @@ -90,7 +90,7 @@ static void SWIG_exception_(int code, const char *msg) { #ifdef SWIGGUILE %{ - static void SWIG_exception_ (int code, const char *msg, + SWIGINTERN void SWIG_exception_ (int code, const char *msg, const char *subr) { #define ERROR(scmerr) \ scm_error(gh_symbol2scm((char *) (scmerr)), \ @@ -125,7 +125,7 @@ static void SWIG_exception_(int code, const char *msg) { #ifdef SWIGMZSCHEME %{ - static void SWIG_exception_ (int code, const char *msg) { +SWIGINTERN void SWIG_exception_ (int code, const char *msg) { #define ERROR(errname) \ scheme_signal_error(errname " (%s)", msg); #define MAP(swigerr, errname) \ @@ -156,7 +156,7 @@ static void SWIG_exception_(int code, const char *msg) { #ifdef SWIGJAVA %{ -static void SWIG_JavaException(JNIEnv *jenv, int code, const char *msg) { +SWIGINTERN void SWIG_JavaException(JNIEnv *jenv, int code, const char *msg) { SWIG_JavaExceptionCodes exception_code = SWIG_JavaUnknownError; switch(code) { case SWIG_MemoryError: @@ -195,7 +195,7 @@ static void SWIG_JavaException(JNIEnv *jenv, int code, const char *msg) { #ifdef SWIGOCAML %{ #define OCAML_MSG_BUF_LEN 1024 -static void SWIG_exception_(int code, const char *msg) { +SWIGINTERN void SWIG_exception_(int code, const char *msg) { char msg_buf[OCAML_MSG_BUF_LEN]; sprintf( msg_buf, "Exception(%d): %s\n", code, msg ); failwith( msg_buf ); @@ -206,7 +206,7 @@ static void SWIG_exception_(int code, const char *msg) { #ifdef SWIGRUBY %{ -static void SWIG_exception_(int code, const char *msg) { +SWIGINTERN void SWIG_exception_(int code, const char *msg) { switch (code) { case SWIG_MemoryError: rb_raise(rb_eNoMemError, msg); @@ -253,7 +253,7 @@ static void SWIG_exception_(int code, const char *msg) { #ifdef SWIGCHICKEN %{ #define CHICKEN_MSG_BUF_LEN 1024 -static void SWIG_exception_(int code, const char *msg) { +SWIGINTERN void SWIG_exception_(int code, const char *msg) { char msg_buf[CHICKEN_MSG_BUF_LEN]; C_word *a; C_word scmmsg; @@ -270,7 +270,7 @@ static void SWIG_exception_(int code, const char *msg) { #ifdef SWIGCSHARP %{ -static void SWIG_CSharpException(int code, const char *msg) { +SWIGINTERN void SWIG_CSharpException(int code, const char *msg) { if (code == SWIG_ValueError) { SWIG_CSharpExceptionArgumentCodes exception_code = SWIG_CSharpArgumentOutOfRangeException; SWIG_CSharpSetPendingExceptionArgument(exception_code, msg, 0); diff --git a/Lib/python/director_h.swg b/Lib/python/director_h.swg index c90e9c084..7913a2408 100644 --- a/Lib/python/director_h.swg +++ b/Lib/python/director_h.swg @@ -25,28 +25,29 @@ extern "C" { namespace Swig { /* base class for director exceptions */ class DirectorException { - protected: - std::string swig_msg; - public: - DirectorException(const char* msg="") { - } - const char *getMessage() const { - return swig_msg.c_str(); - } - virtual ~DirectorException(); - + protected: + std::string swig_msg; + public: + DirectorException(const char* /* msg */ ="") { + } + + const char *getMessage() const { + return swig_msg.c_str(); + } + + virtual ~DirectorException(); }; /* type mismatch in the return value from a python method call */ class DirectorTypeMismatchException : public Swig::DirectorException { - public: - DirectorTypeMismatchException(const char* msg="") { - if (!PyErr_Occurred()) { - swig_msg = "Swig director type mismatch: "; - swig_msg += msg; - PyErr_SetString(PyExc_TypeError, getMessage()); - } + public: + DirectorTypeMismatchException(const char* msg="") { + if (!PyErr_Occurred()) { + swig_msg = "Swig director type mismatch: "; + swig_msg += msg; + PyErr_SetString(PyExc_TypeError, getMessage()); } + } }; /* any python exception that occurs during a director method call */ @@ -73,116 +74,116 @@ namespace Swig { /* director base class */ class Director { - private: - /* pointer to the wrapped python object */ - PyObject* swig_self; - /* flag indicating whether the object is owned by python or c++ */ - mutable bool swig_disown_flag; - /* shared flag for breaking recursive director calls */ - static bool swig_up; + private: + /* pointer to the wrapped python object */ + PyObject* swig_self; + /* flag indicating whether the object is owned by python or c++ */ + mutable bool swig_disown_flag; + /* shared flag for breaking recursive director calls */ + static bool swig_up; #ifdef __PTHREAD__ - /* locks for sharing the swig_up flag in a threaded environment */ - static pthread_mutex_t swig_mutex_up; - static bool swig_mutex_active; - static pthread_t swig_mutex_thread; + /* locks for sharing the swig_up flag in a threaded environment */ + static pthread_mutex_t swig_mutex_up; + static bool swig_mutex_active; + static pthread_t swig_mutex_thread; #endif - /* decrement the reference count of the wrapped python object */ - void swig_decref() const { - if (swig_disown_flag) { - Py_DECREF(swig_self); - } + /* decrement the reference count of the wrapped python object */ + void swig_decref() const { + if (swig_disown_flag) { + Py_DECREF(swig_self); } + } - /* reset the swig_up flag once the routing direction has been determined */ + /* reset the swig_up flag once the routing direction has been determined */ #ifdef __PTHREAD__ - void swig_clear_up() const { - Swig::Director::swig_up = false; - Swig::Director::swig_mutex_active = false; - pthread_mutex_unlock(&swig_mutex_up); - } + void swig_clear_up() const { + Swig::Director::swig_up = false; + Swig::Director::swig_mutex_active = false; + pthread_mutex_unlock(&swig_mutex_up); + } #else - void swig_clear_up() const { - Swig::Director::swig_up = false; - } + void swig_clear_up() const { + Swig::Director::swig_up = false; + } #endif - public: - /* wrap a python object, optionally taking ownership */ - Director(PyObject* self) : swig_self(self), swig_disown_flag(false) { - swig_incref(); - } + public: + /* wrap a python object, optionally taking ownership */ + Director(PyObject* self) : swig_self(self), swig_disown_flag(false) { + swig_incref(); + } - /* discard our reference at destruction */ - virtual ~Director(); + /* discard our reference at destruction */ + virtual ~Director(); - /* return a pointer to the wrapped python object */ - PyObject *swig_get_self() const { - return swig_self; - } + /* return a pointer to the wrapped python object */ + PyObject *swig_get_self() const { + return swig_self; + } - /* get the swig_up flag to determine if the method call should be routed - * to the c++ base class or through the wrapped python object - */ + /* get the swig_up flag to determine if the method call should be routed + * to the c++ base class or through the wrapped python object + */ #ifdef __PTHREAD__ - bool swig_get_up() const { - if (Swig::Director::swig_mutex_active) { - if (pthread_equal(Swig::Director::swig_mutex_thread, pthread_self())) { - bool up = swig_up; - swig_clear_up(); - return up; - } - } - return 0; + bool swig_get_up() const { + if (Swig::Director::swig_mutex_active) { + if (pthread_equal(Swig::Director::swig_mutex_thread, pthread_self())) { + bool up = swig_up; + swig_clear_up(); + return up; + } } + return 0; + } #else - bool swig_get_up() const { - bool up = swig_up; - swig_up = false; - return up; - } + bool swig_get_up() const { + bool up = swig_up; + swig_up = false; + return up; + } #endif - /* set the swig_up flag if the next method call should be directed to - * the c++ base class rather than the wrapped python object - */ + /* set the swig_up flag if the next method call should be directed to + * the c++ base class rather than the wrapped python object + */ #ifdef __PTHREAD__ - void swig_set_up() const { - pthread_mutex_lock(&Swig::Director::swig_mutex_up); - Swig::Director::swig_mutex_thread = pthread_self(); - Swig::Director::swig_mutex_active = true; - Swig::Director::swig_up = true; - } + void swig_set_up() const { + pthread_mutex_lock(&Swig::Director::swig_mutex_up); + Swig::Director::swig_mutex_thread = pthread_self(); + Swig::Director::swig_mutex_active = true; + Swig::Director::swig_up = true; + } #else - void swig_set_up() const { - Swig::Director::swig_up = true; - } + void swig_set_up() const { + Swig::Director::swig_up = true; + } #endif - /* acquire ownership of the wrapped python object (the sense of "disown" - * is from python) */ - void swig_disown() const { - if (!swig_disown_flag) { - swig_disown_flag=true; - swig_incref(); - } - } + /* acquire ownership of the wrapped python object (the sense of "disown" + * is from python) */ + void swig_disown() const { + if (!swig_disown_flag) { + swig_disown_flag=true; + swig_incref(); + } + } - /* increase the reference count of the wrapped python object */ - void swig_incref() const { - if (swig_disown_flag) { - Py_INCREF(swig_self); - } + /* increase the reference count of the wrapped python object */ + void swig_incref() const { + if (swig_disown_flag) { + Py_INCREF(swig_self); } + } - /* methods to implement pseudo protected director members */ - virtual bool swig_get_inner(const char* name) const { - return true; - } - - virtual void swig_set_inner(const char* name, bool val) const { - } + /* methods to implement pseudo protected director members */ + virtual bool swig_get_inner(const char* /* name */) const { + return true; + } + + virtual void swig_set_inner(const char* /* name */, bool /* val */) const { + } }; } diff --git a/Lib/python/file.i b/Lib/python/file.i index e9ceacd57..03b03fe7f 100644 --- a/Lib/python/file.i +++ b/Lib/python/file.i @@ -28,7 +28,7 @@ SWIG_AsValFilePtr(PyObject *obj, FILE **val) { } %fragment("SWIG_AsFilePtr","header",fragment="SWIG_AsValFilePtr") { -SWIGINTERNSHORT FILE* +SWIGINTERNINLINE FILE* SWIG_AsFilePtr(PyObject *obj) { FILE *val = 0; SWIG_AsValFilePtr(obj, &val); @@ -37,7 +37,7 @@ SWIG_AsFilePtr(PyObject *obj) { } %fragment("SWIG_CheckFilePtr","header",fragment="SWIG_AsValFilePtr") { -SWIGINTERNSHORT int +SWIGINTERNINLINE int SWIG_CheckFilePtr(PyObject *obj) { return SWIG_AsValFilePtr(obj, (FILE **)(0)); } diff --git a/Lib/python/pyapi.swg b/Lib/python/pyapi.swg index bb2655cd9..69ecf53e0 100644 --- a/Lib/python/pyapi.swg +++ b/Lib/python/pyapi.swg @@ -14,8 +14,8 @@ extern "C" { # define SWIGINTERN static SWIGUNUSED #endif -#ifndef SWIGINTERNSHORT -# define SWIGINTERNSHORT SWIGINTERN SWIGINLINE +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* diff --git a/Lib/python/pycomplex.swg b/Lib/python/pycomplex.swg index b99722403..9a58a8dbc 100644 --- a/Lib/python/pycomplex.swg +++ b/Lib/python/pycomplex.swg @@ -11,7 +11,7 @@ %define %swig_fromcplx_conv(Type, Real, Imag) %fragment(SWIG_From_frag(Type),"header") %{ -SWIGINTERNSHORT PyObject* +SWIGINTERNINLINE PyObject* SWIG_From(Type)(SWIG_cplusplus(const Type&, Type) c) { return PyComplex_FromDoubles(Real(c), Imag(c)); diff --git a/Lib/python/pycontainer.swg b/Lib/python/pycontainer.swg index 60e0165f9..f120f8fe7 100644 --- a/Lib/python/pycontainer.swg +++ b/Lib/python/pycontainer.swg @@ -140,11 +140,12 @@ namespace swig return swig::as(item, true); } catch (std::exception& e) { char msg[1024]; - sprintf(msg,"in sequence element %d", _index); + sprintf(msg,"in sequence element %d ", _index); if (!PyErr_Occurred()) { SWIG_type_error(swig::type_name(), item); } SWIG_append_errmsg(msg); + SWIG_append_errmsg(e.what()); throw; } } diff --git a/Lib/python/pyfragments.swg b/Lib/python/pyfragments.swg index cbf3cfd14..8b63ee3a2 100644 --- a/Lib/python/pyfragments.swg +++ b/Lib/python/pyfragments.swg @@ -7,7 +7,7 @@ For example, if you add: %fragment(SWIG_AsVal_frag(int),"header") { - SWIGINTERNSHORT int + SWIGINTERNINLINE int SWIG_AsVal(int)(PyObject *obj, int *val) { ; diff --git a/Lib/python/pyinit.swg b/Lib/python/pyinit.swg index 34fc4c597..5a0e41bb8 100644 --- a/Lib/python/pyinit.swg +++ b/Lib/python/pyinit.swg @@ -131,7 +131,7 @@ SWIG_Python_newvarlink(void) { return ((PyObject*) result); } -static void +static SWIGUNUSED void SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { swig_varlinkobject *v; swig_globalvar *gv; diff --git a/Lib/python/pyprimtypes.swg b/Lib/python/pyprimtypes.swg index 6a65b2606..81947d156 100644 --- a/Lib/python/pyprimtypes.swg +++ b/Lib/python/pyprimtypes.swg @@ -103,7 +103,7 @@ SWIGINTERN int %fragment("SWIG_CheckUnsignedLongInRange","header", fragment="") { -SWIGINTERNSHORT int +SWIGINTERNINLINE int SWIG_CheckUnsignedLongInRange(unsigned long value, unsigned long max_value, const char *errmsg) @@ -178,7 +178,7 @@ SWIGINTERN int %fragment(SWIG_From_frag(long long),"header", fragment="") { -SWIGINTERNSHORT PyObject* +SWIGINTERNINLINE PyObject* SWIG_From(long long)(long long value) { return ((value < LONG_MIN) || (value > LONG_MAX)) ? @@ -190,7 +190,7 @@ SWIGINTERNSHORT PyObject* %fragment(SWIG_From_frag(unsigned long long),"header", fragment="") { -SWIGINTERNSHORT PyObject* +SWIGINTERNINLINE PyObject* SWIG_From(unsigned long long)(unsigned long long value) { return (value > LONG_MAX) ? @@ -254,7 +254,7 @@ SWIGINTERN int } %fragment(SWIG_From_frag(unsigned long),"header") { -SWIGINTERNSHORT PyObject* +SWIGINTERNINLINE PyObject* SWIG_From(unsigned long)(unsigned long value) { return (value > LONG_MAX) ? @@ -340,7 +340,7 @@ SWIGINTERN int return 0; } %#else -SWIGINTERNSHORT int +SWIGINTERNINLINE int SWIG_AsVal(int)(PyObject *obj, int *val) { return SWIG_AsVal(long)(obj,(long*)val); @@ -371,7 +371,7 @@ SWIGINTERN int return 0; } %#else -SWIGINTERNSHORT unsigned int +SWIGINTERNINLINE unsigned int SWIG_AsVal(unsigned int)(PyObject *obj, unsigned int *val) { return SWIG_AsVal(unsigned long)(obj,(unsigned long *)val); @@ -491,7 +491,7 @@ SWIGINTERN int } %fragment(SWIG_From_frag(char),"header") { -SWIGINTERNSHORT PyObject* +SWIGINTERNINLINE PyObject* SWIG_From(char)(char c) { return PyString_FromStringAndSize(&c,1); @@ -522,7 +522,7 @@ SWIGINTERN int } %fragment(SWIG_From_frag(wchar_t),"header") { -SWIGINTERNSHORT PyObject* +SWIGINTERNINLINE PyObject* SWIG_From(wchar_t)(wchar_t c) { return PyUnicode_FromWideChar(&c, 1); @@ -554,7 +554,7 @@ SWIGINTERN int } %fragment(SWIG_From_frag(bool),"header") { -SWIGINTERNSHORT PyObject* +SWIGINTERNINLINE PyObject* SWIG_From(bool)(bool value) { PyObject *obj = value ? Py_True : Py_False; diff --git a/Lib/python/pyptrtypes.swg b/Lib/python/pyptrtypes.swg index 4737ecc31..d5d154d3e 100644 --- a/Lib/python/pyptrtypes.swg +++ b/Lib/python/pyptrtypes.swg @@ -115,7 +115,7 @@ %define %typemap_asptrfrom(CheckCode, AsPtrMeth, FromMeth, AsPtrFrag, FromFrag, Type...) %fragment(SWIG_AsVal_frag(Type),"header", fragment=SWIG_AsPtr_frag(Type)) %{ - SWIGINTERNSHORT int + SWIGINTERNINLINE int SWIG_AsVal(Type)(PyObject* obj, Type *val) { Type *v = (Type *)0; @@ -130,7 +130,7 @@ %} %fragment(SWIG_As_frag(Type),"header", fragment=SWIG_AsVal_frag(Type)) %{ - SWIGINTERNSHORT Type + SWIGINTERNINLINE Type SWIG_As(Type)(PyObject* obj) { Type v; diff --git a/Lib/python/pystdcommon.swg b/Lib/python/pystdcommon.swg index dbd4599c1..2127be7a4 100644 --- a/Lib/python/pystdcommon.swg +++ b/Lib/python/pystdcommon.swg @@ -78,7 +78,7 @@ namespace swig { if (val) { Type *p = 0; int res = traits_asptr::asptr(obj, &p); - if (res && p) { + if ((res != 0) && p) { typedef typename noconst_traits::noconst_type noconst_type; *(const_cast(val)) = *p; if (res == SWIG_NEWOBJ) delete p; diff --git a/Lib/python/pystrings.swg b/Lib/python/pystrings.swg index 20f573b64..99fb68d25 100644 --- a/Lib/python/pystrings.swg +++ b/Lib/python/pystrings.swg @@ -37,7 +37,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize) %fragment("SWIG_AsCharPtr","header", fragment="SWIG_AsCharPtrAndSize") { -SWIGINTERNSHORT int +SWIGINTERNINLINE int SWIG_AsCharPtr(PyObject *obj, char **val) { if (SWIG_AsCharPtrAndSize(obj, val, (size_t*)(0))) { @@ -134,7 +134,7 @@ SWIG_AsCharArray(PyObject *obj, char *val, size_t size) } %fragment("SWIG_FromCharArray","header") { -SWIGINTERNSHORT PyObject * +SWIGINTERNINLINE PyObject * SWIG_FromCharArray(const char* carray, size_t size) { if (size > INT_MAX) { diff --git a/Lib/python/pyvaltypes.swg b/Lib/python/pyvaltypes.swg index 91b5a4fdc..a07e8eb67 100644 --- a/Lib/python/pyvaltypes.swg +++ b/Lib/python/pyvaltypes.swg @@ -127,7 +127,7 @@ %define %typemap_asvaln(CheckCode, Type...) %fragment(SWIG_As_frag(Type),"header", fragment=SWIG_AsVal_frag(Type)) %{ -SWIGINTERNSHORT Type +SWIGINTERNINLINE Type SWIG_As(Type)(PyObject* obj) { Type v; @@ -142,7 +142,7 @@ SWIG_As(Type)(PyObject* obj) %} %fragment(SWIG_Check_frag(Type),"header", fragment=SWIG_AsVal_frag(Type)) %{ -SWIGINTERNSHORT int +SWIGINTERNINLINE int SWIG_Check(Type)(PyObject* obj) { return SWIG_AsVal(Type)(obj, (Type*)0); diff --git a/Lib/python/pywstrings.swg b/Lib/python/pywstrings.swg index 150dea7a7..3841a9c8e 100644 --- a/Lib/python/pywstrings.swg +++ b/Lib/python/pywstrings.swg @@ -128,7 +128,7 @@ SWIG_AsWCharArray(PyObject *obj, wchar_t *val, size_t size) } %fragment("SWIG_FromWCharArray","header") { -SWIGINTERNSHORT PyObject * +SWIGINTERNINLINE PyObject * SWIG_FromWCharArray(const wchar_t * carray, size_t size) { if (size > INT_MAX) { diff --git a/Lib/python/std_basic_string.i b/Lib/python/std_basic_string.i index e8baf889f..386bcafe5 100644 --- a/Lib/python/std_basic_string.i +++ b/Lib/python/std_basic_string.i @@ -38,7 +38,7 @@ %fragment(SWIG_From_frag(std::basic_string),"header", fragment="SWIG_FromCharArray") { -SWIGINTERNSHORT PyObject* +SWIGINTERNINLINE PyObject* SWIG_From(std::basic_string)(const std::string& s) { return SWIG_FromCharArray(s.data(), s.size()); @@ -80,7 +80,7 @@ SWIGINTERN int %fragment(SWIG_From_frag(std::basic_string),"header", fragment="SWIG_FromWCharArray") { -SWIGINTERNSHORT PyObject* +SWIGINTERNINLINE PyObject* SWIG_From(std::basic_string)(const std::wstring& s) { return SWIG_FromWCharArray(s.data(), s.size()); diff --git a/Lib/python/std_string.i b/Lib/python/std_string.i index 70ab02c4c..875b2e6a9 100644 --- a/Lib/python/std_string.i +++ b/Lib/python/std_string.i @@ -51,7 +51,7 @@ namespace std %fragment(SWIG_From_frag(std::string),"header", fragment="SWIG_FromCharArray") { -SWIGINTERNSHORT PyObject* +SWIGINTERNINLINE PyObject* SWIG_From(std::string)(const std::string& s) { return SWIG_FromCharArray(s.data(), s.size()); @@ -65,7 +65,7 @@ SWIGINTERN int { std::string* s; int res = SWIG_AsPtr(std::string)(obj, &s); - if (res && s) { + if ((res != 0) && s) { if (val) *val = *s; if (res == SWIG_NEWOBJ) delete s; return res; diff --git a/Lib/python/std_wstring.i b/Lib/python/std_wstring.i index ee2fa2ffe..6ab6d06ce 100644 --- a/Lib/python/std_wstring.i +++ b/Lib/python/std_wstring.i @@ -53,7 +53,7 @@ SWIGINTERN int %fragment(SWIG_From_frag(std::wstring),"header", fragment="SWIG_FromWCharArray") { -SWIGINTERNSHORT PyObject* +SWIGINTERNINLINE PyObject* SWIG_From(std::wstring)(const std::wstring& s) { return SWIG_FromWCharArray(s.data(), s.size()); @@ -68,7 +68,7 @@ SWIGINTERN int { std::wstring *s; int res = SWIG_AsPtr(std::wstring)(obj, &s); - if (res && s) { + if ((res != 0) && s) { if (val) *val = *s; if (res == SWIG_NEWOBJ) delete s; return res; diff --git a/Lib/swig.swg b/Lib/swig.swg index de15542d7..545e87d91 100644 --- a/Lib/swig.swg +++ b/Lib/swig.swg @@ -473,3 +473,37 @@ static int NAME(TYPE x) { #endif %} + +/* Common labels and attributes for the internal SWIG methods */ +%insert("runtime") %{ +/* inline attribute */ +#ifndef SWIGINLINE +#if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +#else +# define SWIGINLINE +#endif +#endif + +/* attritbute passed for some compilers to avoid unused method warnings */ +#ifndef SWIGUNUSED +#ifdef __GNUC__ +#define SWIGUNUSED __attribute__ ((unused)) +#else +#define SWIGUNUSED +#endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +#define SWIGINTERN static SWIGUNUSED +#endif + + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +#define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +%} +