From: Paul Eggert Date: Wed, 25 Feb 2015 04:44:32 +0000 (-0800) Subject: glob, etc.: port to MSVC v18 on MS-Windows 8.1 X-Git-Tag: v1.0~7121 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=ecc5d3e148115ba09409139d4d6db810b5a270aa;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 42351a6831..86bab1664b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2015-02-24 Paul Eggert + 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 diff --git a/lib/dirent--.h b/lib/dirent--.h index 17a8853879..aa3f4929cb 100644 --- a/lib/dirent--.h +++ b/lib/dirent--.h @@ -21,3 +21,4 @@ #undef opendir #define opendir opendir_safer +#define GNULIB_defined_opendir 1 diff --git a/lib/dirent.in.h b/lib/dirent.in.h index ddd3b84fbb..154d2689e3 100644 --- a/lib/dirent.in.h +++ b/lib/dirent.in.h @@ -77,6 +77,7 @@ typedef struct gl_directory DIR; # 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 @@ _GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - " # 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)); diff --git a/lib/getcwd.c b/lib/getcwd.c index 20efabd6d3..db5279dba1 100644 --- a/lib/getcwd.c +++ b/lib/getcwd.c @@ -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 diff --git a/lib/glob.c b/lib/glob.c index f13cb8a267..ed49a9d2f6 100644 --- a/lib/glob.c +++ b/lib/glob.c @@ -188,8 +188,12 @@ static const char *next_brace_sub (const char *begin, int flags) __THROWNL; 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, diff --git a/lib/mountlist.c b/lib/mountlist.c index 6fed3575a4..dce4ce6f7a 100644 --- a/lib/mountlist.c +++ b/lib/mountlist.c @@ -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 \