bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gawk mbstate_t problem on hppa2.0w-hp-hpux11.11


From: Michael Elizabeth Chastain
Subject: Re: gawk mbstate_t problem on hppa2.0w-hp-hpux11.11
Date: Tue, 9 Dec 2003 12:23:59 -0500 (EST)

Hello Stepan,

mec> +#if defined(__hpux__)
mec> +#include <sys/_mbstate_t.h>
mec> +#endif

stepan> Including the header is not clean solution.  What if a future
stepan> version of HPUX will remove it.  gawk wouldn't bulid then.

You are right.  However, only the HPUX build would break, and it
would be easy to identify the problem.  We would still have the same
problem that we do today, though.

I have run into the same problem in readline, too.

stepan> We've also discussed defining _XOPEN_SOURCE=500 or defining
stepan> _INCLUDE__STDC_A1_SOURCE.

Again I agree with you.  _INCLUDE__STDC_A1_SOURCE is an internal symbol
and I don't want to touch it.  _XOPEN_SOURCE=500 is a documented public
interface, but I did some google searching and found that several people
who turned on _XOPEN_SOURCE=500 in their packages regretted it later.

stepan> Please see also AC_FUNC_MBRTOWC.
stepan> If we use it (insetad of the generic check), it also checks for
stepan> mbstate_t.  If mbstate_t is not declared by wchar.h,
stepan> HAVE_MBRTOWC is not defined.
stepan> 
stepan> The net result would be that on broken platforms (like hpux),
stepan> multibyte support would be switched off.

I am looking at the Single Unix Specification version 3.
mbrtowc is mandatory, but mbstate_t is an XSI extension, and is
available only if _XOPEN_SOURCE is defined.

  http://www.opengroup.org/onlinepubs/007904975/basedefs/wchar.h.html
  http://www.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_02.html

So HPUX is a conforming platform, not a broken platform.

And the HP documentation is here:

  http://www.docs.hp.com/hpux/onlinedocs/5187-3605/00/00/1-con.html

So here is one proposal:

(A1) Add some documentation to README_d/README.hpux which says that the
     user can turn on _XOPEN_SOURCE=500 if they want.

(A2) If _XOPEN_SOURCE=500 is on, then both mbrtowc and mbstate_t are
     available.  Enable multi-byte support.

(A3) If _XOPEN_SOURCE=500 is off, then mbrtowc is available, but
     mbstate_t is not.  Disable multi-byte support.

And here is another proposal:

(B1) Add some documentation to README_d/README.hpux which says that the
     user can turn on _XOPEN_SOURCE=500 if they want.

(B2) If _XOPEN_SOURCE=500 is on, then both mbrtowc and mbstate_t are
     available.  Enable multi-byte support.

(B3) If _XOPEN_SOURCE=500 is off, then mbrtowc is available, but
     mbstate_t is not.  Enable multi-byte support without using
     mbstate_t.  Then, whenever an mbstate_t pointer is needed,
     provide "0" as the pointer value.

readline already implements proposal (B), but it has a glitch in the
implementation.

Note that some HPUX compilers, such as aCC, turn on _XOPEN_SOURCE=500
by default.  And in the long run we can control what gcc does on HPUX
platforms.

I am comfortable with either (A) or (B), but I prefer (B).  Which do you
prefer?  It sounds like you prefer (A).

Michael C




reply via email to

[Prev in Thread] Current Thread [Next in Thread]