+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.
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
-# 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,
]])
if test $ac_cv_func_getsubopt = no; then
HAVE_GETSUBOPT=0
+ case "$gl_cv_onwards_func_getsubopt" in
+ future*) REPLACE_GETSUBOPT=1 ;;
+ esac
fi
])
-# 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,
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])
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
])
-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' \