port: record initial MSVC600 compatibility layer

This commit is contained in:
Hermes Agent
2026-08-17 03:45:40 +00:00
parent 695737ae7c
commit 3f15bfa5f7
3 changed files with 45 additions and 4 deletions
@@ -0,0 +1,34 @@
diff --git a/Include/pyport.h b/Include/pyport.h
index b3b8b6f..4da45ef 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -334,9 +334,12 @@ extern "C" {
#if defined(__GNUC__) \
&& ((__GNUC__ >= 4) || (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) && _MSC_VER >= 1300
#define Py_DEPRECATED(VERSION) __declspec(deprecated( \
"deprecated in " #VERSION))
+#elif defined(_MSC_VER)
+/* Visual C++ 6.0 has no supported deprecation declaration syntax. */
+#define Py_DEPRECATED(VERSION_UNUSED)
#else
#define Py_DEPRECATED(VERSION_UNUSED)
#endif
@@ -352,10 +355,14 @@ extern "C" {
#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)
+#elif defined(_MSC_VER) && _MSC_VER >= 1300
#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))
+#elif defined(_MSC_VER)
+#define _Py_COMP_DIAG_PUSH
+#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS
+#define _Py_COMP_DIAG_POP
#else
#define _Py_COMP_DIAG_PUSH
#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS