aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Lib/python/pyopers.swg22
-rw-r--r--Lib/swig.swg4
-rw-r--r--Lib/swigwarnings.swg29
-rw-r--r--Source/Preprocessor/cpp.c2
4 files changed, 21 insertions, 36 deletions
diff --git a/Lib/python/pyopers.swg b/Lib/python/pyopers.swg
index f06c1cd45..442515dac 100644
--- a/Lib/python/pyopers.swg
+++ b/Lib/python/pyopers.swg
@@ -5,10 +5,7 @@
#ifdef __cplusplus
-%define %pybinoperator(pyname,oper)
-%rename(pyname) oper;
-%pythonmaybecall oper;
-%enddef
+#define %pybinoperator(pyname,oper) %rename(pyname) oper; %pythonmaybecall oper
%pybinoperator(__add__, *::operator+);
%pybinoperator(__pos__, *::operator+());
@@ -55,7 +52,7 @@
disabling the ownership of the input 'self' pointer, and assigning
it to the returning object:
- %feature("self:disown") *::Operator;
+ %feature("del") *::Operator;
%feature("new") *::Operator;
This makes the most common case safe, ie:
@@ -75,22 +72,18 @@
that never get deleted (maybe, not sure, it depends). But if that is
the case, you could recover the old behaviour using
- %feature("self:disown","") A::operator+=;
+ %feature("del","") A::operator+=;
%feature("new","") A::operator+=;
which recovers the old behaviour for the class 'A', or if you are
100% sure your entire system works fine in the old way, use:
- %feature("self:disown","") *::operator+=;
+ %feature("del","") *::operator+=;
%feature("new","") *::operator+=;
*/
-%define %pyinplaceoper(PyOper, Oper)
-%feature("self:disown") Oper;
-%feature("new") Oper;
-%rename(PyOper) Oper;
-%enddef
+#define %pyinplaceoper(PyOper, Oper) %delobject Oper; %newobject Oper; %rename(PyOper) Oper
%pyinplaceoper(__iadd__ , *::operator +=);
%pyinplaceoper(__isub__ , *::operator -=);
@@ -107,10 +100,7 @@
/* Finally, in python we need to mark the binary operations to fail as
'maybecall' methods */
-%define %pybinopermaybecall(oper)
-%pythonmaybecall __ ## oper ## __;
-%pythonmaybecall __r ## oper ## __;
-%enddef
+#define %pybinopermaybecall(oper) %pythonmaybecall __ ## oper ## __; %pythonmaybecall __r ## oper ## __
%pybinopermaybecall(add);
%pybinopermaybecall(pos);
diff --git a/Lib/swig.swg b/Lib/swig.swg
index 8ad22b843..2d21bbb5b 100644
--- a/Lib/swig.swg
+++ b/Lib/swig.swg
@@ -499,9 +499,7 @@ namespace std {
/* Macro for overload resolution */
-%define %typecheck(_x...)
-%typemap(typecheck, precedence=_x)
-%enddef
+%define %typecheck(_x...) %typemap(typecheck, precedence=_x) %enddef
/* Macros for precedence levels */
diff --git a/Lib/swigwarnings.swg b/Lib/swigwarnings.swg
index 936768213..d3d1065e9 100644
--- a/Lib/swigwarnings.swg
+++ b/Lib/swigwarnings.swg
@@ -32,31 +32,29 @@
as described above.
*/
-%include <swigwarn.swg>
-
+/* -----------------------------------------------------------------------------
+ * SWIG warning codes
+ * ----------------------------------------------------------------------------- */
+%include <swigwarn.swg>
/* -----------------------------------------------------------------------------
* Auxiliar macros
* ----------------------------------------------------------------------------- */
/* Macro to define warning messages */
-%define %_warningmsg(Val, Msg...) `Val`":"Msg %enddef
-%define %warningmsg(Val, Msg...) %_warningmsg(Val, Msg) %enddef
+#define %_warningmsg(Val, Msg...) `Val`":"Msg
+#define %warningmsg(Val, Msg...) %_warningmsg(Val, Msg)
/* Macro to define warning macros */
-%define %_warningmacro(Def, Val, Msg)
-%define Def %warningmsg(Val, Msg) %enddef
-%enddef
-%define %warningmacro(x,msg)
-%_warningmacro(x##_MSG, x, msg)
-%enddef
+%define %_warningmacro(Def, Val, Msg) %define Def %warningmsg(Val, Msg) %enddef %enddef
+#define %warningmacro(x,msg) %_warningmacro(x##_MSG, x, msg)
/* -----------------------------------------------------------------------------
* Define typemap macro messages
* ----------------------------------------------------------------------------- */
-%define %typemapmsg(TMap, msg) %warningmacro(SWIGWARN_TYPEMAP_##TMap,msg) %enddef
+#define %typemapmsg(TMap, msg) %warningmacro(SWIGWARN_TYPEMAP_##TMap,msg)
%typemapmsg(CHARLEAK, "Setting a const char * variable may leak memory.")
%typemapmsg(SWIGTYPELEAK, "Setting a pointer/reference variable may leak memory.");
@@ -73,13 +71,12 @@
* Define operator warning macro messages
* ----------------------------------------------------------------------------- */
-%define %ignoreopermsg(Oper, msg) %warningmacro(SWIGWARN_IGNORE_OPERATOR_##Oper,msg) %enddef
+#define %ignoreopermsg(Oper, msg) %warningmacro(SWIGWARN_IGNORE_OPERATOR_##Oper,msg)
%ignoreopermsg(NEW, "operator new ignored");
%ignoreopermsg(DELETE, "operator delete ignored");
%ignoreopermsg(NEWARR, "operator new[] ignored");
%ignoreopermsg(DELARR, "operator delete[] ignored");
-
%ignoreopermsg(PLUS, "operator+ ignored");
%ignoreopermsg(MINUS, "operator- ignored");
%ignoreopermsg(MUL, "operator* ignored");
@@ -109,14 +106,14 @@
%ignoreopermsg(OREQ, "operator|= ignored");
%ignoreopermsg(XOREQ, "operator^= ignored");
-%define %ignoreoperator(Oper) %ignorewarn(SWIGWARN_IGNORE_OPERATOR_##Oper##_MSG) %enddef
+#define %ignoreoperator(Oper) %ignorewarn(SWIGWARN_IGNORE_OPERATOR_##Oper##_MSG)
/* -----------------------------------------------------------------------------
* Macros for keyword and built-in names
* ----------------------------------------------------------------------------- */
-%define %keywordwarn(msg...) %namewarn(%warningmsg(SWIGWARN_PARSE_KEYWORD, msg)) %enddef
-%define %builtinwarn(msg...) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, msg)) %enddef
+#define %keywordwarn(msg...) %namewarn(%warningmsg(SWIGWARN_PARSE_KEYWORD, msg))
+#define %builtinwarn(msg...) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, msg))
/* -----------------------------------------------------------------------------
diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c
index 64ea990a9..3766069d9 100644
--- a/Source/Preprocessor/cpp.c
+++ b/Source/Preprocessor/cpp.c
@@ -1763,7 +1763,7 @@ Preprocessor_parse(String *s)
Seek(value,0,SEEK_SET);
Preprocessor_define(value,1);
}
- StringPutc('\n',ns);
+ /* StringPutc('\n',ns);*/
addline(ns,value,0);
state = 0;
}