From 3f15bfa5f7af0087566a8a2ebb10efb41956c261 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Mon, 17 Aug 2026 03:45:40 +0000 Subject: [PATCH] port: record initial MSVC600 compatibility layer --- PORT_STATUS.md | 10 +++--- .../msvc600/cpython-3.11.16-vc6-headers.patch | 34 +++++++++++++++++++ compat/msvc600/inttypes.h | 5 +++ 3 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 compat/msvc600/cpython-3.11.16-vc6-headers.patch diff --git a/PORT_STATUS.md b/PORT_STATUS.md index 989fd60..94f11c2 100644 --- a/PORT_STATUS.md +++ b/PORT_STATUS.md @@ -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 diff --git a/compat/msvc600/cpython-3.11.16-vc6-headers.patch b/compat/msvc600/cpython-3.11.16-vc6-headers.patch new file mode 100644 index 0000000..e73e571 --- /dev/null +++ b/compat/msvc600/cpython-3.11.16-vc6-headers.patch @@ -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 diff --git a/compat/msvc600/inttypes.h b/compat/msvc600/inttypes.h index 5850804..1d100f2 100644 --- a/compat/msvc600/inttypes.h +++ b/compat/msvc600/inttypes.h @@ -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