gh-141341: Rename COMPILER macro to _Py_COMPILER on Windows (#141342)
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
On Windows, rename the ``COMPILER`` macro to ``_Py_COMPILER`` to avoid name
|
||||||
|
conflicts. Patch by Victor Stinner.
|
||||||
@@ -118,7 +118,7 @@ WIN32 is still required for the locale module.
|
|||||||
/* Microsoft C defines _MSC_VER, as does clang-cl.exe */
|
/* Microsoft C defines _MSC_VER, as does clang-cl.exe */
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
/* We want COMPILER to expand to a string containing _MSC_VER's *value*.
|
/* We want _Py_COMPILER to expand to a string containing _MSC_VER's *value*.
|
||||||
* This is horridly tricky, because the stringization operator only works
|
* This is horridly tricky, because the stringization operator only works
|
||||||
* on macro arguments, and doesn't evaluate macros passed *as* arguments.
|
* on macro arguments, and doesn't evaluate macros passed *as* arguments.
|
||||||
*/
|
*/
|
||||||
@@ -148,7 +148,7 @@ WIN32 is still required for the locale module.
|
|||||||
#define MS_WIN64
|
#define MS_WIN64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* set the COMPILER and support tier
|
/* set the _Py_COMPILER and support tier
|
||||||
*
|
*
|
||||||
* win_amd64 MSVC (x86_64-pc-windows-msvc): 1
|
* win_amd64 MSVC (x86_64-pc-windows-msvc): 1
|
||||||
* win32 MSVC (i686-pc-windows-msvc): 1
|
* win32 MSVC (i686-pc-windows-msvc): 1
|
||||||
@@ -158,22 +158,22 @@ WIN32 is still required for the locale module.
|
|||||||
#ifdef MS_WIN64
|
#ifdef MS_WIN64
|
||||||
#if defined(_M_X64) || defined(_M_AMD64)
|
#if defined(_M_X64) || defined(_M_AMD64)
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
#define COMPILER ("[Clang " __clang_version__ "] 64 bit (AMD64) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
|
#define _Py_COMPILER ("[Clang " __clang_version__ "] 64 bit (AMD64) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
|
||||||
#define PY_SUPPORT_TIER 0
|
#define PY_SUPPORT_TIER 0
|
||||||
#elif defined(__INTEL_COMPILER)
|
#elif defined(__INTEL_COMPILER)
|
||||||
#define COMPILER ("[ICC v." _Py_STRINGIZE(__INTEL_COMPILER) " 64 bit (amd64) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
|
#define _Py_COMPILER ("[ICC v." _Py_STRINGIZE(__INTEL_COMPILER) " 64 bit (amd64) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
|
||||||
#define PY_SUPPORT_TIER 0
|
#define PY_SUPPORT_TIER 0
|
||||||
#else
|
#else
|
||||||
#define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)")
|
#define _Py_COMPILER _Py_PASTE_VERSION("64 bit (AMD64)")
|
||||||
#define PY_SUPPORT_TIER 1
|
#define PY_SUPPORT_TIER 1
|
||||||
#endif /* __clang__ */
|
#endif /* __clang__ */
|
||||||
#define PYD_PLATFORM_TAG "win_amd64"
|
#define PYD_PLATFORM_TAG "win_amd64"
|
||||||
#elif defined(_M_ARM64)
|
#elif defined(_M_ARM64)
|
||||||
#define COMPILER _Py_PASTE_VERSION("64 bit (ARM64)")
|
#define _Py_COMPILER _Py_PASTE_VERSION("64 bit (ARM64)")
|
||||||
#define PY_SUPPORT_TIER 3
|
#define PY_SUPPORT_TIER 3
|
||||||
#define PYD_PLATFORM_TAG "win_arm64"
|
#define PYD_PLATFORM_TAG "win_arm64"
|
||||||
#else
|
#else
|
||||||
#define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)")
|
#define _Py_COMPILER _Py_PASTE_VERSION("64 bit (Unknown)")
|
||||||
#define PY_SUPPORT_TIER 0
|
#define PY_SUPPORT_TIER 0
|
||||||
#endif
|
#endif
|
||||||
#endif /* MS_WIN64 */
|
#endif /* MS_WIN64 */
|
||||||
@@ -220,22 +220,22 @@ typedef _W64 int Py_ssize_t;
|
|||||||
#if defined(MS_WIN32) && !defined(MS_WIN64)
|
#if defined(MS_WIN32) && !defined(MS_WIN64)
|
||||||
#if defined(_M_IX86)
|
#if defined(_M_IX86)
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
#define COMPILER ("[Clang " __clang_version__ "] 32 bit (Intel) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
|
#define _Py_COMPILER ("[Clang " __clang_version__ "] 32 bit (Intel) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
|
||||||
#define PY_SUPPORT_TIER 0
|
#define PY_SUPPORT_TIER 0
|
||||||
#elif defined(__INTEL_COMPILER)
|
#elif defined(__INTEL_COMPILER)
|
||||||
#define COMPILER ("[ICC v." _Py_STRINGIZE(__INTEL_COMPILER) " 32 bit (Intel) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
|
#define _Py_COMPILER ("[ICC v." _Py_STRINGIZE(__INTEL_COMPILER) " 32 bit (Intel) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
|
||||||
#define PY_SUPPORT_TIER 0
|
#define PY_SUPPORT_TIER 0
|
||||||
#else
|
#else
|
||||||
#define COMPILER _Py_PASTE_VERSION("32 bit (Intel)")
|
#define _Py_COMPILER _Py_PASTE_VERSION("32 bit (Intel)")
|
||||||
#define PY_SUPPORT_TIER 1
|
#define PY_SUPPORT_TIER 1
|
||||||
#endif /* __clang__ */
|
#endif /* __clang__ */
|
||||||
#define PYD_PLATFORM_TAG "win32"
|
#define PYD_PLATFORM_TAG "win32"
|
||||||
#elif defined(_M_ARM)
|
#elif defined(_M_ARM)
|
||||||
#define COMPILER _Py_PASTE_VERSION("32 bit (ARM)")
|
#define _Py_COMPILER _Py_PASTE_VERSION("32 bit (ARM)")
|
||||||
#define PYD_PLATFORM_TAG "win_arm32"
|
#define PYD_PLATFORM_TAG "win_arm32"
|
||||||
#define PY_SUPPORT_TIER 0
|
#define PY_SUPPORT_TIER 0
|
||||||
#else
|
#else
|
||||||
#define COMPILER _Py_PASTE_VERSION("32 bit (Unknown)")
|
#define _Py_COMPILER _Py_PASTE_VERSION("32 bit (Unknown)")
|
||||||
#define PY_SUPPORT_TIER 0
|
#define PY_SUPPORT_TIER 0
|
||||||
#endif
|
#endif
|
||||||
#endif /* MS_WIN32 && !MS_WIN64 */
|
#endif /* MS_WIN32 && !MS_WIN64 */
|
||||||
@@ -273,7 +273,7 @@ typedef int pid_t;
|
|||||||
#warning "Please use an up-to-date version of gcc! (>2.91 recommended)"
|
#warning "Please use an up-to-date version of gcc! (>2.91 recommended)"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define COMPILER "[gcc]"
|
#define _Py_COMPILER "[gcc]"
|
||||||
#define PY_LONG_LONG long long
|
#define PY_LONG_LONG long long
|
||||||
#define PY_LLONG_MIN LLONG_MIN
|
#define PY_LLONG_MIN LLONG_MIN
|
||||||
#define PY_LLONG_MAX LLONG_MAX
|
#define PY_LLONG_MAX LLONG_MAX
|
||||||
@@ -286,7 +286,7 @@ typedef int pid_t;
|
|||||||
/* XXX These defines are likely incomplete, but should be easy to fix.
|
/* XXX These defines are likely incomplete, but should be easy to fix.
|
||||||
They should be complete enough to build extension modules. */
|
They should be complete enough to build extension modules. */
|
||||||
|
|
||||||
#define COMPILER "[lcc-win32]"
|
#define _Py_COMPILER "[lcc-win32]"
|
||||||
typedef int pid_t;
|
typedef int pid_t;
|
||||||
/* __declspec() is supported here too - do nothing to get the defaults */
|
/* __declspec() is supported here too - do nothing to get the defaults */
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
|
#ifdef _Py_COMPILER
|
||||||
|
# define COMPILER _Py_COMPILER
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef COMPILER
|
#ifndef COMPILER
|
||||||
|
|
||||||
// Note the __clang__ conditional has to come before the __GNUC__ one because
|
// Note the __clang__ conditional has to come before the __GNUC__ one because
|
||||||
|
|||||||
Reference in New Issue
Block a user