changeset 13618:c28f6dd5002f

wctype: Avoid compilation error on IRIX 6.5.30. * lib/wctype.in.h (iswblank): Declare with a replacement if REPLACE_ISWBLANK is set. * m4/wctype_h.m4 (gl_WCTYPE_H): Check also whether iswblank is declared. Set REPLACE_ISWBLANK. * modules/wctype (Makefile.am): Substitute REPLACE_ISWBLANK. * doc/posix-functions/iswblank.texi: Mention the IRIX 6.5.30 problem. * doc/posix-headers/wctype.texi: Likewise. Reported by Tom G. Christensen <tgc@jupiterrise.com>.
author Bruno Haible <bruno@clisp.org>
date Thu, 02 Sep 2010 11:15:39 +0200
parents 7ec957f3df57
children f2f6c8f28805
files ChangeLog doc/posix-functions/iswblank.texi doc/posix-headers/wctype.texi lib/wctype.in.h m4/wctype_h.m4 modules/wctype
diffstat 6 files changed, 46 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-09-02  Bruno Haible  <bruno@clisp.org>
+
+	wctype: Avoid compilation error on IRIX 6.5.30.
+	* lib/wctype.in.h (iswblank): Declare with a replacement if
+	REPLACE_ISWBLANK is set.
+	* m4/wctype_h.m4 (gl_WCTYPE_H): Check also whether iswblank is
+	declared. Set REPLACE_ISWBLANK.
+	* modules/wctype (Makefile.am): Substitute REPLACE_ISWBLANK.
+	* doc/posix-functions/iswblank.texi: Mention the IRIX 6.5.30 problem.
+	* doc/posix-headers/wctype.texi: Likewise.
+	Reported by Tom G. Christensen <tgc@jupiterrise.com>.
+
 2010-09-01  Bruno Haible  <bruno@clisp.org>
 
 	New module 'socketlib'.
--- a/doc/posix-functions/iswblank.texi
+++ b/doc/posix-functions/iswblank.texi
@@ -12,6 +12,9 @@
 This function is missing on some platforms:
 AIX 4.3.2, IRIX 6.5, OSF/1 5.1, Solaris 9, mingw.
 @item
+This function is declared but not defined on some platforms:
+IRIX 6.5.30.
+@item
 This function returns 0 for all possible arguments on some platforms:
 Linux libc5.
 @end itemize
--- a/doc/posix-headers/wctype.texi
+++ b/doc/posix-headers/wctype.texi
@@ -20,6 +20,9 @@
 The functions @code{isw*} are missing on some platforms:
 FreeBSD 4.11.
 @item
+The function @code{iswblank} is declared but not defined on some platforms:
+IRIX 6.5.30.
+@item
 The functions @code{isw*} are actually defined as macros that don't work,
 on IRIX 5.3.
 @end itemize
--- a/lib/wctype.in.h
+++ b/lib/wctype.in.h
@@ -276,11 +276,22 @@
   return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc);
 }
 
-#elif ! @HAVE_ISWBLANK@
+#elif ! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@
 /* Only the iswblank function is missing.  */
 
+# if @REPLACE_ISWBLANK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define iswblank rpl_iswblank
+#  endif
+# endif
+
 static inline int
-iswblank (wint_t wc)
+# if @REPLACE_ISWBLANK@
+rpl_iswblank
+# else
+iswblank
+# endif
+         (wint_t wc)
 {
   return wc == ' ' || wc == '\t';
 }
@@ -338,7 +349,11 @@
 #else
 _GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc));
 _GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc));
+# if @REPLACE_ISWBLANK@
+_GL_CXXALIAS_RPL (iswblank, int, (wint_t wc));
+# else
 _GL_CXXALIAS_SYS (iswblank, int, (wint_t wc));
+# endif
 _GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc));
 _GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc));
 _GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc));
--- a/m4/wctype_h.m4
+++ b/m4/wctype_h.m4
@@ -1,4 +1,4 @@
-# wctype_h.m4 serial 6
+# wctype_h.m4 serial 7
 
 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
 
@@ -21,12 +21,21 @@
   fi
   AC_SUBST([HAVE_ISWCNTRL])
   AC_CHECK_FUNCS_ONCE([iswblank])
+  AC_CHECK_DECLS_ONCE([iswblank])
   if test $ac_cv_func_iswblank = yes; then
     HAVE_ISWBLANK=1
+    REPLACE_HAVE_ISWBLANK=0
   else
     HAVE_ISWBLANK=0
+    if test $ac_cv_have_decl_iswblank = yes; then
+      REPLACE_HAVE_ISWBLANK=1
+    else
+      REPLACE_HAVE_ISWBLANK=0
+    fi
   fi
   AC_SUBST([HAVE_ISWBLANK])
+  AC_SUBST([REPLACE_ISWBLANK])
+
   AC_CHECK_HEADERS_ONCE([wctype.h])
   AC_REQUIRE([AC_C_INLINE])
 
--- a/modules/wctype
+++ b/modules/wctype
@@ -29,6 +29,7 @@
 	      -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_ISWBLANK''@/$(REPLACE_ISWBLANK)/g' \
 	      -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \
 	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
 	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \