changeset 14520:04ce36b456cc

Merge branch 'master' into topic/libposix
author Bruce Korb <bkorb@gnu.org>
date Fri, 01 Apr 2011 16:04:45 -0700
parents 8636d98120a9 (current diff) d20bca67b23f (diff)
children 6758fa38915e
files ChangeLog
diffstat 9 files changed, 116 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Apr 01 08:10:58 2011 -0700
+++ b/ChangeLog	Fri Apr 01 16:04:45 2011 -0700
@@ -1,3 +1,23 @@
+2011-04-01  Bruno Haible  <bruno@clisp.org>
+
+	wmemchr, wcschr, wcsrchr, wcspbrk, wcsstr: Avoid errors in C++ mode.
+	* lib/wchar.in.h (wmemchr, wcschr, wcsrchr, wcspbrk, wcsstr): Use
+	_GL_CXXALIAS_SYS_CAST2 instead of _GL_CXXALIAS_SYS. On glibc >= 2.10
+	systems, use _GL_CXXALIASWARN1 instead of _GL_CXXALIASWARN.
+	Reported by Bruce Korb <bruce.korb@gmail.com>.
+
+2011-04-01  Bruno Haible  <bruno@clisp.org>
+
+	wcpcpy, wcpncpy: Ensure declaration on glibc >= 2.13 systems.
+	* m4/wcpcpy.m4 (gl_FUNC_WCPCPY): Require AC_USE_SYSTEM_EXTENSIONS.
+	* m4/wcpncpy.m4 (gl_FUNC_WCPNCPY): Likewise.
+	* modules/wcpcpy (Depends-on): Add extensions.
+	* modules/wcpncpy (Depends-on): Likewise.
+	* doc/posix-functions/wcpcpy.texi: Mention missing declaration on glibc
+	systems.
+	* doc/posix-functions/wcpncpy.texi: Likewise.
+	* doc/posix-functions/wcwidth.texi: Likewise.
+
 2011-03-31  Eric Blake  <eblake@redhat.com>
 
 	nonblocking: fix mingw test failures
--- a/doc/posix-functions/wcpcpy.texi	Fri Apr 01 08:10:58 2011 -0700
+++ b/doc/posix-functions/wcpcpy.texi	Fri Apr 01 16:04:45 2011 -0700
@@ -12,6 +12,9 @@
 This function is missing on some platforms:
 MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 4.3.2, HP-UX 11,
 IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw, Interix 3.5, BeOS.
+@item
+This function is not declared (without @code{-D_GNU_SOURCE}) on some platforms:
+glibc 2.13.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/doc/posix-functions/wcpncpy.texi	Fri Apr 01 08:10:58 2011 -0700
+++ b/doc/posix-functions/wcpncpy.texi	Fri Apr 01 16:04:45 2011 -0700
@@ -12,6 +12,9 @@
 This function is missing on some platforms:
 MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 4.3.2, HP-UX 11,
 IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw, Interix 3.5, BeOS.
+@item
+This function is not declared (without @code{-D_GNU_SOURCE}) on some platforms:
+glibc 2.13.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/doc/posix-functions/wcwidth.texi	Fri Apr 01 08:10:58 2011 -0700
+++ b/doc/posix-functions/wcwidth.texi	Fri Apr 01 16:04:45 2011 -0700
@@ -12,6 +12,9 @@
 This function is missing on some platforms:
 IRIX 5.3, Solaris 2.5.1, mingw, BeOS.
 @item
+This function is not declared (without @code{-D_GNU_SOURCE}) on some platforms:
+glibc 2.8.
+@item
 This function handles combining characters in UTF-8 locales incorrectly on some
 platforms:
 MacOS X 10.3.
--- a/lib/wchar.in.h	Fri Apr 01 08:10:58 2011 -0700
+++ b/lib/wchar.in.h	Fri Apr 01 16:04:45 2011 -0700
@@ -435,8 +435,22 @@
 # if !@HAVE_WMEMCHR@
 _GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n));
 # endif
-_GL_CXXALIAS_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n));
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" {
+         const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
+         wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
+       }  */
+_GL_CXXALIAS_SYS_CAST2 (wmemchr,
+                        wchar_t *, (const wchar_t *, wchar_t, size_t),
+                        const wchar_t *, (const wchar_t *, wchar_t, size_t));
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
+_GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
+                   (const wchar_t *s, wchar_t c, size_t n));
+# else
 _GL_CXXALIASWARN (wmemchr);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wmemchr
 # if HAVE_RAW_DECL_WMEMCHR
@@ -776,8 +790,21 @@
 # if !@HAVE_WCSCHR@
 _GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
 # endif
