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
+6 -4
View File
@@ -40,10 +40,12 @@ The next errors include:
- additional C99/C99-era declarations and compatibility assumptions
The compatibility header now supplies the pointer-sized typedefs required by
`pyport.h`; the current first compiler diagnostics are unsupported C `inline`
syntax and `__declspec(deprecated)` annotations in CPython headers. The shim
resolved only the missing-header and pointer-type layer; it is intentionally not
presented as a complete fix.
`pyport.h`; the current first compiler diagnostics after applying the saved
`compat/msvc600/cpython-3.11.16-vc6-headers.patch` are VC6's inability to parse
`long long` declarations in `Include/longobject.h` and C99-style integer
literal suffixes in `Include/pythread.h`. The shim and patch resolve only the
missing-header, pointer-type, inline, and deprecation layers; they are
intentionally not presented as a complete fix.
## Larger blockers to plan for
@@ -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
+5
View File
@@ -31,4 +31,9 @@ typedef unsigned __int64 uint_least64_t;
#define PRIx64 "I64x"
#define PRIX64 "I64X"
/* VC6 has __inline but does not recognize the C99 inline keyword. */
#ifndef inline
#define inline __inline
#endif
#endif