* Resolve conflicts for functions introduced in Android API level 35
@ 2024-01-25 23:58 Bruno Haible
0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2024-01-25 23:58 UTC (permalink / raw)
To: bug-gnulib
[-- Attachment #1: Type: text/plain, Size: 912 bytes --]
At level 35 the added functions are:
<time.h>
timespec_getres
The patch below updates Gnulib accordingly.
2024-01-25 Bruno Haible <bruno@clisp.org>
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.
[-- Attachment #2: 0001-Resolve-conflicts-for-functions-introduced-in-Androi.patch --]
[-- Type: text/x-patch, Size: 8037 bytes --]
From bbe8a410fa168e60f418259c22964e3a978b84b0 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Fri, 26 Jan 2024 00:55:45 +0100
Subject: [PATCH] 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.
---
ChangeLog | 17 +++++++++++++++++
doc/posix-functions/timespec_getres.texi | 2 +-
lib/time.in.h | 14 ++++++++++++--
m4/gettime.m4 | 4 ++--
m4/time_h.m4 | 3 ++-
m4/timespec_getres.m4 | 7 +++++--
modules/time-h | 1 +
modules/timespec_getres | 5 +++--
8 files changed, 43 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d4716bdf9e..fb352f8de2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2024-01-25 Bruno Haible <bruno@clisp.org>
+
+ 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 <bruno@clisp.org>
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 @@
@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 <time.h>]])
])
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 <time.h>]])
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:
--
2.34.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-01-25 23:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-25 23:58 Resolve conflicts for functions introduced in Android API level 35 Bruno Haible
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).