problems building GNULIB allocsa.c on HP/UX 11.0

"Mark D. Baushke" <[email protected]> Thu, 04 Nov 2004 00:27:58 -0800
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.comp.version-control.cvs.bugs
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Attempts to build allocsa.c on HP-UX 11.0 using the native compiler are
running into some problems:

> HP-UX hp186 B.11.00 A 9000/785 2002119839 two-user license

source='/u/scjones/cvs-nightly/lib/allocsa.c' object='allocsa.o' libtool=no \
DEPDIR=.deps depmode=hp /bin/sh /u/scjones/cvs-nightly/depcomp \
cc -DHAVE_CONFIG_H -I. -I/u/scjones/cvs-nightly/lib -I..   -Ino/include  -g -c /u/scjones/cvs-nightly/lib/allocsa.c
cc: "/u/scjones/cvs-nightly/lib/allocsa.h", line 96: error 1509: Enumeration value must be constant.
cc: "/u/scjones/cvs-nightly/lib/allocsa.h", line 106: warning 551: Integer division by zero.
cc: "/u/scjones/cvs-nightly/lib/allocsa.c", line 54: warning 551: Integer division by zero.
cc: line 54: error 2162: Size of "room" exceeds compiler limits.

This is using the top-of-tree GNULIB version of allocsa.c and allocsa.h
where the allocasa.h enum with 

  sa_alignment_max =  ((sa_alignment_long - 1) | (sa_alignment_double - 1)

on it is the line 96 problem. Line 106 is here:

  sa_increment = ((sizeof (int) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max

and line 54 of allocsa.c is

struct header { void *next; char room[HEADER_SIZE - sizeof (struct preliminary_header) + MAGIC_SIZE]; };

Is there another (more portable) method of setting up this enum that
will work for the HP/UX native compiler?

	Thanks,
	-- Mark

 --------------- extract from allocsa.h ---------------
enum
{
/* The desired alignment of memory allocations is the maximum alignment
   among all elementary types.  */
  sa_alignment_long = sa_alignof (long),
  sa_alignment_double = sa_alignof (double),
#ifdef HAVE_LONG_LONG
  sa_alignment_longlong = sa_alignof (long long),
#endif
#ifdef HAVE_LONG_DOUBLE 
  sa_alignment_longdouble = sa_alignof (long double),
#endif
  sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1)
#ifdef HAVE_LONG_LONG
		      | (sa_alignment_longlong - 1)
#endif
#ifdef HAVE_LONG_DOUBLE 
		      | (sa_alignment_longdouble - 1)
#endif
		     ) + 1,
/* The increment that guarantees room for a magic word must be >= sizeof (int)
   and a multiple of sa_alignment_max.  */
  sa_increment = ((sizeof (int) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max
};
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQFBiegO3x41pRYZE/gRAtrqAJ9Po3ZExP+xiv4017lTzBt6Z/g29ACfZCfe
T1QRrD9czLNCZ0065eENGzY=
=J3nJ
-----END PGP SIGNATURE-----