summaryrefslogtreecommitdiffstats
path: root/Include/pyport.h
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-06-17 03:18:02 (GMT)
committerGitHub <noreply@github.com>2020-06-17 03:18:02 (GMT)
commit2c6d6c12c2d1a8f0c131d70ccf087555c52d4587 (patch)
tree1909a49de0ca8f0ebb3e0bf4759e3fe9d021e3a0 /Include/pyport.h
parent7795ae8f05a5b1134a576a372f64699176cac5fb (diff)
downloadcpython-2c6d6c12c2d1a8f0c131d70ccf087555c52d4587.zip
cpython-2c6d6c12c2d1a8f0c131d70ccf087555c52d4587.tar.gz
cpython-2c6d6c12c2d1a8f0c131d70ccf087555c52d4587.tar.bz2
bpo-19569: Add a macro to suppress deprecation warnings (GH-9004)
Co-authored-by: Arfrever Frehtes Taifersar Arahesis <arfrever.fta@gmail.com> (cherry picked from commit de4304dad8e035dbbb57d653e685312eead816df) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'Include/pyport.h')
-rw-r--r--Include/pyport.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/Include/pyport.h b/Include/pyport.h
index bdbd0c9..6505af4 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -513,6 +513,26 @@ extern "C" {
#define Py_DEPRECATED(VERSION_UNUSED)
#endif
+#if defined(__clang__)
+#define _Py_COMP_DIAG_PUSH _Pragma("clang diagnostic push")
+#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS \
+ _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
+#define _Py_COMP_DIAG_POP _Pragma("clang diagnostic pop")
+#elif defined(__GNUC__) \
+ && ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))
+#define _Py_COMP_DIAG_PUSH _Pragma("GCC diagnostic push")
+#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS \
+ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
+#define _Py_COMP_DIAG_POP _Pragma("GCC diagnostic pop")
+#elif defined(_MSC_VER)
+#define _Py_COMP_DIAG_PUSH __pragma(warning(push))
+#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS __pragma(warning(disable: 4996))
+#define _Py_COMP_DIAG_POP __pragma(warning(pop))
+#else
+#define _Py_COMP_DIAG_PUSH
+#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS
+#define _Py_COMP_DIAG_POP
+#endif
/* _Py_HOT_FUNCTION
* The hot attribute on a function is used to inform the compiler that the