From 8c15a911325fd0166dbeb2f30b78ac02a71fb304 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 22 Jan 2023 11:47:22 +0100 Subject: [PATCH 16/47] Resolve conflicts for functions introduced in Android API level 21. * lib/search.in.h (twalk): Consider REPLACE_TWALK. * m4/search_h.m4 (gl_SEARCH_H_DEFAULTS): Initialize REPLACE_TWALK. * modules/search (Makefile.am): Substitute REPLACE_TWALK. * m4/tsearch.m4 (gl_FUNC_TSEARCH): Conditionally set REPLACE_TWALK. * modules/tsearch (configure.ac): Consider REPLACE_TWALK. --- ChangeLog | 10 ++++++++++ lib/search.in.h | 8 ++++++-- m4/search_h.m4 | 3 ++- m4/tsearch.m4 | 6 +++++- modules/search | 1 + modules/tsearch | 2 +- 6 files changed, 25 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 449746ce95..b6deccf065 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2023-01-22 Bruno Haible + + Resolve conflicts for functions introduced in Android API level 21. + + * lib/search.in.h (twalk): Consider REPLACE_TWALK. + * m4/search_h.m4 (gl_SEARCH_H_DEFAULTS): Initialize REPLACE_TWALK. + * modules/search (Makefile.am): Substitute REPLACE_TWALK. + * m4/tsearch.m4 (gl_FUNC_TSEARCH): Conditionally set REPLACE_TWALK. + * modules/tsearch (configure.ac): Consider REPLACE_TWALK. + 2023-01-22 Bruno Haible Resolve conflicts for functions introduced in Android API level 19. diff --git a/lib/search.in.h b/lib/search.in.h index e8cd6992e7..32b022edc6 100644 --- a/lib/search.in.h +++ b/lib/search.in.h @@ -100,6 +100,10 @@ _GL_CXXALIASWARN (lsearch); # define tsearch rpl_tsearch # define tfind rpl_tfind # define tdelete rpl_tdelete +# endif +# endif +# if @REPLACE_TWALK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define twalk rpl_twalk # endif # endif @@ -224,7 +228,7 @@ _GL_CXXALIASWARN (tdelete); pointer to the key, 2. an indicator which visit of the node this is, 3. the level of the node in the tree (0 for the root). */ -# if @REPLACE_TSEARCH@ +# if @REPLACE_TWALK@ _GL_FUNCDECL_RPL (twalk, void, (const void *vroot, _gl_search_action_fn action) _GL_ARG_NONNULL ((2))); @@ -245,7 +249,7 @@ _GL_CXXALIASWARN (twalk); /* Flags used by tsearch.c. */ # define GNULIB_defined_tsearch (@REPLACE_TSEARCH@ || !@HAVE_TSEARCH@) -# define GNULIB_defined_twalk (@REPLACE_TSEARCH@ || !@HAVE_TWALK@) +# define GNULIB_defined_twalk (@REPLACE_TWALK@ || !@HAVE_TWALK@) #elif defined GNULIB_POSIXCHECK # undef tsearch diff --git a/m4/search_h.m4 b/m4/search_h.m4 index 4fb2c77b09..a8c87abcee 100644 --- a/m4/search_h.m4 +++ b/m4/search_h.m4 @@ -1,4 +1,4 @@ -# search_h.m4 serial 15 +# search_h.m4 serial 16 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, @@ -78,4 +78,5 @@ AC_DEFUN([gl_SEARCH_H_DEFAULTS], HAVE_TSEARCH=1; AC_SUBST([HAVE_TSEARCH]) HAVE_TWALK=1; AC_SUBST([HAVE_TWALK]) REPLACE_TSEARCH=0; AC_SUBST([REPLACE_TSEARCH]) + REPLACE_TWALK=0; AC_SUBST([REPLACE_TWALK]) ]) diff --git a/m4/tsearch.m4 b/m4/tsearch.m4 index 0781151e52..c2ddc8a71e 100644 --- a/m4/tsearch.m4 +++ b/m4/tsearch.m4 @@ -1,4 +1,4 @@ -# tsearch.m4 serial 11 +# tsearch.m4 serial 12 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, @@ -49,6 +49,7 @@ main () case "$gl_cv_func_tdelete_works" in *no) REPLACE_TSEARCH=1 + REPLACE_TWALK=1 ;; esac else @@ -59,6 +60,9 @@ main () fi if test $ac_cv_func_twalk != yes; then HAVE_TWALK=0 + case "$gl_cv_onwards_func_twalk" in + future*) REPLACE_TWALK=1 ;; + esac fi ]) diff --git a/modules/search b/modules/search index ad9382fc1b..2debf36b89 100644 --- a/modules/search +++ b/modules/search @@ -38,6 +38,7 @@ search.h: search.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_TSEARCH''@|$(HAVE_TSEARCH)|g' \ -e 's|@''HAVE_TWALK''@|$(HAVE_TWALK)|g' \ -e 's|@''REPLACE_TSEARCH''@|$(REPLACE_TSEARCH)|g' \ + -e 's|@''REPLACE_TWALK''@|$(REPLACE_TWALK)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ diff --git a/modules/tsearch b/modules/tsearch index 91ef56c8c0..c4c363b7a6 100644 --- a/modules/tsearch +++ b/modules/tsearch @@ -11,7 +11,7 @@ search configure.ac: gl_FUNC_TSEARCH gl_CONDITIONAL([GL_COND_OBJ_TSEARCH], - [test $HAVE_TSEARCH = 0 || test $HAVE_TWALK = 0 || test $REPLACE_TSEARCH = 1]) + [test $HAVE_TSEARCH = 0 || test $HAVE_TWALK = 0 || test $REPLACE_TSEARCH = 1 || test $REPLACE_TWALK = 1]) AM_COND_IF([GL_COND_OBJ_TSEARCH], [ gl_PREREQ_TSEARCH ]) -- 2.34.1