aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2018-10-02 11:12:33 +0200
committerChristian Tismer <tismer@stackless.com>2018-10-02 11:05:29 +0000
commitf2d53ba81c6ce1ac3d8cc58307283b7b68c377f4 (patch)
tree61c8ab55518b8579e40677ed834273e10d371807 /sources
parent7127a16f53fdadc709d234abf83d7fadfdf3aba7 (diff)
Get Rid Of "register" Warnings In Python 2
The new clang compiler version complains when the "register" keyword is still used. This patch suppresses this warning for Python. The file "typespec.h" was corrected to include skbpython.h, too. This was found after a few warnings still did not vanish. Change-Id: I1e3299f071c6dffee4cb2596415bc195264d9a9b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources')
-rw-r--r--sources/shiboken2/libshiboken/sbkpython.h28
-rw-r--r--sources/shiboken2/libshiboken/typespec.h2
2 files changed, 29 insertions, 1 deletions
diff --git a/sources/shiboken2/libshiboken/sbkpython.h b/sources/shiboken2/libshiboken/sbkpython.h
index 610e4a3c7..f06b0b19e 100644
--- a/sources/shiboken2/libshiboken/sbkpython.h
+++ b/sources/shiboken2/libshiboken/sbkpython.h
@@ -53,7 +53,20 @@
* This creates wrong language binding unless we define 'extern "C"' here.
*/
extern "C" {
+/*
+ * Python 2 uses the "register" keyword, which is deprecated in C++ 11
+ * and forbidden in C++17.
+ */
+# if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wdeprecated-register"
+# endif
+
# include <Python.h>
+
+# if defined(__clang__)
+# pragma clang diagnostic pop
+# endif
}
# include <structmember.h>
// Now we have the usual variables from Python.h .
@@ -62,9 +75,24 @@ extern "C" {
# include "pep384impl.h"
# include "typespec.h"
# pragma pop_macro("slots")
+
#else
+
extern "C" {
+/*
+ * Python 2 uses the "register" keyword, which is deprecated in C++ 11
+ * and forbidden in C++17.
+ */
+# if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wdeprecated-register"
+# endif
+
# include <Python.h>
+
+# if defined(__clang__)
+# pragma clang diagnostic pop
+# endif
}
# include <structmember.h>
// Now we have the usual variables from Python.h .
diff --git a/sources/shiboken2/libshiboken/typespec.h b/sources/shiboken2/libshiboken/typespec.h
index 46e7dec89..81227acac 100644
--- a/sources/shiboken2/libshiboken/typespec.h
+++ b/sources/shiboken2/libshiboken/typespec.h
@@ -40,7 +40,7 @@
#ifndef TYPESPEC_H
#define TYPESPEC_H
-#include <Python.h>
+#include "sbkpython.h"
#include "shibokenmacros.h"
#if PY_MAJOR_VERSION < 3