From: Bruno Haible Date: Sat, 17 Dec 2016 13:16:50 +0000 (+0100) Subject: Avoid redefinition errors on MSVC. X-Git-Tag: v1.0~6481 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=5b60c835c42c2444a62076d430a038f836f1aa42;p=gnulib.git Avoid redefinition errors on MSVC. * lib/stdio.in.h: Include and when necessary. * lib/unistd.in.h: Include when necessary. --- diff --git a/ChangeLog b/ChangeLog index 09c238ab67..68912522ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2016-12-17 Bruno Haible + + Avoid redefinition errors on MSVC. + * lib/stdio.in.h: Include and when necessary. + * lib/unistd.in.h: Include when necessary. + 2016-12-17 Bruno Haible stdint: Fix WINT_MAX to match the gnulib provided wint_t on MSVC. diff --git a/lib/stdio.in.h b/lib/stdio.in.h index 4a6e9ff401..fff16a55f2 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -118,6 +118,26 @@ # include #endif +/* MSVC declares 'perror' in , not in . We must include + it before we #define perror rpl_perror. */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \ + && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \ + && ! defined __GLIBC__ +# include +#endif + +/* MSVC declares 'remove' in , not in . We must include + it before we #define remove rpl_remove. */ +/* MSVC declares 'rename' in , not in . We must include + it before we #define rename rpl_rename. */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \ + && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \ + && ! defined __GLIBC__ +# include +#endif + /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 686eb818c2..e7e977c16f 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -55,9 +55,13 @@ #include /* mingw doesn't define the SEEK_* or *_FILENO macros in . */ +/* MSVC declares 'unlink' in , not in . We must include + it before we #define unlink rpl_unlink. */ /* Cygwin 1.7.1 declares symlinkat in , not in . */ /* But avoid namespace pollution on glibc systems. */ #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ + || ((@GNULIB_UNLINK@ || defined GNULIB_POSIXCHECK) \ + && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) \ || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \ && defined __CYGWIN__)) \ && ! defined __GLIBC__