[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gettext 0.14.1 fails to build on HP-UX with HP C compiler
From: |
Bruno Haible |
Subject: |
Re: gettext 0.14.1 fails to build on HP-UX with HP C compiler |
Date: |
Wed, 26 May 2004 14:39:28 +0200 |
User-agent: |
KMail/1.5 |
Albert Chin-A-Young wrote:
> While building gettext-0.14.1 on HP-UX 10.20 and 11.x with the HP C
> compiler:
> ...
> cc: "../../gettext-tools/lib/allocsa.h", line 96: error 1509:
> Enumeration value must be constant.
It's a HP-UX cc bug; please use the appended patch as workaround.
> HP's C compiler doesn't like reusing an enum constant while defining
> the enum.
That's what I thought initially too, but actually the bug is not about
reusing an enum constant while defining an enum. It's about enum constants
defined as offsetof values. See
http://mail.gnu.org/archive/html/bug-gnu-utils/2004-02/msg00031.html
for details.
Bruno
*** gettext-tools/lib/allocsa.h 19 Dec 2003 11:25:19 -0000 1.1
--- gettext-tools/lib/allocsa.h 6 Feb 2004 21:09:50 -0000 1.2
***************
*** 1,5 ****
/* Safe automatic memory allocation.
! Copyright (C) 2003 Free Software Foundation, Inc.
Written by Bruno Haible <address@hidden>, 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 <address@hidden>, 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