Building Python 2.2.1 for HP Tru64 UNIX V4.0F

change changeme at changeme
Wed Oct 9 15:21:47 CEST 2002


Hi,

I'm trying to build Python 2.2.1 for HP (COMPAQ) Tru64 UNIX V4.0F with the
debug option.

The build fails in Python/marshal.c:

cc -c -O -Olimit 1500 -I. -I./Include -DHAVE_CONFIG_H  -o Python/marshal.o
Python/marshal.c
cc: Error: Python/marshal.c, line 64: Invalid expression. (badexpr)
                *p->ptr++ = Py_SAFE_DOWNCAST(c, int, char);
----------------------------^
cc: Error: Python/marshal.c, line 64: Invalid statement. (badstmt)
                *p->ptr++ = Py_SAFE_DOWNCAST(c, int, char);
----------------------------^
*** Exit 1
Stop.


The problem seems to be the definition of Py_SAFE_DOWNCAST in
Include/pyport.h

#ifdef Py_DEBUG
#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) \
        (assert((WIDE)(NARROW)(VALUE) == (VALUE)), (NARROW)(VALUE))
#else
#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) (NARROW)(VALUE)
#endif


I also wrote a simple c program mimicking this behavior:

#include <stdio.h>
#include <assert.h>


#define SAFE_DOWNCAST(VALUE, WIDE, NARROW)  (assert ((WIDE)(NARROW)(VALUE)
== (VALUE)), (NARROW)(VALUE))

main () {

  char p ;
  int c ;

  c = 65 ;
  p = SAFE_DOWNCAST(c, int, char) ;

  printf ("INT is: %d  and CHAR is: %c\n", c, p) ;

}


This program does not seem to compile with the cc or the gcc compilers. Is
there a problem with my C compilers or the switches I use with them?

Thanks,

Narendra






More information about the Python-list mailing list