>From 6f43ec52f0b6c548a974ec46244292106fc48bfe Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 22 Jan 2023 12:43:06 +0100 Subject: [PATCH 28/47] Resolve conflicts for functions introduced in Android API level 23. * lib/stdlib.in.h (mkostemp): Consider REPLACE_MKOSTEMP. Disable _GL_CXXALIASWARN invocation on non-glibc systems. (mkostemps): Consider REPLACE_MKOSTEMPS. Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_MKOSTEMP, REPLACE_MKOSTEMPS. * modules/stdlib (Makefile.am): Substitute REPLACE_MKOSTEMP, REPLACE_MKOSTEMPS. * m4/mkostemp.m4 (gl_FUNC_MKOSTEMP): Conditionally set REPLACE_MKOSTEMP. * modules/mkostemp (Depends-on, configure.ac): Consider REPLACE_MKOSTEMP. * m4/mkostemps.m4 (gl_FUNC_MKOSTEMPS): Conditionally set REPLACE_MKOSTEMPS. * modules/mkostemps (Depends-on, configure.ac): Consider REPLACE_MKOSTEMPS. --- ChangeLog | 20 ++++++++++++++++++++ lib/stdlib.in.h | 34 ++++++++++++++++++++++++++++++---- m4/mkostemp.m4 | 5 ++++- m4/mkostemps.m4 | 5 ++++- m4/stdlib_h.m4 | 4 +++- modules/mkostemp | 5 +++-- modules/mkostemps | 5 +++-- modules/stdlib | 2 ++ 8 files changed, 69 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index c00928615f..8c6d6dcf6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2023-01-22 Bruno Haible + + Resolve conflicts for functions introduced in Android API level 23. + + * lib/stdlib.in.h (mkostemp): Consider REPLACE_MKOSTEMP. Disable + _GL_CXXALIASWARN invocation on non-glibc systems. + (mkostemps): Consider REPLACE_MKOSTEMPS. Disable _GL_CXXALIASWARN + invocation on non-glibc systems. + * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_MKOSTEMP, + REPLACE_MKOSTEMPS. + * modules/stdlib (Makefile.am): Substitute REPLACE_MKOSTEMP, + REPLACE_MKOSTEMPS. + * m4/mkostemp.m4 (gl_FUNC_MKOSTEMP): Conditionally set REPLACE_MKOSTEMP. + * modules/mkostemp (Depends-on, configure.ac): Consider + REPLACE_MKOSTEMP. + * m4/mkostemps.m4 (gl_FUNC_MKOSTEMPS): Conditionally set + REPLACE_MKOSTEMPS. + * modules/mkostemps (Depends-on, configure.ac): Consider + REPLACE_MKOSTEMPS. + 2023-01-22 Bruno Haible Resolve conflicts for functions introduced in Android API level 21. diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index c9e2475477..95e0b847b9 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -625,12 +625,24 @@ _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " implementation. Returns the open file descriptor if successful, otherwise -1 and errno set. */ -# if !@HAVE_MKOSTEMP@ +# if @REPLACE_MKOSTEMP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mkostemp +# define mkostemp rpl_mkostemp +# endif +_GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/)); +# else +# if !@HAVE_MKOSTEMP@ _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) _GL_ARG_NONNULL ((1))); -# endif +# endif _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); +# endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (mkostemp); +# endif #elif defined GNULIB_POSIXCHECK # undef mkostemp # if HAVE_RAW_DECL_MKOSTEMP @@ -653,14 +665,28 @@ _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " implementation. Returns the open file descriptor if successful, otherwise -1 and errno set. */ -# if !@HAVE_MKOSTEMPS@ +# if @REPLACE_MKOSTEMPS@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mkostemps +# define mkostemps rpl_mkostemps +# endif +_GL_FUNCDECL_RPL (mkostemps, int, + (char * /*template*/, int /*suffixlen*/, int /*flags*/) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mkostemps, int, + (char * /*template*/, int /*suffixlen*/, int /*flags*/)); +# else +# if !@HAVE_MKOSTEMPS@ _GL_FUNCDECL_SYS (mkostemps, int, (char * /*template*/, int /*suffixlen*/, int /*flags*/) _GL_ARG_NONNULL ((1))); -# endif +# endif _GL_CXXALIAS_SYS (mkostemps, int, (char * /*template*/, int /*suffixlen*/, int /*flags*/)); +# endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (mkostemps); +# endif #elif defined GNULIB_POSIXCHECK # undef mkostemps # if HAVE_RAW_DECL_MKOSTEMPS diff --git a/m4/mkostemp.m4 b/m4/mkostemp.m4 index 9424f85f43..1b0d0d5594 100644 --- a/m4/mkostemp.m4 +++ b/m4/mkostemp.m4 @@ -1,4 +1,4 @@ -# mkostemp.m4 serial 3 +# mkostemp.m4 serial 4 dnl Copyright (C) 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, @@ -14,6 +14,9 @@ AC_DEFUN([gl_FUNC_MKOSTEMP], gl_CHECK_FUNCS_ANDROID([mkostemp], [[#include ]]) if test $ac_cv_func_mkostemp != yes; then HAVE_MKOSTEMP=0 + case "$gl_cv_onwards_func_mkostemp" in + future*) REPLACE_MKOSTEMP=1 ;; + esac fi ]) diff --git a/m4/mkostemps.m4 b/m4/mkostemps.m4 index fdf6971496..2ce47d130f 100644 --- a/m4/mkostemps.m4 +++ b/m4/mkostemps.m4 @@ -1,4 +1,4 @@ -# mkostemps.m4 serial 3 +# mkostemps.m4 serial 4 dnl Copyright (C) 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, @@ -14,5 +14,8 @@ AC_DEFUN([gl_FUNC_MKOSTEMPS], gl_CHECK_FUNCS_ANDROID([mkostemps], [[#include ]]) if test $ac_cv_func_mkostemps != yes; then HAVE_MKOSTEMPS=0 + case "$gl_cv_onwards_func_mkostemps" in + future*) REPLACE_MKOSTEMPS=1 ;; + esac fi ]) diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index f1360a457b..525cd5ba78 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -1,4 +1,4 @@ -# stdlib_h.m4 serial 68 +# stdlib_h.m4 serial 69 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, @@ -179,6 +179,8 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], 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]) REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) + REPLACE_MKOSTEMP=0; AC_SUBST([REPLACE_MKOSTEMP]) + REPLACE_MKOSTEMPS=0; AC_SUBST([REPLACE_MKOSTEMPS]) REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) REPLACE_POSIX_MEMALIGN=0; AC_SUBST([REPLACE_POSIX_MEMALIGN]) REPLACE_POSIX_OPENPT=0; AC_SUBST([REPLACE_POSIX_OPENPT]) diff --git a/modules/mkostemp b/modules/mkostemp index 467fb109ae..a47353d427 100644 --- a/modules/mkostemp +++ b/modules/mkostemp @@ -10,11 +10,12 @@ Depends-on: stdlib extensions largefile -tempname [test $HAVE_MKOSTEMP = 0] +tempname [test $HAVE_MKOSTEMP = 0 || test $REPLACE_MKOSTEMP = 1] configure.ac: gl_FUNC_MKOSTEMP -gl_CONDITIONAL([GL_COND_OBJ_MKOSTEMP], [test $HAVE_MKOSTEMP = 0]) +gl_CONDITIONAL([GL_COND_OBJ_MKOSTEMP], + [test $HAVE_MKOSTEMP = 0 || test $REPLACE_MKOSTEMP = 1]) AM_COND_IF([GL_COND_OBJ_MKOSTEMP], [ gl_PREREQ_MKOSTEMP ]) diff --git a/modules/mkostemps b/modules/mkostemps index 92ef9ea29e..3bcb438860 100644 --- a/modules/mkostemps +++ b/modules/mkostemps @@ -10,11 +10,12 @@ Depends-on: stdlib extensions largefile -tempname [test $HAVE_MKOSTEMPS = 0] +tempname [test $HAVE_MKOSTEMPS = 0 || test $REPLACE_MKOSTEMPS = 1] configure.ac: gl_FUNC_MKOSTEMPS -gl_CONDITIONAL([GL_COND_OBJ_MKOSTEMPS], [test $HAVE_MKOSTEMPS = 0]) +gl_CONDITIONAL([GL_COND_OBJ_MKOSTEMPS], + [test $HAVE_MKOSTEMPS = 0 || test $REPLACE_MKOSTEMPS = 1]) gl_MODULE_INDICATOR([mkostemps]) gl_STDLIB_MODULE_INDICATOR([mkostemps]) diff --git a/modules/stdlib b/modules/stdlib index 0be8fb54a5..57f1e40269 100644 --- a/modules/stdlib +++ b/modules/stdlib @@ -139,6 +139,8 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -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' \ -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ + -e 's|@''REPLACE_MKOSTEMP''@|$(REPLACE_MKOSTEMP)|g' \ + -e 's|@''REPLACE_MKOSTEMPS''@|$(REPLACE_MKOSTEMPS)|g' \ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ -e 's|@''REPLACE_POSIX_MEMALIGN''@|$(REPLACE_POSIX_MEMALIGN)|g' \ -e 's|@''REPLACE_POSIX_OPENPT''@|$(REPLACE_POSIX_OPENPT)|g' \ -- 2.34.1