summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2023-01-22 13:12:02 +0100
committerBruno Haible <bruno@clisp.org>2023-01-22 15:56:58 +0100
commit6de13dcceb91445233d5d1e26c7498f826d2b8a2 (patch)
treecae3e8b3d76d9ee7009051da5df4ccc9877d596b
parent134320a310c64fc3b497618cabc2749bd98735fb (diff)
downloadgnulib-6de13dcceb91445233d5d1e26c7498f826d2b8a2.tar.gz
Resolve conflicts for functions introduced in Android API level 23.
* lib/wchar.in.h (wmempcpy): Consider REPLACE_WMEMPCPY. * m4/wchar_h.m4 (gl_WCHAR_H_DEFAULTS): Initialize REPLACE_WMEMPCPY. * modules/wchar (Makefile.am): Substitute REPLACE_WMEMPCPY. * m4/wmempcpy.m4 (gl_FUNC_WMEMPCPY): Conditionally set REPLACE_WMEMPCPY. * modules/wmempcpy (configure.ac): Consider REPLACE_WMEMPCPY.
-rw-r--r--ChangeLog7
-rw-r--r--lib/wchar.in.h17
-rw-r--r--m4/wchar_h.m43
-rw-r--r--m4/wmempcpy.m45
-rw-r--r--modules/wchar1
-rw-r--r--modules/wmempcpy3
6 files changed, 31 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index a39769fb47..3f429d5afc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,13 @@
Resolve conflicts for functions introduced in Android API level 23.
+ * lib/wchar.in.h (wmempcpy): Consider REPLACE_WMEMPCPY.
+ * m4/wchar_h.m4 (gl_WCHAR_H_DEFAULTS): Initialize REPLACE_WMEMPCPY.
+ * modules/wchar (Makefile.am): Substitute REPLACE_WMEMPCPY.
+ * m4/wmempcpy.m4 (gl_FUNC_WMEMPCPY): Conditionally set
+ REPLACE_WMEMPCPY.
+ * modules/wmempcpy (configure.ac): Consider REPLACE_WMEMPCPY.
+
* lib/unistd.in.h (sethostname): Consider REPLACE_SETHOSTNAME. Disable
_GL_CXXALIASWARN invocation on non-glibc systems.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_SETHOSTNAME.
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index 354709db52..bbca92797d 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -696,14 +696,27 @@ _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
/* Copy N wide characters of SRC to DEST.
Return pointer to wide characters after the last written wide character. */
#if @GNULIB_WMEMPCPY@
-# if !@HAVE_WMEMPCPY@
+# if @REPLACE_WMEMPCPY@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef wmempcpy
+# define wmempcpy rpl_wmempcpy
+# endif
+_GL_FUNCDECL_RPL (wmempcpy, wchar_t *,
+ (wchar_t *restrict dest,
+ const wchar_t *restrict src, size_t n));
+_GL_CXXALIAS_RPL (wmempcpy, wchar_t *,
+ (wchar_t *restrict dest,
+ const wchar_t *restrict src, size_t n));
+# else
+# if !@HAVE_WMEMPCPY@
_GL_FUNCDECL_SYS (wmempcpy, wchar_t *,
(wchar_t *restrict dest,
const wchar_t *restrict src, size_t n));
-# endif
+# endif
_GL_CXXALIAS_SYS (wmempcpy, wchar_t *,
(wchar_t *restrict dest,
const wchar_t *restrict src, size_t n));
+# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (wmempcpy);
# endif
diff --git a/m4/wchar_h.m4 b/m4/wchar_h.m4
index 8ec66193e0..ad3d4ecbb4 100644
--- a/m4/wchar_h.m4
+++ b/m4/wchar_h.m4
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
dnl Written by Eric Blake.
-# wchar_h.m4 serial 55
+# wchar_h.m4 serial 56
AC_DEFUN_ONCE([gl_WCHAR_H],
[
@@ -254,4 +254,5 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH])
REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME])
REPLACE_WCSTOK=0; AC_SUBST([REPLACE_WCSTOK])
+ REPLACE_WMEMPCPY=0; AC_SUBST([REPLACE_WMEMPCPY])
])
diff --git a/m4/wmempcpy.m4 b/m4/wmempcpy.m4
index 729128cab7..abf1df345d 100644
--- a/m4/wmempcpy.m4
+++ b/m4/wmempcpy.m4
@@ -1,4 +1,4 @@
-# wmempcpy.m4 serial 2
+# wmempcpy.m4 serial 3
dnl Copyright (C) 2020-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -17,5 +17,8 @@ AC_DEFUN([gl_FUNC_WMEMPCPY],
gl_CHECK_FUNCS_ANDROID([wmempcpy], [[#include <wchar.h>]])
if test $ac_cv_func_wmempcpy = no; then
HAVE_WMEMPCPY=0
+ case "$gl_cv_onwards_func_wmempcpy" in
+ future*) REPLACE_WMEMPCPY=1 ;;
+ esac
fi
])
diff --git a/modules/wchar b/modules/wchar
index 58c2d1f368..4a507f0167 100644
--- a/modules/wchar
+++ b/modules/wchar
@@ -143,6 +143,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \
-e 's|@''REPLACE_WCSFTIME''@|$(REPLACE_WCSFTIME)|g' \
-e 's|@''REPLACE_WCSTOK''@|$(REPLACE_WCSTOK)|g' \
+ -e 's|@''REPLACE_WMEMPCPY''@|$(REPLACE_WMEMPCPY)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
diff --git a/modules/wmempcpy b/modules/wmempcpy
index 7548b2a74b..3f8e2c5112 100644
--- a/modules/wmempcpy
+++ b/modules/wmempcpy
@@ -10,7 +10,8 @@ wchar
configure.ac:
gl_FUNC_WMEMPCPY
-gl_CONDITIONAL([GL_COND_OBJ_WMEMPCPY], [test $HAVE_WMEMPCPY = 0])
+gl_CONDITIONAL([GL_COND_OBJ_WMEMPCPY],
+ [test $HAVE_WMEMPCPY = 0 || test $REPLACE_WMEMPCPY = 1])
gl_WCHAR_MODULE_INDICATOR([wmempcpy])
Makefile.am: