[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnulib-bug
Subject:    renameat declaration on NetBSD 7.0
From:       Bruno Haible <bruno () clisp ! org>
Date:       2017-08-15 20:06:18
Message-ID: 28358468.AcoSOHkjkd () omega
[Download RAW message or body]

On NetBSD 7.0, I'm seeing this test compilation failure:

gcc -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I../../gltests -I..  \
-DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I../../gltests -I.. \
-I../../gltests/.. -I../gllib -I../../gltests/../gllib -I/home/bruno/include -Wall \
-D_XOPEN_SOURCE=500  -g -O2 -MT test-renameat.o -MD -MP -MF $depbase.Tpo -c -o \
test-renameat.o ../../gltests/test-renameat.c &&\ mv -f $depbase.Tpo $depbase.Po
In file included from ../../gltests/test-renameat.c:23:0:
../../gltests/test-renameat.c:24:18: error: 'renameat' undeclared here (not in a \
function)  SIGNATURE_CHECK (renameat, int, (int, char const *, int, char const *));
                  ^
../../gltests/signature.h:46:58: note: in definition of macro 'SIGNATURE_CHECK2'
   static ret (* _GL_UNUSED signature_check ## id) args = fn
                                                          ^
../../gltests/signature.h:39:3: note: in expansion of macro 'SIGNATURE_CHECK1'
   SIGNATURE_CHECK1 (fn, ret, args, __LINE__)
   ^
../../gltests/test-renameat.c:24:1: note: in expansion of macro 'SIGNATURE_CHECK'
 SIGNATURE_CHECK (renameat, int, (int, char const *, int, char const *));
 ^
Makefile:8106: recipe for target 'test-renameat.o' failed


This patch fixes it.


2017-08-15  Bruno Haible  <bruno@clisp.org>

	renameat: Ensure declaration in <stdio.h> on NetBSD.
	* lib/stdio.in.h: Include <unistd,h> also on NetBSD.
	* doc/posix-functions/renameat.texi: Mention this problem.

diff --git a/doc/posix-functions/renameat.texi b/doc/posix-functions/renameat.texi
index 46b25b1..ee01b89 100644
--- a/doc/posix-functions/renameat.texi
+++ b/doc/posix-functions/renameat.texi
@@ -19,7 +19,7 @@ Solaris 9.
 @item
 This function is declared in @code{<unistd.h>} instead of @code{<stdio.h>}
 on some platforms:
-Solaris 11 2011-11.
+NetBSD 7.0, Solaris 11 2011-11.
 @item
 This function is missing on some platforms:
 glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8,
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 5329b9d..5ca8a23 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -111,9 +111,9 @@
 #define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \
   _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
 
-/* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>.  */
+/* Solaris 10 and NetBSD 7.0 declare renameat in <unistd.h>, not in <stdio.h>.  */
 /* But in any case avoid namespace pollution on glibc systems.  */
-#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \
+#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && (defined __sun || defined \
__NetBSD__) \  && ! defined __GLIBC__
 # include <unistd.h>
 #endif


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic