[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
off_t on MSVC
From: |
Bruno Haible |
Subject: |
off_t on MSVC |
Date: |
Fri, 16 Sep 2011 22:56:13 +0200 |
User-agent: |
KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; ) |
On MSVC 9, off_t is defined in <sys/types.h> and <wchar.h>. It is not
defined so far when <unistd.h> is included. But POSIX:2008 wants off_t to be
defined in each of
<fcntl.h>
<stdio.h>
<sys/stat.h>
<sys/types.h>
<unistd.h>
This fixes it:
2011-09-16 Bruno Haible <address@hidden>
Support for MSVC compiler: Ensure off_t gets defined.
* lib/unistd.in.h: Include <sys/types.h>.
* tests/test-fcntl-h.c: Check that off_t is defined.
* tests/test-sys_stat.c: Likewise.
* tests/test-sys_types.c: Likewise.
--- lib/unistd.in.h.orig Fri Sep 16 22:52:23 2011
+++ lib/unistd.in.h Fri Sep 16 22:51:14 2011
@@ -98,6 +98,12 @@
# include <netdb.h>
#endif
+/* MSVC defines off_t in <sys/types.h>. */
+#if address@hidden@
+/* Get off_t. */
+# include <sys/types.h>
+#endif
+
#if (@GNULIB_READ@ || @GNULIB_WRITE@ \
|| @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
|| @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
--- tests/test-fcntl-h.c.orig Fri Sep 16 22:52:24 2011
+++ tests/test-fcntl-h.c Fri Sep 16 03:05:11 2011
@@ -33,6 +33,7 @@
/* Check that the types are all defined. */
pid_t t1;
+off_t t2;
int
main (void)
--- tests/test-sys_stat.c.orig Fri Sep 16 22:52:24 2011
+++ tests/test-sys_stat.c Fri Sep 16 03:05:12 2011
@@ -278,8 +278,9 @@
/* Check the existence of some types. */
nlink_t t1;
+off_t t2;
-struct timespec t2;
+struct timespec t3;
int
main (void)
--- tests/test-sys_types.c.orig Fri Sep 16 22:52:24 2011
+++ tests/test-sys_types.c Fri Sep 16 03:05:12 2011
@@ -24,6 +24,7 @@
pid_t t1;
size_t t2;
ssize_t t3;
+off_t t4;
int
main (void)
--
In memoriam Georgiy Gongadze <http://en.wikipedia.org/wiki/Georgiy_Gongadze>
- off_t on MSVC,
Bruno Haible <=