bug-gnulib
[Top][All Lists]
Advanced

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

wctype: provide iswblank


From: Bruno Haible
Subject: wctype: provide iswblank
Date: Fri, 19 Mar 2010 22:54:47 +0100
User-agent: KMail/1.9.9

On Solaris 8, this test fails:

  source='test-wctype-c++.cc' object='test-wctype-c++.o' libtool=no \
  DEPDIR=.deps depmode=none /bin/bash ./../build-aux/depcomp \
  CC -O -DHAVE_CONFIG_H -I.   -I. -I.  -I.. -I./..  -I../gllib -I./../gllib 
-I/home/haible/prefix-x86/include -D_REENTRANT   -c -o   test-wctype-c++.o 
test-wctype-c++.cc
  "../gllib/wctype.h", line 574: Error: iswblank is not defined.
  1 Error(s) and 60 Warning(s) detected.
  *** Error code 1

The reason is that the iswblank() function does exist and is not replaced by
gnulib. This fixes it.


2010-03-19  Bruno Haible  <address@hidden>

        wctype: Provide iswblank function.
        * lib/wctype.in.h (iswblank): Provide a replacement also when iswcntrl
        exists and is fine.
        * m4/wctype_h.m4 (gl_WCTYPE_H): Also check whether iswcntrl exists.
        * modules/wctype (Makefile.am): Substitute HAVE_ISWBLANK.
        * tests/test-wctype.c (main): Re-enable the iswblank tests.
        * doc/posix-functions/iswblank.texi: Update.

--- doc/posix-functions/iswblank.texi.orig      Fri Mar 19 22:41:11 2010
+++ doc/posix-functions/iswblank.texi   Fri Mar 19 22:28:47 2010
@@ -9,6 +9,9 @@
 Portability problems fixed by Gnulib:
 @itemize
 @item
+This function is missing on some platforms:
+AIX 4.3.2, IRIX 6.5, OSF/1 5.1, Solaris 9, mingw.
address@hidden
 This function returns 0 for all possible arguments on some platforms:
 Linux libc5.
 @end itemize
@@ -16,9 +19,6 @@
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-AIX 4.3.2, IRIX 6.5, OSF/1 5.1, Solaris 9, mingw.
address@hidden
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore 
cannot
 accommodate all Unicode characters.
 @end itemize
--- lib/wctype.in.h.orig        Fri Mar 19 22:41:11 2010
+++ lib/wctype.in.h     Fri Mar 19 22:34:51 2010
@@ -69,7 +69,8 @@
 
 /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
    Linux libc5 has <wctype.h> and the functions but they are broken.
-   Assume all 12 functions are implemented the same way, or not at all.  */
+   Assume all 11 functions (all isw* except iswblank) are implemented the
+   same way, or not at all.  */
 #if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@
 
 /* IRIX 5.3 has macros but no functions, its isw* macros refer to an
@@ -271,7 +272,16 @@
   return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc);
 }
 
-#endif /* ! HAVE_ISWCNTRL || REPLACE_ISWCNTRL */
+#elif ! @HAVE_ISWBLANK@
+/* Only the iswblank function is missing.  */
+
+static inline int
+iswblank (wint_t wc)
+{
+  return wc == ' ' || wc == '\t';
+}
+
+#endif
 
 #if defined __MINGW32__
 
--- m4/wctype_h.m4.orig Fri Mar 19 22:41:11 2010
+++ m4/wctype_h.m4      Fri Mar 19 22:35:28 2010
@@ -1,4 +1,4 @@
-# wctype_h.m4 serial 5
+# wctype_h.m4 serial 6
 
 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
 
@@ -20,6 +20,13 @@
     HAVE_ISWCNTRL=0
   fi
   AC_SUBST([HAVE_ISWCNTRL])
+  AC_CHECK_FUNCS_ONCE([iswblank])
+  if test $ac_cv_func_iswblank = yes; then
+    HAVE_ISWBLANK=1
+  else
+    HAVE_ISWBLANK=0
+  fi
+  AC_SUBST([HAVE_ISWBLANK])
   AC_CHECK_HEADERS_ONCE([wctype.h])
   AC_REQUIRE([AC_C_INLINE])
 
--- modules/wctype.orig Fri Mar 19 22:41:11 2010
+++ modules/wctype      Fri Mar 19 22:35:45 2010
@@ -26,6 +26,7 @@
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
+             -e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \
              -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \
              -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
              -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \
--- tests/test-wctype.c.orig    Fri Mar 19 22:41:11 2010
+++ tests/test-wctype.c Fri Mar 19 22:36:07 2010
@@ -33,9 +33,7 @@
   /* Check that the isw* functions exist as functions or as macros.  */
   (void) iswalnum (0);
   (void) iswalpha (0);
-#if 0 /* not portable: missing on mingw */
   (void) iswblank (0);
-#endif
   (void) iswcntrl (0);
   (void) iswdigit (0);
   (void) iswgraph (0);
@@ -49,9 +47,7 @@
   /* Check that the isw* functions map WEOF to 0.  */
   ASSERT (!iswalnum (e));
   ASSERT (!iswalpha (e));
-#if 0 /* not portable: missing on mingw */
   ASSERT (!iswblank (e));
-#endif
   ASSERT (!iswcntrl (e));
   ASSERT (!iswdigit (e));
   ASSERT (!iswgraph (e));




reply via email to

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