From 0ad84b5297860975e72ef9a27e2c3218c3628b33 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 2 Sep 2010 11:15:39 +0200 Subject: [PATCH] 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 . --- ChangeLog | 12 ++++++++++++ doc/posix-functions/iswblank.texi | 3 +++ doc/posix-headers/wctype.texi | 3 +++ lib/wctype.in.h | 19 +++++++++++++++++-- m4/wctype_h.m4 | 11 ++++++++++- modules/wctype | 1 + 6 files changed, 46 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f0316e695..edb5ab502 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2010-09-02 Bruno Haible + + 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 . + 2010-09-01 Bruno Haible New module 'socketlib'. diff --git a/doc/posix-functions/iswblank.texi b/doc/posix-functions/iswblank.texi index 8c44aa357..453558e0a 100644 --- a/doc/posix-functions/iswblank.texi +++ b/doc/posix-functions/iswblank.texi @@ -12,6 +12,9 @@ Portability problems fixed by Gnulib: 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 diff --git a/doc/posix-headers/wctype.texi b/doc/posix-headers/wctype.texi index 8f92e5cfd..109deac31 100644 --- a/doc/posix-headers/wctype.texi +++ b/doc/posix-headers/wctype.texi @@ -20,6 +20,9 @@ IRIX 5.3. 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 diff --git a/lib/wctype.in.h b/lib/wctype.in.h index 678247810..e5d26af17 100644 --- a/lib/wctype.in.h +++ b/lib/wctype.in.h @@ -276,11 +276,22 @@ towupper 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 @@ _GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc)); #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)); diff --git a/m4/wctype_h.m4 b/m4/wctype_h.m4 index 329245147..7323e5442 100644 --- 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 , for platforms that lack it. @@ -21,12 +21,21 @@ AC_DEFUN([gl_WCTYPE_H], 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]) diff --git a/modules/wctype b/modules/wctype index b212e35cb..b6407c4c1 100644 --- a/modules/wctype +++ b/modules/wctype @@ -29,6 +29,7 @@ wctype.h: wctype.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) -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)' \ -- 2.11.0