Re: __UINT_LEAST8_MAX__ and HP-UX 11.23/IA

Albert Chin <[email protected]>
Newsgroups gmane.comp.parsers.bison.bugs
Message-ID <[email protected]>
On Wed, Jan 20, 2021 at 06:52:37PM -0800, Paul Eggert wrote:
> [Resending as the first message had the incorrect "bus-bison" as the return
> address.]
> 
> On 1/20/21 3:50 PM, Albert Chin wrote:
> 
> > > Unfortunately, on HP-UX 11.23/IA, UINT_LEAST8_MAX evaluates to
> > > ((unsigned char)(255)) causing a problem with:
> > >    #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
> > >           && UINT_LEAST8_MAX <= INT_MAX)
> > 
> > This is also an issue for UINT_LEAST16_MAX.
> That is a known bug in HP-UX 11.23 that Gnulib has had a workaround for
> since 2009. See:
> 
> https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=3a4f1890986aeea9906c261c146bfaab4136a263
> 
> I suppose Bison cannot assume that Gnulib is in use, unfortunately.
> 
> Does the attached Bison patch fix the problem for you?

Yes, it would fix it. We're currently doing something like the
attached.

-- 
albert chin ([email protected])
hpux.patch (text/x-diff, 920 B)
Index: data/skeletons/c.m4
===================================================================
--- data/skeletons/c.m4.orig	2020-11-14 10:49:43.000000000 +0000
+++ data/skeletons/c.m4	2021-01-21 17:45:39.699054963 +0000
@@ -242,6 +242,10 @@
 typedef short yytype_int16;
 #endif
 
+#if defined __hpux && defined UINT_LEAST8_MAX
+#undef UINT_LEAST8_MAX
+#define UINT_LEAST8_MAX 255
+#endif
 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
@@ -253,6 +257,10 @@
 typedef short yytype_uint8;
 #endif
 
+#if defined __hpux && defined UINT_LEAST16_MAX
+#undef UINT_LEAST16_MAX
+#define UINT_LEAST16_MAX 65535
+#endif
 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.