From: Bruno Haible Date: Thu, 25 Jan 2024 23:55:45 +0000 (+0100) Subject: Resolve conflicts for functions introduced in Android API level 35. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=bbb4c31e52593a72299d4b7ebc2238953a5d36ef;p=gnulib.git Resolve conflicts for functions introduced in Android API level 35. * lib/time.in.h (timespec_getres): Consider REPLACE_TIMESPEC_GETRES. * m4/time_h.m4 (gl_TIME_H_DEFAULTS): Initialize REPLACE_TIMESPEC_GETRES. * modules/time-h (Makefile.am): Substitute REPLACE_TIMESPEC_GETRES. * m4/timespec_getres.m4 (gl_FUNC_TIMESPEC_GETRES): Test for timespec_getres using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. Conditionally set REPLACE_TIMESPEC_GETRES. * modules/timespec_getres (Depends-on, configure.ac): Consider REPLACE_TIMESPEC_GETRES. * m4/gettime.m4 (gl_GETTIME_RES): Test for timespec_getres using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. * doc/posix-functions/timespec_getres.texi: Mention the Android API levels. --- diff --git a/ChangeLog b/ChangeLog index cf792ca293..f984973eca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2024-01-25 Bruno Haible + + Resolve conflicts for functions introduced in Android API level 35. + + * lib/time.in.h (timespec_getres): Consider REPLACE_TIMESPEC_GETRES. + * m4/time_h.m4 (gl_TIME_H_DEFAULTS): Initialize REPLACE_TIMESPEC_GETRES. + * modules/time-h (Makefile.am): Substitute REPLACE_TIMESPEC_GETRES. + * m4/timespec_getres.m4 (gl_FUNC_TIMESPEC_GETRES): Test for + timespec_getres using gl_CHECK_FUNCS_ANDROID instead of + AC_CHECK_FUNCS_ONCE. Conditionally set REPLACE_TIMESPEC_GETRES. + * modules/timespec_getres (Depends-on, configure.ac): Consider + REPLACE_TIMESPEC_GETRES. + * m4/gettime.m4 (gl_GETTIME_RES): Test for timespec_getres using + gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE. + * doc/posix-functions/timespec_getres.texi: Mention the Android API + levels. + 2024-01-25 Bruno Haible Resolve conflicts for functions introduced in Android API level 34. diff --git a/lib/time.in.h b/lib/time.in.h index 06824da9d3..ce28f1af25 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -1,6 +1,6 @@ /* A more-standard . - Copyright (C) 2007-2023 Free Software Foundation, Inc. + Copyright (C) 2007-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -154,11 +154,21 @@ _GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - " /* Set *TS to the current time resolution, and return BASE. Upon failure, return 0. */ # if @GNULIB_TIMESPEC_GETRES@ -# if ! @HAVE_TIMESPEC_GETRES@ +# if @REPLACE_TIMESPEC_GETRES@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef timespec_getres +# define timespec_getres rpl_timespec_getres +# endif +_GL_FUNCDECL_RPL (timespec_getres, int, (struct timespec *ts, int base) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (timespec_getres, int, (struct timespec *ts, int base)); +# else +# if !@HAVE_TIMESPEC_GETRES@ _GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base) _GL_ARG_NONNULL ((1))); -# endif +# endif _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base)); +# endif _GL_CXXALIASWARN (timespec_getres); # elif defined GNULIB_POSIXCHECK # undef timespec_getres diff --git a/m4/gettime.m4 b/m4/gettime.m4 index ec1f97ee0d..1ec018d515 100644 --- a/m4/gettime.m4 +++ b/m4/gettime.m4 @@ -1,5 +1,5 @@ -# gettime.m4 serial 14 -dnl Copyright (C) 2002, 2004-2006, 2009-2023 Free Software Foundation, Inc. +# gettime.m4 serial 15 +dnl Copyright (C) 2002, 2004-2006, 2009-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -64,5 +64,5 @@ AC_DEFUN([gl_GETTIME_RES], dnl Prerequisites of lib/gettime-res.c. AC_REQUIRE([gl_CLOCK_TIME]) AC_REQUIRE([gl_TIMESPEC]) - AC_CHECK_FUNCS_ONCE([timespec_getres]) + gl_CHECK_FUNCS_ANDROID([timespec_getres], [[#include ]]) ]) diff --git a/m4/time_h.m4 b/m4/time_h.m4 index 8cc9ac8792..4e7f48ec82 100644 --- a/m4/time_h.m4 +++ b/m4/time_h.m4 @@ -1,8 +1,8 @@ # Configure a more-standard replacement for . -# Copyright (C) 2000-2001, 2003-2007, 2009-2023 Free Software Foundation, Inc. +# Copyright (C) 2000-2001, 2003-2007, 2009-2024 Free Software Foundation, Inc. -# serial 23 +# serial 23.1 # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -175,6 +175,7 @@ AC_DEFUN([gl_TIME_H_DEFAULTS], REPLACE_TIME=0; AC_SUBST([REPLACE_TIME]) REPLACE_TIMEGM=0; AC_SUBST([REPLACE_TIMEGM]) REPLACE_TIMESPEC_GET=0; AC_SUBST([REPLACE_TIMESPEC_GET]) + REPLACE_TIMESPEC_GETRES=0; AC_SUBST([REPLACE_TIMESPEC_GETRES]) REPLACE_TZSET=0; AC_SUBST([REPLACE_TZSET]) dnl Hack so that the time module doesn't depend on the sys_time module. diff --git a/m4/timespec_getres.m4 b/m4/timespec_getres.m4 index d7adaee41d..72edcebf03 100644 --- a/m4/timespec_getres.m4 +++ b/m4/timespec_getres.m4 @@ -1,5 +1,5 @@ -# Test whether timespec_getres works. -dnl Copyright 2021-2023 Free Software Foundation, Inc. +# timespec_getres serial 2 +dnl Copyright 2021-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -11,8 +11,11 @@ AC_DEFUN([gl_FUNC_TIMESPEC_GETRES], dnl Might be needed for the same reason timespec_get needs it. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - AC_CHECK_FUNCS_ONCE([timespec_getres]) + gl_CHECK_FUNCS_ANDROID([timespec_getres], [[#include ]]) if test $ac_cv_func_timespec_getres != yes; then HAVE_TIMESPEC_GETRES=0 + case "$gl_cv_onwards_func_timespec_getres" in + future*) REPLACE_TIMESPEC_GETRES=1 ;; + esac fi ]) diff --git a/modules/time-h b/modules/time-h index 5b0fc3feae..3b07845b56 100644 --- a/modules/time-h +++ b/modules/time-h @@ -63,6 +63,7 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''REPLACE_TIME''@|$(REPLACE_TIME)|g' \ -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \ -e 's|@''REPLACE_TIMESPEC_GET''@|$(REPLACE_TIMESPEC_GET)|g' \ + -e 's|@''REPLACE_TIMESPEC_GETRES''@|$(REPLACE_TIMESPEC_GETRES)|g' \ -e 's|@''REPLACE_TZSET''@|$(REPLACE_TZSET)|g' \ -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ diff --git a/modules/timespec_getres b/modules/timespec_getres index 07920a414e..68575b5170 100644 --- a/modules/timespec_getres +++ b/modules/timespec_getres @@ -8,11 +8,12 @@ m4/timespec_getres.m4 Depends-on: extensions time-h -gettime-res [test $HAVE_TIMESPEC_GETRES = 0] +gettime-res [test $HAVE_TIMESPEC_GETRES = 0 || test $REPLACE_TIMESPEC_GETRES = 1] configure.ac: AC_REQUIRE([gl_FUNC_TIMESPEC_GETRES]) -gl_CONDITIONAL([GL_COND_OBJ_TIMESPEC_GETRES], [test $HAVE_TIMESPEC_GETRES = 0]) +gl_CONDITIONAL([GL_COND_OBJ_TIMESPEC_GETRES], + [test $HAVE_TIMESPEC_GETRES = 0 || test $REPLACE_TIMESPEC_GETRES = 1]) gl_TIME_MODULE_INDICATOR([timespec_getres]) Makefile.am: