summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2008-09-20 14:51:52 +0200
committerBruno Haible <bruno@clisp.org>2008-09-20 14:51:52 +0200
commit6fe332a17fb940b8f7d988ec48968c6316c73ec6 (patch)
tree8ce0c1bca1f0cf9d7e60c752987fe906edbc7311
parentaaca8e8ecf3420607eaf117a557e459f7836371f (diff)
downloadgnulib-6fe332a17fb940b8f7d988ec48968c6316c73ec6.tar.gz
Ensure that wint_t gets defined on IRIX 5.3.
-rw-r--r--ChangeLog16
-rw-r--r--doc/posix-headers/wchar.texi3
-rw-r--r--doc/posix-headers/wctype.texi3
-rw-r--r--lib/wchar.in.h6
-rw-r--r--lib/wctype.in.h31
-rw-r--r--m4/wchar.m415
-rw-r--r--modules/wchar2
-rw-r--r--tests/test-wchar.c6
-rw-r--r--tests/test-wctype.c3
9 files changed, 65 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 8580810106..91db85743e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2008-09-20 Bruno Haible <bruno@clisp.org>
+
+ Ensure that wint_t gets defined on IRIX 5.3.
+ * lib/wchar.in.h (wint_t): Define if not defined by the system.
+ * lib/wctype.in.h (wint_t): Likewise.
+ (__wctype_wint_t): Remove type.
+ (isw*): Use wint_t instead of __wctype_wint_t.
+ * m4/wchar.m4 (gl_WCHAR_H): Invoke gt_TYPE_WINT_T and set HAVE_WINT_T.
+ * modules/wchar (Files): Add m4/wint_t.m4.
+ (Makefile.am): Substitute HAVE_WINT_T.
+ * tests/test-wchar.c: Check that wchar_t and wint_t are defined.
+ * tests/test-wctype.c: Check that wint_t is defined.
+ * doc/posix-headers/wchar.texi: Mention the IRIX 5 problem.
+ * doc/posix-headers/wctype.texi: Likewise.
+ Reported by Tom G. Christensen <tgc@jupiterrise.com>.
+
2008-09-18 Bruno Haible <bruno@clisp.org>
* gnulib-tool (func_exit): Update comment.
diff --git a/doc/posix-headers/wchar.texi b/doc/posix-headers/wchar.texi
index 163109f5e3..5e121e8286 100644
--- a/doc/posix-headers/wchar.texi
+++ b/doc/posix-headers/wchar.texi
@@ -13,6 +13,9 @@ Linux uClibc built without wide character support.
@item
This header file is not self-contained on some platforms:
OSF/1 with Desktop Toolkit C, BSD/OS 4.0.1.
+@item
+The type @code{wint_t} is missing on some platforms:
+IRIX 5.3.
@end itemize
Portability problems not fixed by Gnulib:
diff --git a/doc/posix-headers/wctype.texi b/doc/posix-headers/wctype.texi
index 24e1be1617..ff56cbaeb9 100644
--- a/doc/posix-headers/wctype.texi
+++ b/doc/posix-headers/wctype.texi
@@ -14,6 +14,9 @@ HP-UX 11.00, BeOS.
This header file is not self-contained on some platforms:
Solaris 2.5, OSF/1 with Desktop Toolkit C, BSD/OS 4.0.1.
@item
+The type @code{wint_t} is missing on some platforms:
+IRIX 5.3.
+@item
The functions @code{isw*} are missing on some platforms:
FreeBSD 4.11.
@item
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index 8ed292ccce..606a70a1c7 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -63,6 +63,12 @@ extern "C" {
#endif
+/* Define wint_t. (Also done in wctype.in.h.) */
+#if !@HAVE_WINT_T@ && !defined wint_t
+# define wint_t int
+#endif
+
+
/* Return the number of screen columns needed for WC. */
#if @GNULIB_WCWIDTH@
# if @REPLACE_WCWIDTH@
diff --git a/lib/wctype.in.h b/lib/wctype.in.h
index fc1b5c0827..e3ed3679e8 100644
--- a/lib/wctype.in.h
+++ b/lib/wctype.in.h
@@ -52,10 +52,9 @@
#ifndef _GL_WCTYPE_H
#define _GL_WCTYPE_H
-#if @HAVE_WINT_T@
-typedef wint_t __wctype_wint_t;
-#else
-typedef int __wctype_wint_t;
+/* Define wint_t. (Also done in wchar.in.h.) */
+#if !@HAVE_WINT_T@ && !defined wint_t
+# define wint_t int
#endif
/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
@@ -98,56 +97,56 @@ typedef int __wctype_wint_t;
# endif
static inline int
-iswalnum (__wctype_wint_t wc)
+iswalnum (wint_t wc)
{
return ((wc >= '0' && wc <= '9')
|| ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
}
static inline int
-iswalpha (__wctype_wint_t wc)
+iswalpha (wint_t wc)
{
return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
}
static inline int
-iswblank (__wctype_wint_t wc)
+iswblank (wint_t wc)
{
return wc == ' ' || wc == '\t';
}
static inline int
-iswcntrl (__wctype_wint_t wc)
+iswcntrl (wint_t wc)
{
return (wc & ~0x1f) == 0 || wc == 0x7f;
}
static inline int
-iswdigit (__wctype_wint_t wc)
+iswdigit (wint_t wc)
{
return wc >= '0' && wc <= '9';
}
static inline int
-iswgraph (__wctype_wint_t wc)
+iswgraph (wint_t wc)
{
return wc >= '!' && wc <= '~';
}
static inline int
-iswlower (__wctype_wint_t wc)
+iswlower (wint_t wc)
{
return wc >= 'a' && wc <= 'z';
}
static inline int
-iswprint (__wctype_wint_t wc)
+iswprint (wint_t wc)
{
return wc >= ' ' && wc <= '~';
}
static inline int
-iswpunct (__wctype_wint_t wc)
+iswpunct (wint_t wc)
{
return (wc >= '!' && wc <= '~'
&& !((wc >= '0' && wc <= '9')
@@ -155,20 +154,20 @@ iswpunct (__wctype_wint_t wc)
}
static inline int
-iswspace (__wctype_wint_t wc)
+iswspace (wint_t wc)
{
return (wc == ' ' || wc == '\t'
|| wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
}
static inline int
-iswupper (__wctype_wint_t wc)
+iswupper (wint_t wc)
{
return wc >= 'A' && wc <= 'Z';
}
static inline int
-iswxdigit (__wctype_wint_t wc)
+iswxdigit (wint_t wc)
{
return ((wc >= '0' && wc <= '9')
|| ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
diff --git a/m4/wchar.m4 b/m4/wchar.m4
index 70b1248f8f..c1ed2c6d39 100644
--- a/m4/wchar.m4
+++ b/m4/wchar.m4
@@ -1,13 +1,13 @@
dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-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.
dnl Written by Eric Blake.
-# wchar.m4 serial 4
+# wchar.m4 serial 5
AC_DEFUN([gl_WCHAR_H],
[
@@ -18,7 +18,16 @@ AC_DEFUN([gl_WCHAR_H],
wchar_t w;]],
[gl_cv_header_wchar_h_standalone=yes],
[gl_cv_header_wchar_h_standalone=no])])
- if test $gl_cv_header_wchar_h_standalone != yes; then
+
+ AC_REQUIRE([gt_TYPE_WINT_T])
+ if test $gt_cv_c_wint_t = yes; then
+ HAVE_WINT_T=1
+ else
+ HAVE_WINT_T=0
+ fi
+ AC_SUBST([HAVE_WINT_T])
+
+ if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes; then
WCHAR_H=wchar.h
fi
diff --git a/modules/wchar b/modules/wchar
index 423558d94e..381f4758db 100644
--- a/modules/wchar
+++ b/modules/wchar
@@ -4,6 +4,7 @@ A <wchar.h> that works around platform issues.
Files:
lib/wchar.in.h
m4/wchar.m4
+m4/wint_t.m4
Depends-on:
include_next
@@ -25,6 +26,7 @@ wchar.h: wchar.in.h
-e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
-e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
-e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
+ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
-e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
-e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
diff --git a/tests/test-wchar.c b/tests/test-wchar.c
index 85b15b59fa..19da7d93c0 100644
--- a/tests/test-wchar.c
+++ b/tests/test-wchar.c
@@ -1,5 +1,5 @@
/* Test of <wchar.h> substitute.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-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
@@ -20,6 +20,10 @@
#include <wchar.h>
+/* Check that the types wchar_t and wint_t are defined. */
+wchar_t a = 'c';
+wint_t b = 'x';
+
int
main ()
{
diff --git a/tests/test-wctype.c b/tests/test-wctype.c
index 287a58351f..c2d8601664 100644
--- a/tests/test-wctype.c
+++ b/tests/test-wctype.c
@@ -20,6 +20,9 @@
#include <wctype.h>
+/* Check that the type wint_t is defined. */
+wint_t a = 'x';
+
int
main ()
{