]> Savannah Git Hosting - gnulib.git/commitdiff
Resolve conflicts for functions introduced in Android API level 26.
authorBruno Haible <bruno@clisp.org>
Sun, 22 Jan 2023 13:16:36 +0000 (14:16 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 22 Jan 2023 14:57:11 +0000 (15:57 +0100)
* lib/stdlib.in.h (getsubopt): Consider REPLACE_GETSUBOPT. Disable
_GL_CXXALIASWARN invocation on non-glibc systems.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_GETSUBOPT.
* modules/stdlib (Makefile.am): Substitute REPLACE_GETSUBOPT.
* m4/getsubopt.m4 (gl_FUNC_GETSUBOPT): Conditionally set
REPLACE_GETSUBOPT.
* modules/getsubopt (Depends-on, configure.ac): Consider
REPLACE_GETSUBOPT.

ChangeLog
lib/stdlib.in.h
m4/getsubopt.m4
m4/stdlib_h.m4
modules/getsubopt
modules/stdlib

index 905fd782d88bcb956da8fcafd84aed56eb4f81f4..39709e91cd17654f1066b8f98ea0aa16d1a8e617 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 26.
+
+       * lib/stdlib.in.h (getsubopt): Consider REPLACE_GETSUBOPT. Disable
+       _GL_CXXALIASWARN invocation on non-glibc systems.
+       * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_GETSUBOPT.
+       * modules/stdlib (Makefile.am): Substitute REPLACE_GETSUBOPT.
+       * m4/getsubopt.m4 (gl_FUNC_GETSUBOPT): Conditionally set
+       REPLACE_GETSUBOPT.
+       * modules/getsubopt (Depends-on, configure.ac): Consider
+       REPLACE_GETSUBOPT.
+
 2023-01-22  Bruno Haible  <bruno@clisp.org>
 
        Resolve conflicts for functions introduced in Android API level 24.
index 95e0b847b9583ecc0bff13c4c407b7d98c0b569b..c03f46ee389fee24cc333975744e9ac0ed1e585a 100644 (file)
@@ -488,14 +488,28 @@ _GL_WARN_ON_USE (getprogname, "getprogname is unportable - "
    Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
    For more details see the POSIX specification.
    https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */
-# if !@HAVE_GETSUBOPT@
+# if @REPLACE_GETSUBOPT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getsubopt
+#   define getsubopt rpl_getsubopt
+#  endif
+_GL_FUNCDECL_RPL (getsubopt, int,
+                  (char **optionp, char *const *tokens, char **valuep)
+                  _GL_ARG_NONNULL ((1, 2, 3)));
+_GL_CXXALIAS_RPL (getsubopt, int,
+                  (char **optionp, char *const *tokens, char **valuep));
+# else
+#  if !@HAVE_GETSUBOPT@
 _GL_FUNCDECL_SYS (getsubopt, int,
                   (char **optionp, char *const *tokens, char **valuep)
                   _GL_ARG_NONNULL ((1, 2, 3)));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (getsubopt, int,
                   (char **optionp, char *const *tokens, char **valuep));
+# endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (getsubopt);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef getsubopt
 # if HAVE_RAW_DECL_GETSUBOPT
index a528ec71430d0022f2adf649e08b15198375c255..3bafefeda64c301d0ea9c5c39c7d898dcfd142ff 100644 (file)
@@ -1,4 +1,4 @@
-# getsubopt.m4 serial 6
+# getsubopt.m4 serial 7
 dnl Copyright (C) 2004, 2007, 2009-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,
@@ -16,6 +16,9 @@ AC_DEFUN([gl_FUNC_GETSUBOPT],
     ]])
   if test $ac_cv_func_getsubopt = no; then
     HAVE_GETSUBOPT=0
+    case "$gl_cv_onwards_func_getsubopt" in
+      future*) REPLACE_GETSUBOPT=1 ;;
+    esac
   fi
 ])
 
index 525cd5ba783264f1fdb3841966c4adfb5aaf0e6d..ee1f48ee5ab367511b57810cc0acfa0c26afb344 100644 (file)
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 69
+# stdlib_h.m4 serial 70
 dnl Copyright (C) 2007-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,
@@ -175,6 +175,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   REPLACE_CANONICALIZE_FILE_NAME=0;  AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
   REPLACE_FREE=0;            AC_SUBST([REPLACE_FREE])
   REPLACE_GETPROGNAME=0;     AC_SUBST([REPLACE_GETPROGNAME])
+  REPLACE_GETSUBOPT=0;       AC_SUBST([REPLACE_GETSUBOPT])
   REPLACE_INITSTATE=0;       AC_SUBST([REPLACE_INITSTATE])
   REPLACE_MALLOC_FOR_MALLOC_GNU=0;    AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_GNU])
   REPLACE_MALLOC_FOR_MALLOC_POSIX=0;  AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_POSIX])
index 0b0d23d56dc2d1dea33c55aaacc1b90923354189..bdabdd76d57b41ee391ae3af8291e3ce571f382b 100644 (file)
@@ -8,12 +8,13 @@ m4/getsubopt.m4
 Depends-on:
 stdlib
 extensions
-strchrnul       [test $HAVE_GETSUBOPT = 0]
-memchr          [test $HAVE_GETSUBOPT = 0]
+strchrnul       [test $HAVE_GETSUBOPT = 0 || test $REPLACE_GETSUBOPT = 1]
+memchr          [test $HAVE_GETSUBOPT = 0 || test $REPLACE_GETSUBOPT = 1]
 
 configure.ac:
 gl_FUNC_GETSUBOPT
-gl_CONDITIONAL([GL_COND_OBJ_GETSUBOPT], [test $HAVE_GETSUBOPT = 0])
+gl_CONDITIONAL([GL_COND_OBJ_GETSUBOPT],
+               [test $HAVE_GETSUBOPT = 0 || test $REPLACE_GETSUBOPT = 1])
 AM_COND_IF([GL_COND_OBJ_GETSUBOPT], [
   gl_PREREQ_GETSUBOPT
 ])
index 57f1e4026978819239551cdeb491083a6a04dca0..5ae3e6665dba8af3822820eac4cef3167fca0d48 100644 (file)
@@ -135,6 +135,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
              -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
              -e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \
              -e 's|@''REPLACE_GETPROGNAME''@|$(REPLACE_GETPROGNAME)|g' \
+             -e 's|@''REPLACE_GETSUBOPT''@|$(REPLACE_GETSUBOPT)|g' \
              -e 's|@''REPLACE_INITSTATE''@|$(REPLACE_INITSTATE)|g' \
              -e 's|@''REPLACE_MALLOC_FOR_MALLOC_GNU''@|$(REPLACE_MALLOC_FOR_MALLOC_GNU)|g' \
              -e 's|@''REPLACE_MALLOC_FOR_MALLOC_POSIX''@|$(REPLACE_MALLOC_FOR_MALLOC_POSIX)|g' \