@@ -76,30 +76,26 @@ WIN32 is still required for the locale module.
7676/* Compiler specific defines */
7777
7878/* ------------------------------------------------------------------------*/
79- /* Microsoft C defines _MSC_VER */
79+ /* Microsoft C defines _MSC_VER, as does clang-cl.exe */
8080#ifdef _MSC_VER
8181
8282/* We want COMPILER to expand to a string containing _MSC_VER's *value*.
8383 * This is horridly tricky, because the stringization operator only works
8484 * on macro arguments, and doesn't evaluate macros passed *as* arguments.
85- * Attempts simpler than the following appear doomed to produce "_MSC_VER"
86- * literally in the string.
8785 */
8886#define _Py_PASTE_VERSION (SUFFIX ) \
8987 ("[MSC v." _Py_STRINGIZE(_MSC_VER) " " SUFFIX "]")
9088/* e.g., this produces, after compile-time string catenation,
91- * ("[MSC v.1200 32 bit (Intel)]")
89+ * ("[MSC v.1900 64 bit (Intel)]")
9290 *
9391 * _Py_STRINGIZE(_MSC_VER) expands to
94- * _Py_STRINGIZE1((_MSC_VER)) expands to
95- * _Py_STRINGIZE2(_MSC_VER) but as this call is the result of token-pasting
96- * it's scanned again for macros and so further expands to (under MSVC 6)
97- * _Py_STRINGIZE2(1200) which then expands to
98- * "1200"
92+ * _Py_STRINGIZE1(_MSC_VER) and this second macro call is scanned
93+ * again for macros and so further expands to
94+ * _Py_STRINGIZE1(1900) which then expands to
95+ * "1900"
9996 */
100- #define _Py_STRINGIZE (X ) _Py_STRINGIZE1((X))
101- #define _Py_STRINGIZE1 (X ) _Py_STRINGIZE2 ## X
102- #define _Py_STRINGIZE2 (X ) #X
97+ #define _Py_STRINGIZE (X ) _Py_STRINGIZE1(X)
98+ #define _Py_STRINGIZE1 (X ) #X
10399
104100/* MSVC defines _WINxx to differentiate the windows platform types
105101
@@ -122,13 +118,16 @@ WIN32 is still required for the locale module.
122118 */
123119#ifdef MS_WIN64
124120#if defined(_M_X64 ) || defined(_M_AMD64 )
125- #if defined(__INTEL_COMPILER )
121+ #if defined(__clang__ )
122+ #define COMPILER ("[Clang " __clang_version__ "] 64 bit (AMD64) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
123+ #define PY_SUPPORT_TIER 0
124+ #elif defined(__INTEL_COMPILER )
126125#define COMPILER ("[ICC v." _Py_STRINGIZE(__INTEL_COMPILER) " 64 bit (amd64) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
127126#define PY_SUPPORT_TIER 0
128127#else
129128#define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)")
130129#define PY_SUPPORT_TIER 1
131- #endif /* __INTEL_COMPILER */
130+ #endif /* __clang__ */
132131#define PYD_PLATFORM_TAG "win_amd64"
133132#elif defined(_M_ARM64 )
134133#define COMPILER _Py_PASTE_VERSION("64 bit (ARM64)")
@@ -181,13 +180,16 @@ typedef _W64 int Py_ssize_t;
181180
182181#if defined(MS_WIN32 ) && !defined(MS_WIN64 )
183182#if defined(_M_IX86 )
184- #if defined(__INTEL_COMPILER )
183+ #if defined(__clang__ )
184+ #define COMPILER ("[Clang " __clang_version__ "] 32 bit (Intel) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
185+ #define PY_SUPPORT_TIER 0
186+ #elif defined(__INTEL_COMPILER )
185187#define COMPILER ("[ICC v." _Py_STRINGIZE(__INTEL_COMPILER) " 32 bit (Intel) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
186188#define PY_SUPPORT_TIER 0
187189#else
188190#define COMPILER _Py_PASTE_VERSION("32 bit (Intel)")
189191#define PY_SUPPORT_TIER 1
190- #endif /* __INTEL_COMPILER */
192+ #endif /* __clang__ */
191193#define PYD_PLATFORM_TAG "win32"
192194#elif defined(_M_ARM )
193195#define COMPILER _Py_PASTE_VERSION("32 bit (ARM)")
0 commit comments