classification
Title: Python2.5.1 fails to compile under VC.NET2002 ( 7.0 )
Type: compile error Stage:
Components: Extension Modules Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: loewis Nosy List: kartlee, loewis, nnorwitz
Priority: normal Keywords:

Created on 2007-09-27 17:54 by kartlee, last changed 2007-10-12 08:59 by loewis. This issue is now closed.

Messages (4)
msg56176 - (view) Author: Karthik Rajagopalan (kartlee) Date: 2007-09-27 17:54
Hi,

We see following compiler error when 'Python2.5.1' is compiled under 
VC.NET 2002 ( 7.0.9466 ). This happens in 'pythoncore' project:

<ERROR>
------ Build started: Project: pythoncore, Configuration: Release 
Win32 ------ 

Compiling... 
zutil.c 
....
....
sha512module.c 
\python-build\Python-2.5.1\Modules\sha512module.c(146) : error C2059: 
syntax error : 'bad suffix on number' 
\python-build\Python-2.5.1\Modules\sha512module.c(146) : error C2146: 
syntax error : missing ')' before identifier 'L' 
\python-build\Python-2.5.1\Modules\sha512module.c(146) : error C2144: 
syntax error : '<Unknown>' should be preceded by '<Unknown>' 
\python-build\Python-2.5.1\Modules\sha512module.c(146) : error C2144: 
syntax error : '<Unknown>' should be preceded by '<Unknown>' 
\python-build\Python-2.5.1\Modules\sha512module.c(146) : error C2143: 
syntax error : missing ')' before 'identifier' 
\python-build\Python-2.5.1\Modules\sha512module.c(146) : error C2059: 
syntax error : 'bad suffix on number' 

</ERROR>

The fix for the above problem is given below where _MSC_VER is 
increased more than 1300 that has LL and ULL literal suffix. VC.NET2002 
is a C89 compiler and it doesn't have LL and ULL support.

/* VC 7.1 has them and VC 6.0 does not.  VC 6.0 has a version number of 
1200.
   Microsoft eMbedded Visual C++ 4.0 has a version number of 1201 and 
doesn't
   define these.
   If some compiler does not provide them, modify the #if 
appropriately. */
#if defined(_MSC_VER)
#if _MSC_VER > 1300
#define HAVE_UINTPTR_T 1
#define HAVE_INTPTR_T 1
#else
/* VC6 & eVC4 don't support the C99 LL suffix for 64-bit integer 
literals */
#define Py_LL(x) x##I64
#define Py_ULL(x) Py_LL(x##U)
#endif  /* _MSC_VER > 1300  */
#endif  /* _MSC_VER */

#endif

Please let me know your comments and if the fix looks rights, please 
incorporate in your future release.

-Karthik Rajagopalan
D.E.Shaw India Software Pvt Ltd
msg56357 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2007-10-12 05:47
Martin, it looks like you made some changes in rev 46064.  Can you
suggest anything?
msg56359 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-10-12 07:27
The actual change that broke that was r41672, which added the ULL
suffix. r46064 fixed it for VC6 and embedded VC.

Raising the minimum _MSC_VER to above 1300 is fine (VC 7.1 is 1310).

I personally can't test with VS 2002 anymore, so I have to trust that it
doesn't support the suffix, and that it's value of _MSC_VER is 1300.
msg56360 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-10-12 08:59
Thanks for the report. This is now fixed in r58430 and r584301
History
Date User Action Args
2007-10-12 08:59:50loewissetstatus: open -> closed
resolution: fixed
2007-10-12 08:59:29loewissetmessages: + msg56360
2007-10-12 07:27:58loewissetmessages: + msg56359
2007-10-12 05:47:03nnorwitzsetassignee: loewis
messages: + msg56357
components: + Extension Modules
nosy: + loewis, nnorwitz
2007-09-27 17:54:12kartleecreate