[New-bugs-announce] [issue1216] Python2.5.1 fails to compile under VC.NET2002 ( 7.0 )

Karthik Rajagopalan report at bugs.python.org
Thu Sep 27 19:54:12 CEST 2007


New submission from Karthik Rajagopalan:

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

----------
messages: 56176
nosy: kartlee
severity: normal
status: open
title: Python2.5.1 fails to compile under  VC.NET2002 ( 7.0 )
type: compile error
versions: Python 2.5

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1216>
__________________________________


More information about the New-bugs-announce mailing list