[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] mbrtowc: port better to narrow-wchar_t platforms
From: |
Bruno Haible |
Subject: |
Re: [PATCH] mbrtowc: port better to narrow-wchar_t platforms |
Date: |
Thu, 02 Jan 2020 12:49:50 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-170-generic; KDE/5.18.0; x86_64; ; ) |
Paul Eggert wrote on 2019-12-26:
> + unsigned int wc
> + = (((unsigned int) (c & 0x0f) << 12)
> + | ((unsigned int) (c2 ^ 0x80) << 6)
> + | (unsigned int) (c3 ^ 0x80));
> + if (wc <= WCHAR_MAX)
> + {
> + if (pwc != NULL)
> + *pwc = wc;
> + res = 3;
> + goto success;
> + }
This causes a compilation error on IRIX 6.5:
depbase=`echo mbrtowc.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -mabi=n32 -DHAVE_CONFIG_H -I. -I../../gllib -I..
-DGNULIB_STRICT_CHECKING=1 -I/u/guest/bruno/prefix-n32-gcc/include -Wall -g
-O2 -MT mbrtowc.o -MD -MP -MF $depbase.Tpo -c -o mbrtowc.o
../../gllib/mbrtowc.c &&\
mv -f $depbase.Tpo $depbase.Po
../../gllib/mbrtowc.c:97: warning: missing braces around initializer
../../gllib/mbrtowc.c:97: warning: (near initialization for `mbtowc_lock.__D')
../../gllib/mbrtowc.c: In function `mbrtowc':
../../gllib/mbrtowc.c:221: error: `WCHAR_MAX' undeclared (first use in this
function)
../../gllib/mbrtowc.c:221: error: (Each undeclared identifier is reported only
once
../../gllib/mbrtowc.c:221: error: for each function it appears in.)
gmake[3]: *** [Makefile:1516: mbrtowc.o] Error 1
This patch fixes it:
2020-01-02 Bruno Haible <address@hidden>
mbrtowc: Fix compilation error on IRIX (regression from 2019-12-26).
* lib/mbrtowc.c: Include <stdint.h>.
* modules/mbrtowc (Depends-on): Add stdint.
diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c
index 14467e6..9cc9f5d 100644
--- a/lib/mbrtowc.c
+++ b/lib/mbrtowc.c
@@ -29,6 +29,7 @@
/* Implement mbrtowc() on top of mbtowc(). */
# include <errno.h>
+# include <stdint.h>
# include <stdlib.h>
# include "localcharset.h"
diff --git a/modules/mbrtowc b/modules/mbrtowc
index 9c3efe1..d2dc54c 100644
--- a/modules/mbrtowc
+++ b/modules/mbrtowc
@@ -13,6 +13,7 @@ m4/codeset.m4
Depends-on:
wchar
extensions
+stdint [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
hard-locale [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
mbsinit [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
localcharset [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH] mbrtowc: port better to narrow-wchar_t platforms,
Bruno Haible <=