]> Savannah Git Hosting - gnulib.git/commitdiff
Resolve conflicts for functions introduced in Android API level 28.
authorBruno Haible <bruno@clisp.org>
Sun, 22 Jan 2023 13:22:28 +0000 (14:22 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 22 Jan 2023 14:57:18 +0000 (15:57 +0100)
* lib/unistd.in.h (getentropy): Consider REPLACE_GETENTROPY. Disable
_GL_CXXALIASWARN invocation on non-glibc systems.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_GETENTROPY.
* modules/unistd (Makefile.am): Substitute REPLACE_GETENTROPY.
* m4/getentropy.m4 (gl_FUNC_GETENTROPY): Conditionally set
REPLACE_GETENTROPY.
* modules/getentropy (Depends-on, configure.ac): Consider
REPLACE_GETENTROPY.

ChangeLog
lib/unistd.in.h
m4/getentropy.m4
m4/unistd_h.m4
modules/getentropy
modules/unistd

index 513a009fce5a10428e05742f88178150d3142b2b..fa9d220e0c72519ff8c5485ddd07d938127a75b3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2023-01-22  Bruno Haible  <bruno@clisp.org>
+
+       Resolve conflicts for functions introduced in Android API level 28.
+
+       * lib/unistd.in.h (getentropy): Consider REPLACE_GETENTROPY. Disable
+       _GL_CXXALIASWARN invocation on non-glibc systems.
+       * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_GETENTROPY.
+       * modules/unistd (Makefile.am): Substitute REPLACE_GETENTROPY.
+       * m4/getentropy.m4 (gl_FUNC_GETENTROPY): Conditionally set
+       REPLACE_GETENTROPY.
+       * modules/getentropy (Depends-on, configure.ac): Consider
+       REPLACE_GETENTROPY.
+
 2023-01-22  Bruno Haible  <bruno@clisp.org>
 
        Resolve conflicts for functions introduced in Android API level 26.
index 9930a11c19f634b08623b7d8ec4931f051ff8c61..8016f7345efdefab0ad61f0c85d61e9efdb952d3 100644 (file)
@@ -1207,11 +1207,22 @@ _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
 
 #if @GNULIB_GETENTROPY@
 /* Fill a buffer with random bytes.  */
-# if !@HAVE_GETENTROPY@
+# if @REPLACE_GETENTROPY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getentropy
+#   define getentropy rpl_getentropy
+#  endif
+_GL_FUNCDECL_RPL (getentropy, int, (void *buffer, size_t length));
+_GL_CXXALIAS_RPL (getentropy, int, (void *buffer, size_t length));
+# else
+#  if !@HAVE_GETENTROPY@
 _GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length));
+# endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (getentropy);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef getentropy
 # if HAVE_RAW_DECL_GETENTROPY
index 352b04ee4f3e78056a094fadb7903b5b92d5d138..0e7ef26940c7f6a749d1a95cf50c935ee1fa765b 100644 (file)
@@ -1,4 +1,4 @@
-# getentropy.m4 serial 2
+# getentropy.m4 serial 3
 dnl Copyright 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,
@@ -19,5 +19,8 @@ AC_DEFUN([gl_FUNC_GETENTROPY],
     ]])
   if test $ac_cv_func_getentropy = no; then
     HAVE_GETENTROPY=0
+    case "$gl_cv_onwards_func_getentropy" in
+      future*) REPLACE_GETENTROPY=1 ;;
+    esac
   fi
 ])
index fc8e2a58f30239968dc775df289e5e55b5f0a094..1c96158155a78415643ab0342857a0b2d10851f0 100644 (file)
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 93
+# unistd_h.m4 serial 94
 dnl Copyright (C) 2006-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,
@@ -240,6 +240,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   REPLACE_GETCWD=0;                  AC_SUBST([REPLACE_GETCWD])
   REPLACE_GETDOMAINNAME=0;           AC_SUBST([REPLACE_GETDOMAINNAME])
   REPLACE_GETDTABLESIZE=0;           AC_SUBST([REPLACE_GETDTABLESIZE])
+  REPLACE_GETENTROPY=0;              AC_SUBST([REPLACE_GETENTROPY])
   REPLACE_GETLOGIN_R=0;              AC_SUBST([REPLACE_GETLOGIN_R])
   REPLACE_GETGROUPS=0;               AC_SUBST([REPLACE_GETGROUPS])
   REPLACE_GETPAGESIZE=0;             AC_SUBST([REPLACE_GETPAGESIZE])
index 2f4bcf054cc0bac7bcc85738bdb64b6f8d9563e7..3b0c434547a69c444ffdc1ae0ff9f6d77c3f5725 100644 (file)
@@ -6,13 +6,14 @@ lib/getentropy.c
 m4/getentropy.m4
 
 Depends-on:
-getrandom      [test $HAVE_GETENTROPY = 0]
+getrandom      [test $HAVE_GETENTROPY = 0 || test $REPLACE_GETENTROPY = 1]
 extensions
 unistd
 
 configure.ac:
 gl_FUNC_GETENTROPY
-gl_CONDITIONAL([GL_COND_OBJ_GETENTROPY], [test $HAVE_GETENTROPY = 0])
+gl_CONDITIONAL([GL_COND_OBJ_GETENTROPY],
+               [test $HAVE_GETENTROPY = 0 || test $REPLACE_GETENTROPY = 1])
 gl_UNISTD_MODULE_INDICATOR([getentropy])
 
 Makefile.am:
index ddb0991f851f1d575684e740f43b49f7532370e6..1e9bc9ca6bfb24391f9cd620b9748e4f499294fc 100644 (file)
@@ -194,6 +194,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
              -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
              -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \
+             -e 's|@''REPLACE_GETENTROPY''@|$(REPLACE_GETENTROPY)|g' \
              -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
              -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
              -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \