[Python-checkins] r55948 - python/trunk/Include/pyport.h

Thomas Heller theller at ctypes.org
Wed Jun 13 11:16:04 CEST 2007


martin.v.loewis schrieb:
> Author: martin.v.loewis
> Date: Wed Jun 13 05:42:19 2007
> New Revision: 55948
> 
> Modified:
>    python/trunk/Include/pyport.h
> Log:
> Provide PY_LLONG_MAX on all systems having long long.
> Will backport to 2.5.
> 
> 
> Modified: python/trunk/Include/pyport.h
> ==============================================================================
> --- python/trunk/Include/pyport.h	(original)
> +++ python/trunk/Include/pyport.h	Wed Jun 13 05:42:19 2007
> @@ -62,14 +62,20 @@
>  #ifndef PY_LONG_LONG
>  #define PY_LONG_LONG long long
>  #if defined(LLONG_MAX)
> +/* If LLONG_MAX is defined in limits.h, use that. */
>  #define PY_LLONG_MIN LLONG_MIN
>  #define PY_LLONG_MAX LLONG_MAX
>  #define PY_ULLONG_MAX ULLONG_MAX
> -#elif defined(__s390__)
> -/* Apparently, S390 Linux has long long, but no LLONG_MAX */
> -#define PY_LLONG_MAX 9223372036854775807LL
> +#elif defined(__LONG_LONG_MAX__)
> +/* Otherwise, if GCC has a builtin define, use that. */
> +#define PY_LLONG_MAX __LONG_LONG_MAX__
> +#define PY_LLONG_MIN (-PY_LLONG_MAX-1)
> +#define PY_ULLONG_MAX (__LONG_LONG_MAX__*2ULL + 1ULL)
> +#else
> +/* Otherwise, rely on two's complement. */
> +#define PY_ULLONG_MAX (~0ULL)
> +#define PY_LLONG_MAX  ((long long)(PY_ULLONG_MAX>>1))
>  #define PY_LLONG_MIN (-PY_LLONG_MAX-1)
> -#define PY_ULLONG_MAX 18446744073709551615ULL
>  #endif /* LLONG_MAX */
>  #endif
>  #endif /* HAVE_LONG_LONG */

Building _testcapi on windows/AMD64 still fails with this error:

Compiling...
cl : Command line warning D9002 : ignoring unknown option '/YXstdafx.h'
_testcapimodule.c
\buildbot\trunk.heller-windows-amd64\build\Modules\_testcapimodule.c(913) : error C2065: 'LLONG_MAX' : undeclared identifier
\buildbot\trunk.heller-windows-amd64\build\Modules\_testcapimodule.c(914) : error C2065: 'LLONG_MIN' : undeclared identifier
\buildbot\trunk.heller-windows-amd64\build\Modules\_testcapimodule.c(915) : error C2065: 'ULLONG_MAX' : undeclared identifier

This is the remaining failure in the compile step.  It would be great if anyone knows how to
fix this; I'm running out of time.

Thomas



More information about the Python-checkins mailing list