-_GL_CXXALIAS_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" {
+         const wchar_t * std::wcschr (const wchar_t *, wchar_t);
+         wchar_t * std::wcschr (wchar_t *, wchar_t);
+       }  */
+_GL_CXXALIAS_SYS_CAST2 (wcschr,
+                        wchar_t *, (const wchar_t *, wchar_t),
+                        const wchar_t *, (const wchar_t *, wchar_t));
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
+_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
+# else
 _GL_CXXALIASWARN (wcschr);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcschr
 # if HAVE_RAW_DECL_WCSCHR
@@ -792,8 +819,21 @@
 # if !@HAVE_WCSRCHR@
 _GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
 # endif
-_GL_CXXALIAS_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" {
+         const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
+         wchar_t * std::wcsrchr (wchar_t *, wchar_t);
+       }  */
+_GL_CXXALIAS_SYS_CAST2 (wcsrchr,
+                        wchar_t *, (const wchar_t *, wchar_t),
+                        const wchar_t *, (const wchar_t *, wchar_t));
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
+_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
+# else
 _GL_CXXALIASWARN (wcsrchr);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsrchr
 # if HAVE_RAW_DECL_WCSRCHR
@@ -843,9 +883,23 @@
 _GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
                   (const wchar_t *wcs, const wchar_t *accept));
 # endif
-_GL_CXXALIAS_SYS (wcspbrk, wchar_t *,
-                  (const wchar_t *wcs, const wchar_t *accept));
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" {
+         const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
+         wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
+       }  */
+_GL_CXXALIAS_SYS_CAST2 (wcspbrk,
+                        wchar_t *, (const wchar_t *, const wchar_t *),
+                        const wchar_t *, (const wchar_t *, const wchar_t *));
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
+                   (wchar_t *wcs, const wchar_t *accept));
+_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
+                   (const wchar_t *wcs, const wchar_t *accept));
+# else
 _GL_CXXALIASWARN (wcspbrk);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcspbrk
 # if HAVE_RAW_DECL_WCSPBRK
@@ -861,9 +915,23 @@
 _GL_FUNCDECL_SYS (wcsstr, wchar_t *,
                   (const wchar_t *haystack, const wchar_t *needle));
 # endif
-_GL_CXXALIAS_SYS (wcsstr, wchar_t *,
-                  (const wchar_t *haystack, const wchar_t *needle));
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" {
+         const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
+         wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
+       }  */
+_GL_CXXALIAS_SYS_CAST2 (wcsstr,
+                        wchar_t *, (const wchar_t *, const wchar_t *),
+                        const wchar_t *, (const wchar_t *, const wchar_t *));
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (wcsstr, wchar_t *,
+                   (wchar_t *haystack, const wchar_t *needle));
+_GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
+                   (const wchar_t *haystack, const wchar_t *needle));
+# else
 _GL_CXXALIASWARN (wcsstr);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsstr
 # if HAVE_RAW_DECL_WCSSTR
--- a/m4/wcpcpy.m4	Fri Apr 01 08:10:58 2011 -0700
+++ b/m4/wcpcpy.m4	Fri Apr 01 16:04:45 2011 -0700
@@ -1,4 +1,4 @@
-# wcpcpy.m4 serial 1
+# wcpcpy.m4 serial 2
 dnl Copyright (C) 2011 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,6 +7,10 @@
 AC_DEFUN([gl_FUNC_WCPCPY],
 [
   AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+
+  dnl Persuade glibc <wchar.h> to declare wcpcpy().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
   AC_CHECK_FUNCS_ONCE([wcpcpy])
   if test $ac_cv_func_wcpcpy = no; then
     HAVE_WCPCPY=0
--- a/m4/wcpncpy.m4	Fri Apr 01 08:10:58 2011 -0700
+++ b/m4/wcpncpy.m4	Fri Apr 01 16:04:45 2011 -0700
@@ -1,4 +1,4 @@
-# wcpncpy.m4 serial 1
+# wcpncpy.m4 serial 2
 dnl Copyright (C) 2011 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,6 +7,10 @@
 AC_DEFUN([gl_FUNC_WCPNCPY],
 [
   AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+
+  dnl Persuade glibc <wchar.h> to declare wcpncpy().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
   AC_CHECK_FUNCS_ONCE([wcpncpy])
   if test $ac_cv_func_wcpncpy = no; then
     HAVE_WCPNCPY=0
--- a/modules/wcpcpy	Fri Apr 01 08:10:58 2011 -0700
+++ b/modules/wcpcpy	Fri Apr 01 16:04:45 2011 -0700
@@ -13,6 +13,7 @@
 m4/wcpcpy.m4
 
 Depends-on:
+extensions
 wchar
 
 configure.ac:
--- a/modules/wcpncpy	Fri Apr 01 08:10:58 2011 -0700
+++ b/modules/wcpncpy	Fri Apr 01 16:04:45 2011 -0700
@@ -7,6 +7,7 @@
 m4/wcpncpy.m4
 
 Depends-on:
+extensions
 wchar
 
 configure.ac: