]> Savannah Git Hosting - gnulib.git/commitdiff
Resolve conflicts for functions introduced in Android API level 35.
authorBruno Haible <bruno@clisp.org>
Thu, 25 Jan 2024 23:55:45 +0000 (00:55 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 31 Jan 2024 17:35:03 +0000 (18:35 +0100)
* 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
lib/time.in.h
m4/gettime.m4
m4/time_h.m4
m4/timespec_getres.m4
modules/time-h
modules/timespec_getres

index cf792ca29396810927691c23cb1f239388283b5b..f984973eca5861e45f3ffa3b460412156cde8d5a 100644 (file)
--- 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.
index 06824da9d3d49bee122f707c6f28635866135d5d..ce28f1af25d812c246e36687f6f1ca25a4687ce5 100644 (file)
@@ -1,6 +1,6 @@
 /* A more-standard <time.h>.
 
-   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
index ec1f97ee0d5c87321038c73c6cc0e65083b22ac8..1ec018d51540ef4cbdc40bcc416a1c52f906a67d 100644 (file)
@@ -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 <time.h>]])
 ])
index 8cc9ac87924b33831b176b8897dff981bc938500..4e7f48ec82c7e8b75b26307608fd2171d614290c 100644 (file)
@@ -1,8 +1,8 @@
 # Configure a more-standard replacement for <time.h>.
 
-# 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.
index d7adaee41d77eab985b22af82e8e1a9ef29d6853..72edcebf039497729316629a4d30311d71f78064 100644 (file)
@@ -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 <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
 ])
index 5b0fc3feae25880b2be127f91491b645a7954381..3b07845b56614918d8a1ef256618109fbd0011cb 100644 (file)
@@ -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' \
index 07920a414e98be01b2a6415748e8305f850fce33..68575b51709e34f339d7f841838661d3696f7b75 100644 (file)
@@ -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: