bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* renameat, renameatu: Fix warning on Android
@ 2023-01-10 13:26 Bruno Haible
  0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2023-01-10 13:26 UTC (permalink / raw)
  To: bug-gnulib

Building a testdir on Android, I see this warning:

../../gllib/renameatu.c:106:13: warning: call to undeclared function 'renameat2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

The cause is this API-level conditional declaration:

/usr/include/stdio.h:int renameat2(int __old_dir_fd, const char* __old_path, int __new_dir_fd, const char* __new_path, unsigned __flags) __INTRODUCED_IN(30);

This patch fixes the warning.

2023-01-10  Bruno Haible  <bruno@clisp.org>

	renameat, renameatu: Fix warning on Android.
	* m4/renameat.m4 (gl_FUNC_RENAMEAT): Test for renameat2 using

diff --git a/m4/renameat.m4 b/m4/renameat.m4
index 7e38e436a3..3780578663 100644
--- a/m4/renameat.m4
+++ b/m4/renameat.m4
@@ -1,4 +1,4 @@
-# serial 3
+# serial 4
 # See if we need to provide renameat replacement.
 dnl Copyright (C) 2009-2023 Free Software Foundation, Inc.
@@ -15,11 +15,12 @@ AC_DEFUN([gl_FUNC_RENAMEAT],
-  AC_CHECK_FUNCS_ONCE([renameat renameat2])
+  AC_CHECK_FUNCS_ONCE([renameat])
   if test $ac_cv_func_renameat = no; then
   elif test $REPLACE_RENAME = 1; then
     dnl Solaris 9 and 10 have the same bugs in renameat as in rename.
+  gl_CHECK_FUNCS_ANDROID([renameat2], [[#include <stdio.h>]])

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-10 14:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 13:26 renameat, renameatu: 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).