]> Savannah Git Hosting - gnulib.git/commitdiff
Resolve conflicts for functions introduced in Android API level 23.
authorBruno Haible <bruno@clisp.org>
Sun, 22 Jan 2023 12:12:02 +0000 (13:12 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 22 Jan 2023 14:56:58 +0000 (15:56 +0100)
* 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.

ChangeLog
lib/wchar.in.h
m4/wchar_h.m4
m4/wmempcpy.m4
modules/wchar
modules/wmempcpy

index a39769fb4740c039af11f8797f76735ea2cbfae5..3f429d5afcf1fc24733228e3fa9c1cb9a085e314 100644 (file)
--- 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.
index 354709db522a345d95e5f3f725cc929e8e5f3551..bbca92797d09561210a5f79ccf4d729f7a0bacd4 100644 (file)
@@ -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
index 8ec66193e03d58a4fb9ae2788d55959dfc78cadd..ad3d4ecbb463405dd45ecd2546f9dfe29efd9094 100644 (file)
@@ -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])
 ])
index 729128cab7efd542d2e356cdeabb98ebe91210f9..abf1df345d05be3fda1cd4ae24df91ff32c5a173 100644 (file)
@@ -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
 ])
index 58c2d1f3688d2e37753f5eb9243844e896c1ffc4..4a507f016793207fbc9e510c8c5c3f5056e50e8f 100644 (file)
@@ -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)' \
index 7548b2a74bbb9e326de20f884cadfb177ab76bc1..3f8e2c511265b05f06322f5b5cf9c8175e97778f 100644 (file)
@@ -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: