# HG changeset patch # User Bruno Haible # Date 1208822212 -7200 # Node ID 9f9682a4b6301df62560fee835f6adf0cb47a172 # Parent 9d11b67c842838ac876a7c4978da047ab547e5d7 Replace the isw* functions on Linux libc5. diff -r 9d11b67c8428 -r 9f9682a4b630 ChangeLog --- a/ChangeLog Tue Apr 22 01:19:07 2008 +0200 +++ b/ChangeLog Tue Apr 22 01:56:52 2008 +0200 @@ -1,3 +1,25 @@ +2008-04-21 Bruno Haible + + * lib/wctype.in.h (iswalnum, iswalpha, iswblank, iswcntrl, iswdigit, + iswgraph, iswlower, iswprint, iswpunct, iswspace, iswupper, iswxdigit): + Define to replacements if REPLACE_ISWCNTRL is 1. + * m4/wctype.m4 (gl_WCTYPE_H): Test whether the isw* functions work. + If not, set WCTYPE_H to nonempty and REPLACE_ISWCNTRL to 1. + * modules/wctype (Makefile.am): Substitute REPLACE_ISWCNTRL. + * doc/posix-functions/iswalnum.texi: Mention the 'wctype' module and + what it fixes. + * doc/posix-functions/iswalpha.texi: Likewise. + * doc/posix-functions/iswblank.texi: Likewise. + * doc/posix-functions/iswcntrl.texi: Likewise. + * doc/posix-functions/iswdigit.texi: Likewise. + * doc/posix-functions/iswgraph.texi: Likewise. + * doc/posix-functions/iswlower.texi: Likewise. + * doc/posix-functions/iswprint.texi: Likewise. + * doc/posix-functions/iswpunct.texi: Likewise. + * doc/posix-functions/iswspace.texi: Likewise. + * doc/posix-functions/iswupper.texi: Likewise. + * doc/posix-functions/iswxdigit.texi: Likewise. + 2008-04-21 Bruno Haible * m4/vsnprintf.m4 (gl_FUNC_VSNPRINTF): Fix typo in last commit. diff -r 9d11b67c8428 -r 9f9682a4b630 doc/posix-functions/iswalnum.texi --- a/doc/posix-functions/iswalnum.texi Tue Apr 22 01:19:07 2008 +0200 +++ b/doc/posix-functions/iswalnum.texi Tue Apr 22 01:56:52 2008 +0200 @@ -4,18 +4,21 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswalnum.html} -Gnulib module: --- +Gnulib module: wctype Portability problems fixed by Gnulib: @itemize +@item +This function is missing on some platforms: +Solaris 2.5.1. +@item +This function returns 0 for all possible arguments on some platforms: +Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: -Solaris 2.5.1. -@item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize diff -r 9d11b67c8428 -r 9f9682a4b630 doc/posix-functions/iswalpha.texi --- a/doc/posix-functions/iswalpha.texi Tue Apr 22 01:19:07 2008 +0200 +++ b/doc/posix-functions/iswalpha.texi Tue Apr 22 01:56:52 2008 +0200 @@ -4,18 +4,21 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswalpha.html} -Gnulib module: --- +Gnulib module: wctype Portability problems fixed by Gnulib: @itemize +@item +This function is missing on some platforms: +Solaris 2.5.1. +@item +This function returns 0 for all possible arguments on some platforms: +Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: -Solaris 2.5.1. -@item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize diff -r 9d11b67c8428 -r 9f9682a4b630 doc/posix-functions/iswblank.texi --- a/doc/posix-functions/iswblank.texi Tue Apr 22 01:19:07 2008 +0200 +++ b/doc/posix-functions/iswblank.texi Tue Apr 22 01:56:52 2008 +0200 @@ -4,10 +4,13 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswblank.html} -Gnulib module: --- +Gnulib module: wctype Portability problems fixed by Gnulib: @itemize +@item +This function returns 0 for all possible arguments on some platforms: +Linux libc5. @end itemize Portability problems not fixed by Gnulib: diff -r 9d11b67c8428 -r 9f9682a4b630 doc/posix-functions/iswcntrl.texi --- a/doc/posix-functions/iswcntrl.texi Tue Apr 22 01:19:07 2008 +0200 +++ b/doc/posix-functions/iswcntrl.texi Tue Apr 22 01:56:52 2008 +0200 @@ -4,18 +4,21 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswcntrl.html} -Gnulib module: --- +Gnulib module: wctype Portability problems fixed by Gnulib: @itemize +@item +This function is missing on some platforms: +Solaris 2.5.1. +@item +This function returns 0 for all possible arguments on some platforms: +Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: -Solaris 2.5.1. -@item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize diff -r 9d11b67c8428 -r 9f9682a4b630 doc/posix-functions/iswdigit.texi --- a/doc/posix-functions/iswdigit.texi Tue Apr 22 01:19:07 2008 +0200 +++ b/doc/posix-functions/iswdigit.texi Tue Apr 22 01:56:52 2008 +0200 @@ -4,18 +4,21 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswdigit.html} -Gnulib module: --- +Gnulib module: wctype Portability problems fixed by Gnulib: @itemize +@item +This function is missing on some platforms: +Solaris 2.5.1. +@item +This function returns 0 for all possible arguments on some platforms: +Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: -Solaris 2.5.1. -@item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize diff -r 9d11b67c8428 -r 9f9682a4b630 doc/posix-functions/iswgraph.texi --- a/doc/posix-functions/iswgraph.texi Tue Apr 22 01:19:07 2008 +0200 +++ b/doc/posix-functions/iswgraph.texi Tue Apr 22 01:56:52 2008 +0200 @@ -4,18 +4,21 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswgraph.html} -Gnulib module: --- +Gnulib module: wctype Portability problems fixed by Gnulib: @itemize +@item +This function is missing on some platforms: +Solaris 2.5.1. +@item +This function returns 0 for all possible arguments on some platforms: +Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: -Solaris 2.5.1. -@item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize diff -r 9d11b67c8428 -r 9f9682a4b630 doc/posix-functions/iswlower.texi --- a/doc/posix-functions/iswlower.texi Tue Apr 22 01:19:07 2008 +0200 +++ b/doc/posix-functions/iswlower.texi Tue Apr 22 01:56:52 2008 +0200 @@ -4,18 +4,21 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswlower.html} -Gnulib module: --- +Gnulib module: wctype Portability problems fixed by Gnulib: @itemize +@item +This function is missing on some platforms: +Solaris 2.5.1. +@item +This function returns 0 for all possible arguments on some platforms: +Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: -Solaris 2.5.1. -@item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize diff -r 9d11b67c8428 -r 9f9682a4b630 doc/posix-functions/iswprint.texi --- a/doc/posix-functions/iswprint.texi Tue Apr 22 01:19:07 2008 +0200 +++ b/doc/posix-functions/iswprint.texi Tue Apr 22 01:56:52 2008 +0200 @@ -4,18 +4,21 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswprint.html} -Gnulib module: --- +Gnulib module: wctype Portability problems fixed by Gnulib: @itemize +@item +This function is missing on some platforms: +Solaris 2.5.1. +@item +This function returns 0 for all possible arguments on some platforms: +Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: -Solaris 2.5.1. -@item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize diff -r 9d11b67c8428 -r 9f9682a4b630 doc/posix-functions/iswpunct.texi --- a/doc/posix-functions/iswpunct.texi Tue Apr 22 01:19:07 2008 +0200 +++ b/doc/posix-functions/iswpunct.texi Tue Apr 22 01:56:52 2008 +0200 @@ -4,18 +4,21 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswpunct.html} -Gnulib module: --- +Gnulib module: wctype Portability problems fixed by Gnulib: @itemize +@item +This function is missing on some platforms: +Solaris 2.5.1. +@item +This function returns 0 for all possible arguments on some platforms: +Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: -Solaris 2.5.1. -@item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize diff -r 9d11b67c8428 -r 9f9682a4b630 doc/posix-functions/iswspace.texi --- a/doc/posix-functions/iswspace.texi Tue Apr 22 01:19:07 2008 +0200 +++ b/doc/posix-functions/iswspace.texi Tue Apr 22 01:56:52 2008 +0200 @@ -4,18 +4,21 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswspace.html} -Gnulib module: --- +Gnulib module: wctype Portability problems fixed by Gnulib: @itemize +@item +This function is missing on some platforms: +Solaris 2.5.1. +@item +This function returns 0 for all possible arguments on some platforms: +Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: -Solaris 2.5.1. -@item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize diff -r 9d11b67c8428 -r 9f9682a4b630 doc/posix-functions/iswupper.texi --- a/doc/posix-functions/iswupper.texi Tue Apr 22 01:19:07 2008 +0200 +++ b/doc/posix-functions/iswupper.texi Tue Apr 22 01:56:52 2008 +0200 @@ -4,18 +4,21 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswupper.html} -Gnulib module: --- +Gnulib module: wctype Portability problems fixed by Gnulib: @itemize +@item +This function is missing on some platforms: +Solaris 2.5.1. +@item +This function returns 0 for all possible arguments on some platforms: +Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: -Solaris 2.5.1. -@item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize diff -r 9d11b67c8428 -r 9f9682a4b630 doc/posix-functions/iswxdigit.texi --- a/doc/posix-functions/iswxdigit.texi Tue Apr 22 01:19:07 2008 +0200 +++ b/doc/posix-functions/iswxdigit.texi Tue Apr 22 01:56:52 2008 +0200 @@ -4,18 +4,21 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswxdigit.html} -Gnulib module: --- +Gnulib module: wctype Portability problems fixed by Gnulib: @itemize +@item +This function is missing on some platforms: +Solaris 2.5.1. +@item +This function returns 0 for all possible arguments on some platforms: +Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: -Solaris 2.5.1. -@item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize diff -r 9d11b67c8428 -r 9f9682a4b630 lib/wctype.in.h --- a/lib/wctype.in.h Tue Apr 22 01:19:07 2008 +0200 +++ b/lib/wctype.in.h Tue Apr 22 01:56:52 2008 +0200 @@ -1,6 +1,6 @@ /* A substitute for ISO C99 , for platforms that lack it. - Copyright (C) 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2006-2008 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,8 +57,9 @@ #endif /* FreeBSD 4.4 to 4.11 has but lacks the functions. + Linux libc5 has and the functions but they are broken. Assume all 12 functions are implemented the same way, or not at all. */ -#if ! @HAVE_ISWCNTRL@ +#if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@ /* IRIX 5.3 has macros but no functions, its isw* macros refer to an undefined variable _ctmp_ and to macros like _P, and they @@ -78,6 +79,22 @@ # undef iswupper # undef iswxdigit +/* Linux libc5 has and the functions but they are broken. */ +# if @REPLACE_ISWCNTRL@ +# define iswalnum rpl_iswalnum +# define iswalpha rpl_iswalpha +# define iswblank rpl_iswblank +# define iswcntrl rpl_iswcntrl +# define iswdigit rpl_iswdigit +# define iswgraph rpl_iswgraph +# define iswlower rpl_iswlower +# define iswprint rpl_iswprint +# define iswpunct rpl_iswpunct +# define iswspace rpl_iswspace +# define iswupper rpl_iswupper +# define iswxdigit rpl_iswxdigit +# endif + static inline int iswalnum (__wctype_wint_t wc) { diff -r 9d11b67c8428 -r 9f9682a4b630 m4/wctype.m4 --- a/m4/wctype.m4 Tue Apr 22 01:19:07 2008 +0200 +++ b/m4/wctype.m4 Tue Apr 22 01:56:52 2008 +0200 @@ -1,6 +1,6 @@ dnl A placeholder for ISO C99 , for platforms that lack it. -dnl Copyright (C) 2006, 2007 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,6 +9,7 @@ AC_DEFUN([gl_WCTYPE_H], [ + AC_REQUIRE([AC_PROG_CC]) AC_CHECK_FUNCS_ONCE([iswcntrl]) if test $ac_cv_func_iswcntrl = yes; then HAVE_ISWCNTRL=1 @@ -30,7 +31,28 @@ WCTYPE_H=wctype.h if test $ac_cv_header_wctype_h = yes; then if test $ac_cv_func_iswcntrl = yes; then - WCTYPE_H= + dnl Linux libc5 has an iswprint function that returns 0 for all arguments. + dnl The other functions are likely broken in the same way. + AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works], + [ + AC_TRY_RUN([#include + #include + #include + #include + #include + int main () { return iswprint ('x') == 0; }], + [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no]) + ], + [ + AC_TRY_COMPILE([#include + #if __GNU_LIBRARY__ == 1 + Linux libc5 i18n is broken. + #endif], + [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no]) + ]) + if test $gl_cv_func_iswcntrl_works = yes; then + WCTYPE_H= + fi fi dnl Compute NEXT_WCTYPE_H even if WCTYPE_H is empty, dnl for the benefit of builds from non-distclean directories. @@ -41,4 +63,11 @@ fi AC_SUBST([HAVE_WCTYPE_H]) AC_SUBST([WCTYPE_H]) + + if test "$gl_cv_func_iswcntrl_works" = no; then + REPLACE_ISWCNTRL=1 + else + REPLACE_ISWCNTRL=0 + fi + AC_SUBST([REPLACE_ISWCNTRL]) ]) diff -r 9d11b67c8428 -r 9f9682a4b630 modules/wctype --- a/modules/wctype Tue Apr 22 01:19:07 2008 +0200 +++ b/modules/wctype Tue Apr 22 01:56:52 2008 +0200 @@ -25,6 +25,7 @@ -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ + -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \ < $(srcdir)/wctype.in.h; \ } > $@-t mv $@-t $@