* utimens: Fix warning on Android
@ 2023-01-10 16:32 Bruno Haible
0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2023-01-10 16:32 UTC (permalink / raw)
To: bug-gnulib
Building a testdir on Android, I see these warnings:
../../gllib/utimens.c:420:16: warning: call to undeclared function 'futimesat'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
../../gllib/utimens.c:441:13: warning: call to undeclared function 'futimesat'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
The cause is this API-level conditional declaration:
/usr/include/sys/time.h:int futimesat(int __dir_fd, const char* __path, const struct timeval __times[2]) __INTRODUCED_IN(26);
Once this is fixed, I see another warning:
../../gllib/utimens.c:441:13: warning: call to undeclared function 'futimes'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
Again, the cause is an API-level conditional declaration:
/usr/include/sys/time.h:int futimes(int __fd, const struct timeval __times[2]) __INTRODUCED_IN(26);
This patch fixes the warnings.
2023-01-10 Bruno Haible <bruno@clisp.org>
utimens: Fix warning on Android.
* m4/utimens.m4 (gl_UTIMENS): Test for futimesat and futimes using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
diff --git a/m4/utimens.m4 b/m4/utimens.m4
index ae35ef789b..c5d9b69e6f 100644
--- a/m4/utimens.m4
+++ b/m4/utimens.m4
@@ -3,7 +3,7 @@ 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.
-dnl serial 11
+dnl serial 12
AC_DEFUN([gl_UTIMENS],
[
@@ -11,7 +11,9 @@ AC_DEFUN([gl_UTIMENS],
AC_REQUIRE([gl_FUNC_UTIMES])
AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CHECK_FUNCS_ONCE([futimes futimesat futimens utimensat lutimes])
+ AC_CHECK_FUNCS_ONCE([futimens utimensat lutimes])
+ gl_CHECK_FUNCS_ANDROID([futimes], [[#include <sys/time.h>]])
+ gl_CHECK_FUNCS_ANDROID([futimesat], [[#include <sys/time.h>]])
if test $ac_cv_func_futimens = no && test $ac_cv_func_futimesat = yes; then
dnl FreeBSD 8.0-rc2 mishandles futimesat(fd,NULL,time). It is not
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-10 17:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 16:32 utimens: Fix warning on Android 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).