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: Fri, 02 Jan 2009 10:01:34 +0100

"Tom G. Christensen" <address@hidden> wrote:
> On Thu, Jan 01, 2009 at 10:11:11PM +0100, Jim Meyering wrote:
>> [resend after bounce (my problem)]
>> "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.
...
> I built fprintftime on Solaris 2.6 with the patch installed and now the
> build succeeds and the testsuite passes.

Thanks for the quick confirmation.
I've just pushed this:

>From 50ad42330bc3635768964dc2626ffe0823992016 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 2 Jan 2009 09:58:09 +0100
Subject: [PATCH] strftime: avoid compilation failure on Solaris 2.6

* modules/strftime (Depends-on): Add mbrlen and mbsinit.
* lib/strftime.c [DO_MULTIBYTE]: Include <wchar.h> unconditionally.
Don't #define mbrlen or mbsinit, since now they're guaranteed to
be available.  Reported by Tom G. Christensen.  Details in
<http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/16180>.
---
 ChangeLog        |   11 ++++++++++-
 lib/strftime.c   |    9 +--------
 modules/strftime |    2 ++
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f91c5b3..b9eb9bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
+2009-01-02  Jim Meyering  <address@hidden>
+
+       strftime: avoid compilation failure on Solaris 2.6
+       * modules/strftime (Depends-on): Add mbrlen and mbsinit.
+       * lib/strftime.c [DO_MULTIBYTE]: Include <wchar.h> unconditionally.
+       Don't #define mbrlen or mbsinit, since now they're guaranteed to
+       be available.  Reported by Tom G. Christensen.  Details in
+       <http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/16180>.
+
 2009-01-01  Ralf Wildenhues  <address@hidden>
-            Bruno Haible  <address@hidden>
+           Bruno Haible  <address@hidden>

        Speed up gnulib-tool by doing more string processing through shell
        built-ins.
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
--
1.6.1.302.gccd4d




reply via email to

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