summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2019-12-13 08:51:11 +0100
committerBruno Haible <bruno@clisp.org>2019-12-13 08:51:11 +0100
commit53ce0d7e3228d9df20708c457d256b86269ff07d (patch)
tree4eb1174cb597ae5e3581792994361c0ea72c1595
parent1fabf601fa87579a9eaed42c92c6bb9a97922c1d (diff)
downloadgnulib-53ce0d7e3228d9df20708c457d256b86269ff07d.tar.gz
gnulib-53ce0d7e3228d9df20708c457d256b86269ff07d.tar.bz2
wcstok: Fix test failure on HP-UX.
* m4/wcstok.m4 (gl_FUNC_WCSTOK): Set REPLACE_WCSTOK to 1 on HP-UX. * doc/posix-functions/wcstok.texi: Mention the HP-UX bug.
-rw-r--r--ChangeLog6
-rw-r--r--doc/posix-functions/wcstok.texi5
-rw-r--r--m4/wcstok.m442
3 files changed, 38 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index b0c7543e53..e9fb770a6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-12-13 Bruno Haible <bruno@clisp.org>
+
+ wcstok: Fix test failure on HP-UX.
+ * m4/wcstok.m4 (gl_FUNC_WCSTOK): Set REPLACE_WCSTOK to 1 on HP-UX.
+ * doc/posix-functions/wcstok.texi: Mention the HP-UX bug.
+
2019-12-12 Bruno Haible <bruno@clisp.org>
strtod, strtold tests: Avoid test failure on AIX 7.2.
diff --git a/doc/posix-functions/wcstok.texi b/doc/posix-functions/wcstok.texi
index 51bb65621b..edf30fa3c3 100644
--- a/doc/posix-functions/wcstok.texi
+++ b/doc/posix-functions/wcstok.texi
@@ -14,6 +14,11 @@ Cygwin 1.5.x.
@item
This function takes only two arguments on some platforms:
mingw, older MSVC.
+@item
+This function may use hidden state, ignoring the third argument, and thus
+exhibit a bug when two or more @code{wcstok} iteration loops are being performed
+in the same thread, on some platforms:
+HP-UX 11.31.
@end itemize
Portability problems not fixed by Gnulib:
diff --git a/m4/wcstok.m4 b/m4/wcstok.m4
index 8f0aeb0f54..0001eafe6d 100644
--- a/m4/wcstok.m4
+++ b/m4/wcstok.m4
@@ -1,4 +1,4 @@
-# wcstok.m4 serial 3
+# wcstok.m4 serial 4
dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -7,15 +7,25 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_WCSTOK],
[
AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+ AC_REQUIRE([AC_CANONICAL_HOST])
AC_CHECK_FUNCS_ONCE([wcstok])
if test $ac_cv_func_wcstok = yes; then
- dnl POSIX: wchar_t *wcstok (wchar_t *, const wchar_t *, wchar_t **);
- dnl mingw, MSVC: wchar_t *wcstok (wchar_t *, const wchar_t *);
- AC_CACHE_CHECK([for wcstok with POSIX signature],
- [gl_cv_func_wcstok_posix_signature],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
+ dnl On HP-UX 11.31, it depends on the compiler and linker whether wcstok()
+ dnl uses hidden state, ignoring the third argument, and thus exhibits a
+ dnl bug when two or more wcstok() iteration loops are being performed in
+ dnl the same thread.
+ case "$host_os" in
+ hpux*)
+ REPLACE_WCSTOK=1
+ ;;
+ *)
+ dnl POSIX: wchar_t *wcstok (wchar_t *, const wchar_t *, wchar_t **);
+ dnl mingw, MSVC: wchar_t *wcstok (wchar_t *, const wchar_t *);
+ AC_CACHE_CHECK([for wcstok with POSIX signature],
+ [gl_cv_func_wcstok_posix_signature],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
<wchar.h>.
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
@@ -26,13 +36,15 @@ AC_DEFUN([gl_FUNC_WCSTOK],
#include <wchar.h>
wchar_t *wcstok (wchar_t *, const wchar_t *, wchar_t **);
]],
- [])],
- [gl_cv_func_wcstok_posix_signature=yes],
- [gl_cv_func_wcstok_posix_signature=no])
- ])
- if test $gl_cv_func_wcstok_posix_signature = no; then
- REPLACE_WCSTOK=1
- fi
+ [])],
+ [gl_cv_func_wcstok_posix_signature=yes],
+ [gl_cv_func_wcstok_posix_signature=no])
+ ])
+ if test $gl_cv_func_wcstok_posix_signature = no; then
+ REPLACE_WCSTOK=1
+ fi
+ ;;
+ esac
else
HAVE_WCSTOK=0
fi

Return to:

Send suggestions and report system problems to the System administrator.