summaryrefslogtreecommitdiff
path: root/lib/fcntl.in.h
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2020-12-27 17:54:57 +0100
committerAndrea Corallo <akrl@sdf.org>2020-12-27 17:54:57 +0100
commit8fb94630136700aa4e74c7fc212b019d2db380ae (patch)
tree69b3938a89f450509a7001f45ba3acca057fb40d /lib/fcntl.in.h
parent271fb8a269aff924070b188f23355d0c368356dd (diff)
parentdf882c9701755e2ae063f05d3381de14ae09951e (diff)
downloademacs-8fb94630136700aa4e74c7fc212b019d2db380ae.tar.gz
emacs-8fb94630136700aa4e74c7fc212b019d2db380ae.tar.bz2
emacs-8fb94630136700aa4e74c7fc212b019d2db380ae.zip
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'lib/fcntl.in.h')
-rw-r--r--lib/fcntl.in.h37
1 files changed, 31 insertions, 6 deletions
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index 6f16bc66921..11c9aae9bcc 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -112,9 +112,21 @@ _GL_CXXALIASWARN (creat);
/* Assume creat is always declared. */
_GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - "
"use gnulib module creat for portability");
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef creat
-# define creat _creat
+#else
+/* On native Windows, map 'creat' to '_creat', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::creat always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef creat
+# define creat _creat
+# endif
+/* Need to cast, because in mingw the last argument is 'int mode'. */
+_GL_CXXALIAS_MDA_CAST (creat, int, (const char *filename, mode_t mode));
+# else
+_GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode));
+# endif
+_GL_CXXALIASWARN (creat);
#endif
#if @GNULIB_FCNTL@
@@ -174,9 +186,22 @@ _GL_CXXALIASWARN (open);
/* Assume open is always declared. */
_GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
"use gnulib module open for portability");
-#elif defined _WIN32 && !defined __CYGWIN__
-# undef open
-# define open _open
+#else
+/* On native Windows, map 'open' to '_open', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::open always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef open
+# define open _open
+# endif
+_GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
+# else
+_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
+# endif
+# if !defined __hpux
+_GL_CXXALIASWARN (open);
+# endif
#endif
#if @GNULIB_OPENAT@