changeset 17937:34065aa26b62

glob, etc.: port to MSVC v18 on MS-Windows 8.1 * lib/dirent--.h (GNULIB_defined_opendir): * lib/dirent.in.h (GNULIB_defined_opendir) (GNULIB_defined_closedir): * lib/getcwd.c, lib/glob.c, lib/mountlist.c (opendir, closedir): #undef only if Gnulib defined it.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 24 Feb 2015 20:44:32 -0800
parents 5aeafb603ed9
children b624b13ff5c1
files ChangeLog lib/dirent--.h lib/dirent.in.h lib/getcwd.c lib/glob.c lib/mountlist.c
diffstat 6 files changed, 28 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Feb 24 16:16:19 2015 -0800
+++ b/ChangeLog	Tue Feb 24 20:44:32 2015 -0800
@@ -1,5 +1,12 @@
 2015-02-24  Paul Eggert  <eggert@cs.ucla.edu>
 
+	glob, etc.: port to MSVC v18 on MS-Windows 8.1
+	* lib/dirent--.h (GNULIB_defined_opendir):
+	* lib/dirent.in.h (GNULIB_defined_opendir)
+	(GNULIB_defined_closedir):
+	* lib/getcwd.c, lib/glob.c, lib/mountlist.c (opendir, closedir):
+	#undef only if Gnulib defined it.
+
 	poll: port to MSVC v18 on MS-Windows 8.1
 	Problem reported by Gisle Vanem in:
 	http://lists.gnu.org/archive/html/bug-gnulib/2015-02/msg00139.html
--- a/lib/dirent--.h	Tue Feb 24 16:16:19 2015 -0800
+++ b/lib/dirent--.h	Tue Feb 24 20:44:32 2015 -0800
@@ -21,3 +21,4 @@
 
 #undef opendir
 #define opendir opendir_safer
+#define GNULIB_defined_opendir 1
--- a/lib/dirent.in.h	Tue Feb 24 16:16:19 2015 -0800
+++ b/lib/dirent.in.h	Tue Feb 24 20:44:32 2015 -0800
@@ -77,6 +77,7 @@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef opendir
 #   define opendir rpl_opendir
+#   define GNULIB_defined_opendir 1
 #  endif
 _GL_FUNCDECL_RPL (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name));
@@ -128,6 +129,7 @@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef closedir
 #   define closedir rpl_closedir
+#   define GNULIB_defined_closedir 1
 #  endif
 _GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (closedir, int, (DIR *dirp));
--- a/lib/getcwd.c	Tue Feb 24 16:16:19 2015 -0800
+++ b/lib/getcwd.c	Tue Feb 24 20:44:32 2015 -0800
@@ -93,8 +93,12 @@
    FIXME - if the kernel ever adds support for multi-thread safety for
    avoiding standard fds, then we should use opendir_safer and
    openat_safer.  */
-#undef opendir
-#undef closedir
+#ifdef GNULIB_defined_opendir
+# undef opendir
+#endif
+#ifdef GNULIB_defined_closedir
+# undef closedir
+#endif
 
 /* Get the name of the current working directory, and put it in SIZE
    bytes of BUF.  Returns NULL if the directory couldn't be determined or
--- a/lib/glob.c	Tue Feb 24 16:16:19 2015 -0800
+++ b/lib/glob.c	Tue Feb 24 20:44:32 2015 -0800
@@ -188,8 +188,12 @@
    therefore save some unnecessary recursion in fchdir.c and opendir_safer.c.
    FIXME - if the kernel ever adds support for multi-thread safety for
    avoiding standard fds, then we should use opendir_safer.  */
-# undef opendir
-# undef closedir
+# ifdef GNULIB_defined_opendir
+#  undef opendir
+# endif
+# ifdef GNULIB_defined_closedir
+#  undef closedir
+# endif
 
 # if HAVE_ALLOCA
 /* The OS usually guarantees only one guard page at the bottom of the stack,
--- a/lib/mountlist.c	Tue Feb 24 16:16:19 2015 -0800
+++ b/lib/mountlist.c	Tue Feb 24 20:44:32 2015 -0800
@@ -157,8 +157,12 @@
 
 /* The results of opendir() in this file are not used with dirfd and fchdir,
    therefore save some unnecessary work in fchdir.c.  */
-#undef opendir
-#undef closedir
+#ifdef GNULIB_defined_opendir
+# undef opendir
+#endif
+#ifdef GNULIB_defined_closedir
+# undef closedir
+#endif
 
 #define ME_DUMMY_0(Fs_name, Fs_type)            \
   (strcmp (Fs_type, "autofs") == 0              \