]> 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:01:14 +0000 (13:01 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 22 Jan 2023 14:56:53 +0000 (15:56 +0100)
* lib/string.in.h (mempcpy): Consider REPLACE_MEMPCPY. Disable
_GL_CXXALIASWARN invocation on non-glibc systems.
* m4/string_h.m4 (gl_STRING_H_DEFAULTS): Initialize REPLACE_MEMPCPY.
* modules/string (Makefile.am): Substitute REPLACE_MEMPCPY.
* m4/mempcpy.m4 (gl_FUNC_STPCPY): Conditionally set REPLACE_MEMPCPY.
* modules/mempcpy (configure.ac): Consider REPLACE_MEMPCPY.

ChangeLog
lib/string.in.h
m4/mempcpy.m4
m4/string_h.m4
modules/mempcpy
modules/string

index 8c6d6dcf6a87133de9f3b54cc1f055d6d39e2a03..3accc92f951f64ee6a9bd8f8fa8c840bd856c841 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,13 @@
 
        Resolve conflicts for functions introduced in Android API level 23.
 
+       * lib/string.in.h (mempcpy): Consider REPLACE_MEMPCPY. Disable
+       _GL_CXXALIASWARN invocation on non-glibc systems.
+       * m4/string_h.m4 (gl_STRING_H_DEFAULTS): Initialize REPLACE_MEMPCPY.
+       * modules/string (Makefile.am): Substitute REPLACE_MEMPCPY.
+       * m4/mempcpy.m4 (gl_FUNC_MEMPCPY): Conditionally set REPLACE_MEMPCPY.
+       * modules/mempcpy (configure.ac): Consider REPLACE_MEMPCPY.
+
        * lib/stdlib.in.h (mkostemp): Consider REPLACE_MKOSTEMP. Disable
        _GL_CXXALIASWARN invocation on non-glibc systems.
        (mkostemps): Consider REPLACE_MKOSTEMPS. Disable _GL_CXXALIASWARN
index 7d0104ce556aad35e315a130656428ac9a1e4d30..2e078aff4745aedeedbf50e7db981037b06fb8a2 100644 (file)
@@ -308,16 +308,32 @@ _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
 /* Copy N bytes of SRC to DEST, return pointer to bytes after the
    last written byte.  */
 #if @GNULIB_MEMPCPY@
-# if ! @HAVE_MEMPCPY@
+# if @REPLACE_MEMPCPY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mempcpy
+#   define mempcpy rpl_mempcpy
+#  endif
+_GL_FUNCDECL_RPL (mempcpy, void *,
+                  (void *restrict __dest, void const *restrict __src,
+                   size_t __n)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (mempcpy, void *,
+                  (void *restrict __dest, void const *restrict __src,
+                   size_t __n));
+# else
+#  if !@HAVE_MEMPCPY@
 _GL_FUNCDECL_SYS (mempcpy, void *,
                   (void *restrict __dest, void const *restrict __src,
                    size_t __n)
                   _GL_ARG_NONNULL ((1, 2)));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (mempcpy, void *,
                   (void *restrict __dest, void const *restrict __src,
                    size_t __n));
+# endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (mempcpy);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef mempcpy
 # if HAVE_RAW_DECL_MEMPCPY
index d663b671749aefc644e99e179f2d642a555e5953..612b77b3c11f885ec85a5e3881d5a0be92d23966 100644 (file)
@@ -1,4 +1,4 @@
-# mempcpy.m4 serial 13
+# mempcpy.m4 serial 14
 dnl Copyright (C) 2003-2004, 2006-2007, 2009-2023 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -17,6 +17,9 @@ AC_DEFUN([gl_FUNC_MEMPCPY],
   gl_CHECK_FUNCS_ANDROID([mempcpy], [[#include <string.h>]])
   if test $ac_cv_func_mempcpy = no; then
     HAVE_MEMPCPY=0
+    case "$gl_cv_onwards_func_mempcpy" in
+      future*) REPLACE_MEMPCPY=1 ;;
+    esac
   fi
 ])
 
index 132ed87d6abc0d01b58537e3dadcda249e224d45..7f51391cbfff382309461c5ee45576da2a1f30bd 100644 (file)
@@ -5,7 +5,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 36
+# serial 37
 
 # Written by Paul Eggert.
 
@@ -131,6 +131,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
   REPLACE_FFSLL=0;              AC_SUBST([REPLACE_FFSLL])
   REPLACE_MEMCHR=0;             AC_SUBST([REPLACE_MEMCHR])
   REPLACE_MEMMEM=0;             AC_SUBST([REPLACE_MEMMEM])
+  REPLACE_MEMPCPY=0;            AC_SUBST([REPLACE_MEMPCPY])
   REPLACE_STPCPY=0;             AC_SUBST([REPLACE_STPCPY])
   REPLACE_STPNCPY=0;            AC_SUBST([REPLACE_STPNCPY])
   REPLACE_STRCHRNUL=0;          AC_SUBST([REPLACE_STRCHRNUL])
index 142ce7fdcaa2acfb07a0c0058e898c590b18a8ee..469dbd8789da24d0532969b228c9f833f1c46470 100644 (file)
@@ -11,7 +11,8 @@ string
 
 configure.ac:
 gl_FUNC_MEMPCPY
-gl_CONDITIONAL([GL_COND_OBJ_MEMPCPY], [test $HAVE_MEMPCPY = 0])
+gl_CONDITIONAL([GL_COND_OBJ_MEMPCPY],
+               [test $HAVE_MEMPCPY = 0 || test $REPLACE_MEMPCPY = 1])
 AM_COND_IF([GL_COND_OBJ_MEMPCPY], [
   gl_PREREQ_MEMPCPY
 ])
index 03a1b0547c0e77743f36494c31e3516e18d2c236..9bfed126136320bb2e598a9f38f880e8beee5616 100644 (file)
@@ -108,6 +108,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''REPLACE_FFSLL''@|$(REPLACE_FFSLL)|g' \
              -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \
              -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
+             -e 's|@''REPLACE_MEMPCPY''@|$(REPLACE_MEMPCPY)|g' \
              -e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \
              -e 's|@''REPLACE_STPCPY''@|$(REPLACE_STPCPY)|g' \
              -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \