summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2019-09-15 18:32:54 +0200
committerBruno Haible <bruno@clisp.org>2019-09-15 18:32:54 +0200
commit7ed78c9f539e6981b7ba48ef2962d4364cbd37fc (patch)
tree126712fdeb289f65c03df18ac629b517f0e179dc
parent01c0052307a4c87926b664d288fa5ba801eaa8ff (diff)
downloadgnulib-7ed78c9f539e6981b7ba48ef2962d4364cbd37fc.tar.gz
gnulib-7ed78c9f539e6981b7ba48ef2962d4364cbd37fc.tar.bz2
fcntl-h: Fix compilation error of creat.c on MSVC.
* lib/fcntl.in.h: Include <io.h> also when __need_system_fcntl_h is defined.
-rw-r--r--ChangeLog6
-rw-r--r--lib/fcntl.in.h18
2 files changed, 18 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 1c7ca6b238..84d9508c1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,14 @@
2019-09-15 Bruno Haible <bruno@clisp.org>
+ fcntl-h: Fix compilation error of creat.c on MSVC.
+ * lib/fcntl.in.h: Include <io.h> also when __need_system_fcntl_h is
+ defined.
+
+2019-09-15 Bruno Haible <bruno@clisp.org>
+
creat: Add tests.
* tests/test-creat.c: New file, based on tests/test-open.h.
* modules/creat-tests: New file.
creat: New module.
* lib/fcntl.in.h (creat): New declaration.
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index 557e6c14b2..abe7993e21 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -36,12 +36,18 @@
with g++ version >= 4.3. */
#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))))
# include <sys/stat.h>
#endif
#@INCLUDE_NEXT@ @NEXT_FCNTL_H@
+/* Native Windows platforms declare open(), creat() in <io.h>. */
+#if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \
+ && (defined _WIN32 && ! defined __CYGWIN__)
+# include <io.h>
+#endif
+
#else
/* Normal invocation convention. */
#ifndef _@GUARD_PREFIX@_FCNTL_H
/* Needed before <sys/stat.h>.
@@ -56,25 +62,25 @@
#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))))
# include <sys/stat.h>
#endif
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_FCNTL_H@
+/* Native Windows platforms declare open(), creat() in <io.h>. */
+#if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \
+ && (defined _WIN32 && ! defined __CYGWIN__)
+# include <io.h>
+#endif
+
#ifndef _@GUARD_PREFIX@_FCNTL_H
#define _@GUARD_PREFIX@_FCNTL_H
#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */
# include <unistd.h>
#endif
-/* Native Windows platforms declare open(), creat() in <io.h>. */
-#if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \
- && (defined _WIN32 && ! defined __CYGWIN__)
-# include <io.h>
-#endif
-
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
/* The definition of _GL_WARN_ON_USE is copied here. */

Return to:

Send suggestions and report system problems to the System administrator.