changeset 16284:ab517781f037

Improve support for MSVC 9. * lib/unistd.in.h: Include <io.h> when needed to avoid redefinition clashes on MSVC. * lib/fcntl.in.h: Likewise. * lib/stdlib.in.h: Likewise. * lib/sys_stat.in.h: Likewise.
author Bruno Haible <bruno@clisp.org>
date Sun, 15 Jan 2012 17:35:55 +0100
parents ceb1c4a29f1d
children 59c01cd32e37
files ChangeLog lib/fcntl.in.h lib/stdlib.in.h lib/sys_stat.in.h lib/unistd.in.h
diffstat 5 files changed, 33 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-01-15  Bruno Haible  <bruno@clisp.org>
+
+	Improve support for MSVC 9.
+	* lib/unistd.in.h: Include <io.h> when needed to avoid redefinition
+	clashes on MSVC.
+	* lib/fcntl.in.h: Likewise.
+	* lib/stdlib.in.h: Likewise.
+	* lib/sys_stat.in.h: Likewise.
+
 2011-01-15  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
 	gnupload: we hold the master copy of this script now
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -62,6 +62,12 @@
 # include <unistd.h>
 #endif
 
+/* Native Windows platforms declare open(), creat() in <io.h>.  */
+#if (@GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \
+    && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+# include <io.h>
+#endif
+
 
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -49,6 +49,11 @@
 # include <sys/loadavg.h>
 #endif
 
+/* Native Windows platforms declare mktemp() in <io.h>.  */
+#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+# include <io.h>
+#endif
+
 #if @GNULIB_RANDOM_R@
 
 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -62,6 +62,11 @@
 # include <direct.h> /* mingw64, MSVC 9 */
 #endif
 
+/* Native Windows platforms declare umask() in <io.h>.  */
+#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+# include <io.h>
+#endif
+
 #ifndef S_IFIFO
 # ifdef _S_IFIFO
 #  define S_IFIFO _S_IFIFO
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -84,12 +84,19 @@
 #endif
 
 /* Native Windows platforms declare chdir, getcwd, rmdir in
-   <io.h> and/or <direct.h>, not in <unistd.h>.  */
+   <io.h> and/or <direct.h>, not in <unistd.h>.
+   They also declare access(), chmod(), close(), dup(), dup2(), isatty(),
+   lseek(), read(), unlink(), write() in <io.h>.  */
 #if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
       || defined GNULIB_POSIXCHECK) \
      && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
 # include <io.h>     /* mingw32, mingw64 */
 # include <direct.h> /* mingw64, MSVC 9 */
+#elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \
+       || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \
+       || defined GNULIB_POSIXCHECK) \
+      && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+# include <io.h>
 #endif
 
 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.