From 7f20614b3bf560a448b841bcaaec595d2aee221c Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Tue, 27 Dec 2005 22:03:03 +0000 Subject: [PATCH] add the 'naturalvar' option/mode/feature, to allow member variables to be treated in a natural way, as the global ones. This mean use the const SWIGTYPE &(C++)/SWIGTYPE(C) typemaps instead of the plain SWIGTYPE * typemap for the set/get methods. Also add macros for CharLeak/SwigtypeLeak warnings. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8093 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/swig.swg | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Lib/swig.swg b/Lib/swig.swg index 6fff9f65b..8d3c9a237 100644 --- a/Lib/swig.swg +++ b/Lib/swig.swg @@ -116,6 +116,15 @@ #define %nofastdispatch %feature("fastdispatch","0") #define %clearfastdispatch %feature("fastdispatch","") +/* directors directives */ +#define %director %feature("director") +#define %nodirector %feature("director","0") +#define %cleardirector %feature("director","") + +/* naturalvar directives */ +#define %naturalvar %feature("naturalvar") +#define %nonaturalvar %feature("naturalvar","0") +#define %clearnaturalvar %feature("naturalvar","") /* Common features */ @@ -123,7 +132,10 @@ #define %warnfilter(...) %feature("warnfilter",`__VA_ARGS__`) /* Warnings used in typemaps. Macro names are the same as those in swigwarn.h but prefixed by SWIG_. */ +%define SWIG_WARN_TYPEMAP_CHARLEAK "451:Setting const char * member may leak memory." %enddef +%define SWIG_WARN_TYPEMAP_SWIGTYPELEAK "454:Setting a pointer/reference variable may leak memory." %enddef %define SWIG_WARN_TYPEMAP_THREAD_UNSAFE "470:Thread/reentrant unsafe wrapping, consider returning by value instead." %enddef +%define SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR "473:Returning a pointer or reference is not recommended, consider returning 'by value' instead." %enddef /* Contract support - Experimental and undocumented */