Mercurial > hg > octave-lyh > gnulib-hg
changeset 9960:9f9682a4b630
Replace the isw* functions on Linux libc5.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Tue, 22 Apr 2008 01:56:52 +0200 |
parents | 9d11b67c8428 |
children | 794d8915527c |
files | ChangeLog doc/posix-functions/iswalnum.texi doc/posix-functions/iswalpha.texi doc/posix-functions/iswblank.texi doc/posix-functions/iswcntrl.texi doc/posix-functions/iswdigit.texi doc/posix-functions/iswgraph.texi doc/posix-functions/iswlower.texi doc/posix-functions/iswprint.texi doc/posix-functions/iswpunct.texi doc/posix-functions/iswspace.texi doc/posix-functions/iswupper.texi doc/posix-functions/iswxdigit.texi lib/wctype.in.h m4/wctype.m4 modules/wctype |
diffstat | 16 files changed, 154 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2008-04-21 Bruno Haible <bruno@clisp.org> + + * 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 <bruno@clisp.org> * m4/vsnprintf.m4 (gl_FUNC_VSNPRINTF): Fix typo in last commit.
--- a/doc/posix-functions/iswalnum.texi +++ b/doc/posix-functions/iswalnum.texi @@ -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
--- a/doc/posix-functions/iswalpha.texi +++ b/doc/posix-functions/iswalpha.texi @@ -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
--- a/doc/posix-functions/iswblank.texi +++ b/doc/posix-functions/iswblank.texi @@ -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:
--- a/doc/posix-functions/iswcntrl.texi +++ b/doc/posix-functions/iswcntrl.texi @@ -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
--- a/doc/posix-functions/iswdigit.texi +++ b/doc/posix-functions/iswdigit.texi @@ -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
--- a/doc/posix-functions/iswgraph.texi +++ b/doc/posix-functions/iswgraph.texi @@ -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
--- a/doc/posix-functions/iswlower.texi +++ b/doc/posix-functions/iswlower.texi @@ -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
--- a/doc/posix-functions/iswprint.texi +++ b/doc/posix-functions/iswprint.texi @@ -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
--- a/doc/posix-functions/iswpunct.texi +++ b/doc/posix-functions/iswpunct.texi @@ -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
--- a/doc/posix-functions/iswspace.texi +++ b/doc/posix-functions/iswspace.texi @@ -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
--- a/doc/posix-functions/iswupper.texi +++ b/doc/posix-functions/iswupper.texi @@ -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
--- a/doc/posix-functions/iswxdigit.texi +++ b/doc/posix-functions/iswxdigit.texi @@ -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
--- a/lib/wctype.in.h +++ b/lib/wctype.in.h @@ -1,6 +1,6 @@ /* A substitute for ISO C99 <wctype.h>, 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 <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. */ -#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 <ctype.h> macros like _P, and they @@ -78,6 +79,22 @@ # undef iswupper # undef iswxdigit +/* Linux libc5 has <wctype.h> 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) {
--- a/m4/wctype.m4 +++ b/m4/wctype.m4 @@ -1,6 +1,6 @@ dnl A placeholder for ISO C99 <wctype.h>, 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 <stddef.h> + #include <stdio.h> + #include <time.h> + #include <wchar.h> + #include <wctype.h> + int main () { return iswprint ('x') == 0; }], + [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no]) + ], + [ + AC_TRY_COMPILE([#include <stdlib.h> + #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]) ])
--- a/modules/wctype +++ b/modules/wctype @@ -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 $@