Hi Paul,

On NetBSD 10.1, in a testdir of all modules, I see after running
'./configure && make':

    depbase=`echo utimens.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; gcc 
-DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -DNO_XMALLOC  -DEXEEXT=\"\" -I. 
-I..  -DGNULIB_STRICT_CHECKING=1   -fvisibility=hidden -g -O2 -MT utimens.o -MD 
-MP -MF $depbase.Tpo -c -o utimens.o utimens.c && mv -f $depbase.Tpo $depbase.Po
    utimens.c: In function 'rpl_utimens':
    utimens.c:541:10: warning: implicit declaration of function 'utimens'; did 
you mean 'futimens'? [-Wimplicit-function-declaration]
      541 |   return utimens (file, timespec);
          |          ^~~~~~~
          |          futimens
    utimens.c: In function 'rpl_lutimens':
    utimens.c:563:10: warning: implicit declaration of function 'lutimens'; did 
you mean 'futimens'? [-Wimplicit-function-declaration]
      563 |   return lutimens (file, timespec);
          |          ^~~~~~~~
          |          futimens

It seems that there was a slight mistake in one of your commits a few
months ago:

> On this platform, <sys/time.h> declares utimens and lutimens and the
> C library defines them, so we needn’t (and shouldn’t).
> Problem reported privately by Thomas Klausner.
[...]
> * lib/utimens.h [HAVE_UTIMENS || HAVE_LUTIMENS]:
> Include <sys/time.h>, for NetBSD’s declaration of utimens and lutimens.

As far as I can tell through looking at the git history (I don't know
how to use CVS), these functions have always been declared in
<sys/stat.h>, not <sys/time.h>

I have pushed the attach patch that fixes these warnings.

Collin

[1] https://lists.gnu.org/archive/html/bug-gnulib/2024-09/msg00099.html
[2] 
https://github.com/NetBSD/src/commit/ff84366ca60c698af8d1ea72aa3871bee0ba8463#diff-aa03d0529d55ab3fffd58831b20dc2c1742770e2d82efcf5c3e9843bde19adb4

>From 39db933c36305612b79300aa34f4d0d926816cd3 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Sun, 23 Mar 2025 16:36:26 -0700
Subject: [PATCH] utimens: Fix missing declarations on NetBSD (regr.
 2024-09-16).

* lib/utimens.h [HAVE_UTIMENS || HAVE_LUTIMENS]: Include <sys/stat.h>
instead of <sys/time.h> for the declarations of these functions on
NetBSD.
---
 ChangeLog     | 5 +++++
 lib/utimens.h | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 10c428e81f..c849ceb122 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2025-03-23  Collin Funk  <collin.fu...@gmail.com>
 
+	utimens: Fix missing declarations on NetBSD (regr. 2024-09-16).
+	* lib/utimens.h [HAVE_UTIMENS || HAVE_LUTIMENS]: Include <sys/stat.h>
+	instead of <sys/time.h> for the declarations of these functions on
+	NetBSD.
+
 	newlocale: Fix implicit function declarations.
 	* lib/newlocale.c [HAVE_NEWLOCALE]: Include string.h for strlen and
 	strcmp, stdio.h for sprintf, and stdlib.h for free.
diff --git a/lib/utimens.h b/lib/utimens.h
index 007958dd93..62ea7d8f5f 100644
--- a/lib/utimens.h
+++ b/lib/utimens.h
@@ -25,7 +25,7 @@
 #include <time.h>
 
 #if HAVE_UTIMENS || HAVE_LUTIMENS
-# include <sys/time.h>
+# include <sys/stat.h>
 #endif
 
 #ifdef __cplusplus
-- 
2.49.0

Reply via email to