bug-gnulib
[Top][All Lists]
Advanced

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

Re: Conflicting types for mblen on Solaris 2.6


From: Jim Meyering
Subject: Re: Conflicting types for mblen on Solaris 2.6
Date: Thu, 01 Jan 2009 22:11:11 +0100

"Tom G. Christensen" <address@hidden> wrote:
> The current daily snapshot is failing to build fprintftime:
> depbase=`echo fprintftime.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
>         gcc -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" 
> -DNO_XMALLOC -DEXEEXT=\"\" -I. -I..  -I../intl -I/usr/tgcware/include 
> -D_REENTRANT  -g -O2 -MT fprintftime.o -MD -MP -MF $depbase.Tpo -c -o 
> fprintftime.o fprintftime.c &&\
>         mv -f $depbase.Tpo $depbase.Po
> In file included from ./stdint.h:482,
>                  from ./stdlib.h:46,
>                  from strftime.c:67,
>                  from fprintftime.c:2:
> ./wchar.h:197: error: conflicting types for 'mblen'
> /usr/tgcware/gcc-4.3.2/lib/gcc/sparc-sun-solaris2.6/4.3.2/include-fixed/stdlib.h:146:
>  error: previous declaration of 'mblen' was here
> make[4]: *** [fprintftime.o] Error 1
>
> stdlib.h:146 is:
> extern int mblen(const char *, size_t);
>
> wchar.h:197 is:
> extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
>
> The type conflict I guess is caused by strftime.c:58:
> #  define mbrlen(s, n, ps) mblen (s, n)
>
> -tgc

Thanks for the report.
Here's a totally untested knee-jerk patch:

Bottom line: now that we have mbrlen and mbsinit modules,
there's no point in testing HAVE_MBRLEN.

diff --git a/lib/strftime.c b/lib/strftime.c
index 897aab7..3ade8cf 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -50,14 +50,7 @@ extern char *tzname[];
 #define DO_MULTIBYTE (HAVE_MBLEN && ! MULTIBYTE_IS_FORMAT_SAFE)

 #if DO_MULTIBYTE
-# if HAVE_MBRLEN
-#  include <wchar.h>
-# else
-   /* Simulate mbrlen with mblen as best we can.  */
-#  define mbstate_t int
-#  define mbrlen(s, n, ps) mblen (s, n)
-#  define mbsinit(ps) (*(ps) == 0)
-# endif
+# include <wchar.h>
   static const mbstate_t mbstate_zero;
 #endif

diff --git a/modules/strftime b/modules/strftime
index cc45452..dc53916 100644
--- a/modules/strftime
+++ b/modules/strftime
@@ -10,6 +10,8 @@ m4/strftime.m4

 Depends-on:
 extensions
+mbrlen
+mbsinit
 stdbool
 time_r
 wchar




reply via email to

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