aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/libshiboken
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/libshiboken')
-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