Re: problems building GNULIB allocsa.c on HP/UX 11.0

Bruno Haible <[email protected]> Thu, 4 Nov 2004 14:28:42 +0100
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.comp.version-control.cvs.bugs
Message-ID <[email protected]>
Mark D. Baushke wrote:
> Attempts to build allocsa.c on HP-UX 11.0 using the native compiler
>
> "/u/scjones/cvs-nightly/lib/allocsa.h", line 96: error 1509: Enumeration value must be constant.

GNU gettext already contained a workaround against this. I've put it into
gnulib now. Hope it works for you.

Bruno



	2004-09-11  Bruno Haible  <[email protected]>
		* allocsa.valgrind: New file.
	2004-02-06  Bruno Haible  <[email protected]>
		* allocsa.h (sa_alignof): Define differently with HP-UX cc, to
		avoid a bug of this cc on HP-UX 10.20 dealing with enums.
		Reported by Christopher Seip <[email protected]>.

*** lib/allocsa.h	20 Jan 2004 14:03:28 -0000	1.1
--- lib/allocsa.h	4 Nov 2004 13:32:03 -0000	1.2
***************
*** 1,5 ****
  /* Safe automatic memory allocation.
!    Copyright (C) 2003 Free Software Foundation, Inc.
     Written by Bruno Haible <[email protected]>, 2003.
  
     This program is free software; you can redistribute it and/or modify
--- 1,5 ----
  /* Safe automatic memory allocation.
!    Copyright (C) 2003-2004 Free Software Foundation, Inc.
     Written by Bruno Haible <[email protected]>, 2003.
  
     This program is free software; you can redistribute it and/or modify
***************
*** 77,82 ****
--- 77,86 ----
  #elif defined __cplusplus
    template <class type> struct sa_alignof_helper { char __slot1; type __slot2; };
  # define sa_alignof(type) offsetof (sa_alignof_helper<type>, __slot2)
+ #elif defined __hpux
+   /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof
+      values.  */
+ # define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
  #else
  # define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2)
  #endif