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-Tag: v1.0~489 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=bbe8a410fa168e60f418259c22964e3a978b84b0;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 d4716bdf9e..fb352f8de2 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/doc/posix-functions/timespec_getres.texi b/doc/posix-functions/timespec_getres.texi index cce90d9233..9cb92275f8 100644 --- a/doc/posix-functions/timespec_getres.texi +++ b/doc/posix-functions/timespec_getres.texi @@ -10,7 +10,7 @@ Portability problems fixed by Gnulib: @itemize @item This function is missing on some platforms: -glibc 2.33, macOS 12, FreeBSD 14.0, NetBSD 9.2, OpenBSD 7.0, Minix 3.3.0, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin 2.9, mingw, MSVC 14, Android 9.0. +glibc 2.33, macOS 12, FreeBSD 14.0, NetBSD 9.2, OpenBSD 7.0, Minix 3.3.0, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin 2.9, mingw, MSVC 14, Android API level 34. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/time.in.h b/lib/time.in.h index 58e103af07..ce28f1af25 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -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 e450e6b9d0..1ec018d515 100644 --- a/m4/gettime.m4 +++ b/m4/gettime.m4 @@ -1,4 +1,4 @@ -# gettime.m4 serial 14 +# 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, @@ -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 367f69efae..32fade0f40 100644 --- a/m4/time_h.m4 +++ b/m4/time_h.m4 @@ -2,7 +2,7 @@ # Copyright (C) 2000-2001, 2003-2007, 2009-2024 Free Software Foundation, Inc. -# serial 24 +# serial 25 # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -175,5 +175,6 @@ 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]) ]) diff --git a/m4/timespec_getres.m4 b/m4/timespec_getres.m4 index e019f7edf8..72edcebf03 100644 --- a/m4/timespec_getres.m4 +++ b/m4/timespec_getres.m4 @@ -1,4 +1,4 @@ -# Test whether timespec_getres works. +# 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, @@ -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: