What GCC version had <stdint.h> defined?

Scott David Daniels Scott.Daniels at Acm.Org
Sat Aug 28 12:43:09 EDT 2004


Martin v. Löwis wrote:

> Scott David Daniels wrote:
> 
>> I'd like to change it <pyconfig.h> to something like:
>>     ...
>>     #if _MSC_VER > 1200
>>     #define HAVE_UINTPTR_T 1
>>     #define HAVE_INTPTR_T 1
>>     #endif
>>     ...
>>     #if GCC_VERSION >= 30100
>>     #define HAVE_UINTPTR_T 1
>>     #define HAVE_INTPTR_T 1
>>     #endif
>>     ...
>> which is arguably better even if not good enough.

> That won't help at all. PC/pyconfig.h is used only
> on Windows, not on Linux. On Linux, configure is run
> to detect presence of things.

Ah -- but my problem (which I was remiss in not describing well
enough) is just that I cannot compile _at_ _all_ on the Windows
box with minGW.  I don't give a whit about <stdint.h> except to
try to make sure the proper definition happens.  I'd like the
following extension to compile for 2.4 (it won't now) with MinGW:

     #include <Python.h>

     static PyMethodDef xyzMethods[] = {
         {NULL, NULL, 0, NULL}        /* Sentinel */
     };

     #if defined(PyMODINIT_FUNC)
     PyMODINIT_FUNC
     #else
     void
     #endif
     initxyz(void)
     {
         PyObject *module = Py_InitModule("xyz", xyzMethods);
         PyModule_AddStringConstant(module, "test", "value");
     }

The error is roughly:
     In file included from C:/python24/include/Python.h:55,
                  from xyzmodule.c:1:
     C:/python24/include/pyport.h:69: parse error before "Py_uintptr_t"
     C:/python24/include/pyport.h:69: warning: type defaults to `int'
                                      in declaration of `Py_uintptr_t'
     C:/python24/include/pyport.h:69: warning: data definition has
                                      no type or storage class
     C:/python24/include/pyport.h:70: parse error before "Py_intptr_t"
     C:/python24/include/pyport.h:70: warning: type defaults to `int'
                                      in declaration of `Py_intptr_t'
     C:/python24/include/pyport.h:70: warning: data definition has
                                      no type or storage class
     error: command 'gcc' failed with exit status 1


That is, I don't even get to my _own_ broken code.

 >>     #if _MSC_VER > 1200
 >>     #define HAVE_UINTPTR_T 1

>> Is there a better test I can do at compile time?
> 
> Depends on what you want to test for. If it is
> presence of stdint.h, you should test for
> HAVE_STDINT_H.
> 
> Regards,
> Martin

How is this as a change:

 From this:
     #ifdef MS_WIN32
     ...
     /* VC 7.1 has them and VC 6.0 does not.  VC 6.0 has a version
        number of 1200.  If some compiler does not provide them,
        modify the #if appropriately. */
     #if _MSC_VER != 1200
     #define HAVE_UINTPTR_T 1
     #define HAVE_INTPTR_T 1
     #endif

     #endif


To this:

     #ifdef MS_WIN32
     ...
     /* VC 7.1 has them and VC 6.0 does not.  VC 6.0 has a version
        number of 1200.  If some compiler does not provide them,
        modify the #if appropriately. */
     #if _MSC_VER > 1200
     #define HAVE_UINTPTR_T 1
     #define HAVE_INTPTR_T 1
     #elif HAVE_STDINT_H
     #define HAVE_UINTPTR_T 1
     #define HAVE_INTPTR_T 1
     #endif

     #endif


Or if HAVE_STDINT_H is defined under VC 7.1 (I cannot check that)
perhaps the change should become:

     #ifdef MS_WIN32
     ...

     #if HAVE_STDINT_H
     #define HAVE_UINTPTR_T 1
     #define HAVE_INTPTR_T 1
     #endif

     #endif

In any case, thanks for the help so far.

-Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list