mirror of
https://github.com/python/cpython
synced 2024-10-14 15:57:14 +00:00
Some help for SF 614770: MSVC 7.0 compiler support
This changes sys.version under Microsoft builds to include the MS compiler version number (_MSC_VER). Since VC 6 and VC 7 are apparently incompatible, and both can be installed on a single box, distutils needs some way to figure out which version of MSVC a given Python was compiled under. As also suggested by MvL, got rid of #ifdef'ery for the defunct _M_ALPHA target. Bugfix candidate? Hard to say. As far as I'm concerned, VC 7 wasn't a supported platform in the 2.2 line. If somebody thinks it should be, they can do the work.
This commit is contained in:
parent
01c04013a7
commit
062843354f
|
@ -61,6 +61,28 @@ MS_CORE_DLL.
|
|||
/* Microsoft C defines _MSC_VER */
|
||||
#ifdef _MSC_VER
|
||||
|
||||
/* We want COMPILER to expand to a string containing _MSC_VER's *value*.
|
||||
* This is horridly tricky, because the stringization operator only works
|
||||
* on macro arguments, and doesn't evaluate macros passed *as* arguments.
|
||||
* Attempts simpler than the following appear doomed to produce "_MSC_VER"
|
||||
* literally in the string.
|
||||
*/
|
||||
#define _Py_PASTE_VERSION(SUFFIX) \
|
||||
("[MSC v." _Py_STRINGIZE(_MSC_VER) " " SUFFIX "]")
|
||||
/* e.g., this produces, after compile-time string catenation,
|
||||
* ("[MSC v.1200 32 bit (Intel)]")
|
||||
*
|
||||
* _Py_STRINGIZE(_MSC_VER) expands to
|
||||
* _Py_STRINGIZE1((_MSC_VER)) expands to
|
||||
* _Py_STRINGIZE2(_MSC_VER) but as this call is the result of token-pasting
|
||||
* it's scanned again for macros and so further expands to (under MSVC 6)
|
||||
* _Py_STRINGIZE2(1200) which then expands to
|
||||
* "1200"
|
||||
*/
|
||||
#define _Py_STRINGIZE(X) _Py_STRINGIZE1((X))
|
||||
#define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## X
|
||||
#define _Py_STRINGIZE2(X) #X
|
||||
|
||||
/* MSVC defines _WINxx to differentiate the windows platform types
|
||||
|
||||
Note that for compatibility reasons _WIN32 is defined on Win32
|
||||
|
@ -76,21 +98,17 @@ MS_CORE_DLL.
|
|||
/* set the COMPILER */
|
||||
#ifdef MS_WIN64
|
||||
#ifdef _M_IX86
|
||||
#define COMPILER "[MSC 64 bit (Intel)]"
|
||||
#elif defined(_M_ALPHA)
|
||||
#define COMPILER "[MSC 64 bit (Alpha)]"
|
||||
#define COMPILER _Py_PASTE_VERSION("64 bit (Intel)"
|
||||
#else
|
||||
#define COMPILER "[MSC 64 bit (Unknown)]"
|
||||
#define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)")
|
||||
#endif
|
||||
#endif /* MS_WIN64 */
|
||||
|
||||
#if defined(MS_WIN32) && !defined(MS_WIN64)
|
||||
#ifdef _M_IX86
|
||||
#define COMPILER "[MSC 32 bit (Intel)]"
|
||||
#elif defined(_M_ALPHA)
|
||||
#define COMPILER "[MSC 32 bit (Alpha)]"
|
||||
#define COMPILER _Py_PASTE_VERSION("32 bit (Intel)")
|
||||
#else
|
||||
#define COMPILER "[MSC (Unknown)]"
|
||||
#define COMPILER _Py_PASTE_VERSION("32 bit (Unknown)")
|
||||
#endif
|
||||
#endif /* MS_WIN32 && !MS_WIN64 */
|
||||
|
||||
|
@ -227,16 +245,11 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
|
|||
#elif defined(MS_WIN32)
|
||||
# define PLATFORM "win32"
|
||||
# define HAVE_LARGEFILE_SUPPORT
|
||||
# ifdef _M_ALPHA
|
||||
# define SIZEOF_VOID_P 8
|
||||
# define SIZEOF_TIME_T 8
|
||||
# else
|
||||
# define SIZEOF_VOID_P 4
|
||||
# define SIZEOF_TIME_T 4
|
||||
# define SIZEOF_OFF_T 4
|
||||
# define SIZEOF_FPOS_T 8
|
||||
# define SIZEOF_HKEY 4
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
|
Loading…
Reference in a new issue