[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] [PATCH 1/5] Add SIP_NULLPTR/SIP_OVERRIDE compatibility macros
From:       Stefan Brüns <stefan.bruens () rwth-aachen ! de>
Date:       2018-09-29 14:27:45
Message-ID: 5c299925-6fd2-4abd-9ae2-7c94ade93ae8 () rwthex-w2-a ! rwth-ad ! de
[Download RAW message or body]

To allow using nullptr throughout the generated code while staying
backwards compatible for C and older C++ compilers, use SIP_NULLPTR
as a proxy. Likewise for override/SIP_OVERRIDE.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
---
 sipgen/gencode.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/sipgen/gencode.c b/sipgen/gencode.c
index ca76761..58fc35e 100644
--- a/sipgen/gencode.c
+++ b/sipgen/gencode.c
@@ -608,6 +608,24 @@ static void generateInternalAPIHeader(sipSpec *pt, moduleDef *mod,
 "#include <QThread>\n"
             );
 
+    /* Add some convenience macros to make code forward/backwards compatible. */
+    prcode(fp,
+"\n"
+"#ifndef SIP_NULLPTR\n"
+"#if __cplusplus >= 201103L\n"
+"#define SIP_NULLPTR nullptr\n"
+"#define SIP_OVERRIDE override\n"
+"#elif defined _MSVC_LANG\n"
+"#define SIP_NULLPTR nullptr\n"
+"#define SIP_OVERRIDE override\n"
+"#else\n"
+"#define SIP_NULLPTR 0\n"
+"#define SIP_OVERRIDE\n"
+"#endif\n"
+"#endif\n"
+"\n"
+          );
+
     /* Define the qualifiers. */
     noIntro = TRUE;
 
-- 
2.19.0

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic