]> Savannah Git Hosting - gnulib.git/commitdiff
Resolve conflicts for functions introduced in Android API level 21.
authorBruno Haible <bruno@clisp.org>
Sun, 22 Jan 2023 11:25:06 +0000 (12:25 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 22 Jan 2023 14:56:38 +0000 (15:56 +0100)
* m4/random.m4 (gl_FUNC_RANDOM): Conditionally set REPLACE_INITSTATE,
REPLACE_SETSTATE.
* lib/stdlib.in.h (initstate, setstate): Disable _GL_CXXALIASWARN
invocation on non-glibc systems.

ChangeLog
lib/stdlib.in.h
m4/random.m4

index ea0077fcbbec1f60cab1dc4b46c6deb54d3cb73e..3de67682f183fe7741d658c489011288e1b20886 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,11 @@
 
        Resolve conflicts for functions introduced in Android API level 21.
 
+       * m4/random.m4 (gl_FUNC_RANDOM): Conditionally set REPLACE_INITSTATE,
+       REPLACE_SETSTATE.
+       * lib/stdlib.in.h (initstate, setstate): Disable _GL_CXXALIASWARN
+       invocation on non-glibc systems.
+
        * m4/dprintf.m4 (gl_REPLACE_DPRINTF): Conditionally set REPLACE_DPRINTF.
        * lib/stdio.in.h (dprintf): Disable _GL_CXXALIASWARN invocation on
        non-glibc systems.
index 88a8e034a1eee9f7ff999e81d38e226186a5e479..c9e247547725278227ddec6e219a34f4467bbf47 100644 (file)
@@ -1013,7 +1013,9 @@ _GL_FUNCDECL_SYS (initstate, char *,
 _GL_CXXALIAS_SYS_CAST (initstate, char *,
                        (unsigned int seed, char *buf, size_t buf_size));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (initstate);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef initstate
 # if HAVE_RAW_DECL_INITSTATE
@@ -1038,7 +1040,9 @@ _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
    is                                     const char *arg_state.  */
 _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (setstate);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef setstate
 # if HAVE_RAW_DECL_SETSTATE
index b99603cf9a4e270630c6944bd93cf4bae23352b0..b0d1cb86ee16a8683611d9d48d0d8d4ed7808708 100644 (file)
@@ -1,4 +1,4 @@
-# random.m4 serial 5
+# random.m4 serial 6
 dnl Copyright (C) 2012-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,29 +19,39 @@ AC_DEFUN([gl_FUNC_RANDOM],
        [gl_cv_func_random=yes],
        [gl_cv_func_random=no])
     ])
+  gl_CHECK_FUNCS_ANDROID([initstate], [[#include <stdlib.h>]])
+  gl_CHECK_FUNCS_ANDROID([setstate], [[#include <stdlib.h>]])
   if test $gl_cv_func_random = no; then
     HAVE_RANDOM=0
     HAVE_INITSTATE=0
     HAVE_SETSTATE=0
   else
-    gl_CHECK_FUNCS_ANDROID([initstate], [[#include <stdlib.h>]])
-    gl_CHECK_FUNCS_ANDROID([setstate], [[#include <stdlib.h>]])
     if test $ac_cv_func_initstate = no; then
       HAVE_INITSTATE=0
     fi
     if test $ac_cv_func_setstate = no; then
       HAVE_SETSTATE=0
     fi
-    if test $ac_cv_func_initstate = no || test $ac_cv_func_setstate = no; then
-      dnl In order to define initstate or setstate, we need to define all the
-      dnl functions at once.
-      REPLACE_RANDOM=1
-      if test $ac_cv_func_initstate = yes; then
-        REPLACE_INITSTATE=1
-      fi
-      if test $ac_cv_func_setstate = yes; then
-        REPLACE_SETSTATE=1
-      fi
+  fi
+  if test $HAVE_INITSTATE = 0; then
+    case "$gl_cv_onwards_func_initstate" in
+      future*) REPLACE_INITSTATE=1 ;;
+    esac
+  fi
+  if test $HAVE_SETSTATE = 0; then
+    case "$gl_cv_onwards_func_setstate" in
+      future*) REPLACE_SETSTATE=1 ;;
+    esac
+  fi
+  if test $ac_cv_func_initstate = no || test $ac_cv_func_setstate = no; then
+    dnl In order to define initstate or setstate, we need to define all the
+    dnl functions at once.
+    REPLACE_RANDOM=1
+    if test $ac_cv_func_initstate = yes; then
+      REPLACE_INITSTATE=1
+    fi
+    if test $ac_cv_func_setstate = yes; then
+      REPLACE_SETSTATE=1
     fi
   fi