The latest version of XEmacs updated from CVS yesterday (2000-04-03) is
uncompilable under SGI IRIX with the naitive SGI cc compiler.
When compiling alloc.c I get (among others) these errors:
cc-1028 cc: ERROR File = alloc.c, Line = 1085
The expression used must have a constant value.
return offsetof (Lisp_Vector, contents[((Lisp_Vector *) lheader)->size]);
^
cc-1041 cc: ERROR File = alloc.c, Line = 1085
The indicated expression must have arithmetic or pointer type.
return offsetof (Lisp_Vector, contents[((Lisp_Vector *) lheader)->size]);
^
This is because SGI uses the following definition of offsetof:
#if defined(_COMPILER_VERSION) && (_COMPILER_VERSION >= 400)
#define offsetof(t, memb) ((size_t)__INTADDR__(&(((t *)0)->memb)))
#else
#define offsetof(s, m) (size_t)(&(((s *)0)->m))
#endif
With the latest SGI cc, _COMPILER_VERSION is 730. __INTADDR__ is not
documented anywhere and seems to be internal to the compiler. It is at
least not processed in the preprocessor stage of the compilation.
The changes to use of offsetof was made by Martin:
2000-02-12 Martin Buchholz <martin(a)xemacs.org>
* lisp.h (STRETCHY_STRUCT_SIZEOF): Delete.
* fns.c (size_bit_vector):
* alloc.c (size_vector):
(make_vector_internal):
(make_bit_vector_internal):
(sweep_bit_vectors_1):
Replace calls to STRETCHY_STRUCT_SIZEOF with offsetof expression.
Any suggestions what to do? Rewrite the calls to offsetof in Xemacs is
not an easy task.
/torkel