]> Savannah Git Hosting - gnulib.git/commitdiff
Resolve conflicts for functions introduced in Android API level 34.
authorBruno Haible <bruno@clisp.org>
Thu, 25 Jan 2024 23:18:49 +0000 (00:18 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 25 Jan 2024 23:18:49 +0000 (00:18 +0100)
* lib/string.in.h (memset_explicit): Consider REPLACE_MEMSET_EXPLICIT.
* m4/string_h.m4 (gl_STRING_H_DEFAULTS): Initialize
REPLACE_MEMSET_EXPLICIT.
* modules/string (Makefile.am): Substitute REPLACE_MEMSET_EXPLICIT.
* m4/memset_explicit.m4 (gl_FUNC_MEMSET_EXPLICIT): Test for
memset_explicit using gl_CHECK_FUNCS_ANDROID instead of
AC_CHECK_FUNCS_ONCE. Conditionally set REPLACE_MEMSET_EXPLICIT.
* modules/memset_explicit (configure.ac): Consider
REPLACE_MEMSET_EXPLICIT.
* doc/posix-functions/memset_explicit.texi: Mention the Android API
levels.

ChangeLog
doc/posix-functions/memset_explicit.texi
lib/string.in.h
m4/memset_explicit.m4
m4/string_h.m4
modules/memset_explicit
modules/string

index 5e7b4d90b4d7c8d3d24f3a603b7147760844b5ac..c46cb60b3129dfd868a51562bf16cfa9636abc97 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,18 @@
 
        Resolve conflicts for functions introduced in Android API level 34.
 
+       * lib/string.in.h (memset_explicit): Consider REPLACE_MEMSET_EXPLICIT.
+       * m4/string_h.m4 (gl_STRING_H_DEFAULTS): Initialize
+       REPLACE_MEMSET_EXPLICIT.
+       * modules/string (Makefile.am): Substitute REPLACE_MEMSET_EXPLICIT.
+       * m4/memset_explicit.m4 (gl_FUNC_MEMSET_EXPLICIT): Test for
+       memset_explicit using gl_CHECK_FUNCS_ANDROID instead of
+       AC_CHECK_FUNCS_ONCE. Conditionally set REPLACE_MEMSET_EXPLICIT.
+       * modules/memset_explicit (configure.ac): Consider
+       REPLACE_MEMSET_EXPLICIT.
+       * doc/posix-functions/memset_explicit.texi: Mention the Android API
+       levels.
+
        * m4/freadahead.m4 (gl_FUNC_FREADAHEAD): Test for __freadahead using
        gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
        * lib/freadahead.h: Update comment.
index 2bfe82932ae092320facd5e8358eceee8158b21e..cca6296b4976d41ee324f2c524a92d2b114a9590 100644 (file)
@@ -29,7 +29,7 @@ Portability problems fixed by Gnulib:
 @itemize
 @item
 This function is missing on some platforms:
-glibc 2.36, FreeBSD 13.1, NetBSD 9.3, OpenBSD 7.2, macOS 13, Solaris 11.4, Android 13,
+glibc 2.36, FreeBSD 13.1, NetBSD 9.3, OpenBSD 7.2, macOS 13, Solaris 11.4, Android API level 33,
 and many other systems.
 @end itemize
 
index 01ea3e3913b1ee99fe42446d3b42ae80baa2b381..44ec2e7ecdb5070ddf684d739f298e37cceedb17 100644 (file)
@@ -414,11 +414,21 @@ _GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
 /* Overwrite a block of memory.  The compiler will not optimize
    effects away, even if the block is dead after the call.  */
 #if @GNULIB_MEMSET_EXPLICIT@
-# if ! @HAVE_MEMSET_EXPLICIT@
+# if @REPLACE_MEMSET_EXPLICIT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef memset_explicit
+#   define memset_explicit rpl_memset_explicit
+#  endif
+_GL_FUNCDECL_RPL (memset_explicit, void *,
+                  (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (memset_explicit, void *, (void *__dest, int __c, size_t __n));
+# else
+#  if !@HAVE_MEMSET_EXPLICIT@
 _GL_FUNCDECL_SYS (memset_explicit, void *,
                   (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1)));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n));
+# endif
 _GL_CXXALIASWARN (memset_explicit);
 #elif defined GNULIB_POSIXCHECK
 # undef memset_explicit
index 6ac798d45572d71dc755cb03e74633e461fab830..19514ff917e65487d8fdf5995d55d43f58540435 100644 (file)
@@ -1,3 +1,4 @@
+# memset_explicit.m4 serial 2
 dnl Copyright 2022-2024 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,9 +8,12 @@ AC_DEFUN([gl_FUNC_MEMSET_EXPLICIT],
 [
   AC_REQUIRE([gl_STRING_H_DEFAULTS])
 
-  AC_CHECK_FUNCS_ONCE([memset_explicit])
+  gl_CHECK_FUNCS_ANDROID([memset_explicit], [[#include <string.h>]])
   if test $ac_cv_func_memset_explicit = no; then
     HAVE_MEMSET_EXPLICIT=0
+    case "$gl_cv_onwards_func_memset_explicit" in
+      future*) REPLACE_MEMSET_EXPLICIT=1 ;;
+    esac
   fi
 ])
 
index 8b12101447f24def65455987038ac0a798cd72a4..9ea748cc7740a43cb97ebf059a27a4ef8d0af826 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 38
+# serial 39
 
 # Written by Paul Eggert.
 
@@ -132,6 +132,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
   REPLACE_MEMCHR=0;             AC_SUBST([REPLACE_MEMCHR])
   REPLACE_MEMMEM=0;             AC_SUBST([REPLACE_MEMMEM])
   REPLACE_MEMPCPY=0;            AC_SUBST([REPLACE_MEMPCPY])
+  REPLACE_MEMSET_EXPLICIT=0;    AC_SUBST([REPLACE_MEMSET_EXPLICIT])
   REPLACE_STPCPY=0;             AC_SUBST([REPLACE_STPCPY])
   REPLACE_STPNCPY=0;            AC_SUBST([REPLACE_STPNCPY])
   REPLACE_STRCHRNUL=0;          AC_SUBST([REPLACE_STRCHRNUL])
index 3290bd36796e3483676b427b163863e47ba055d9..da16edefd6371451e0b2ee839391406c4b1ee303 100644 (file)
@@ -10,7 +10,8 @@ string
 
 configure.ac:
 gl_FUNC_MEMSET_EXPLICIT
-gl_CONDITIONAL([GL_COND_OBJ_MEMSET_EXPLICIT], [test $HAVE_MEMSET_EXPLICIT = 0])
+gl_CONDITIONAL([GL_COND_OBJ_MEMSET_EXPLICIT],
+               [test $HAVE_MEMSET_EXPLICIT = 0 || test $REPLACE_MEMSET_EXPLICIT = 1])
 AM_COND_IF([GL_COND_OBJ_MEMSET_EXPLICIT], [
   gl_PREREQ_MEMSET_EXPLICIT
 ])
index acbd614dcd837dc54c6472bb58ab0cb110f6d21e..eb0b215437e6a733edd71e5371072699b3e71a8e 100644 (file)
@@ -110,6 +110,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \
              -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
              -e 's|@''REPLACE_MEMPCPY''@|$(REPLACE_MEMPCPY)|g' \
+             -e 's|@''REPLACE_MEMSET_EXPLICIT''@|$(REPLACE_MEMSET_EXPLICIT)|g' \
              -e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \
              -e 's|@''REPLACE_STPCPY''@|$(REPLACE_STPCPY)|g' \
              -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \