]> Savannah Git Hosting - gnulib.git/commitdiff
Tweak the Windows oldnames workaround.
authorBruno Haible <bruno@clisp.org>
Mon, 7 Dec 2020 12:50:53 +0000 (13:50 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 7 Dec 2020 12:50:53 +0000 (13:50 +0100)
Reported by Daniel R. Hurtmans <Daniel.Hurtmans@ulb.ac.be> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00073.html>.

* lib/unistd.in.h: On native Windows, include <io.h> and <direct.h>
always.
(getcwd): Use _GL_CXXALIAS_MDA_CAST.
* lib/stdlib.in.h (putenv): Likewise.

ChangeLog
lib/stdlib.in.h
lib/unistd.in.h

index 5f4ae46a6f8625d3de24b91eda87ef3b5c39d94c..6dfedc47f358898d8c8738d812e3faf4d3bd4083 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2020-12-06  Bruno Haible  <bruno@clisp.org>
+
+       Tweak the Windows oldnames workaround.
+       Reported by Daniel R. Hurtmans <Daniel.Hurtmans@ulb.ac.be> in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00073.html>.
+       * lib/unistd.in.h: On native Windows, include <io.h> and <direct.h>
+       always.
+       (getcwd): Use _GL_CXXALIAS_MDA_CAST.
+       * lib/stdlib.in.h (putenv): Likewise.
+
 2020-12-06  Paul Eggert  <eggert@cs.ucla.edu>
 
        doc: fix flat address space discussion
index c7ec0786fbcb75076123e7b16e6f67ecadea44f9..a76fbdc3d43998ef2aed1564806bd18f888f9816 100644 (file)
@@ -694,7 +694,9 @@ _GL_CXXALIASWARN (putenv);
 #   undef putenv
 #   define putenv _putenv
 #  endif
-_GL_CXXALIAS_MDA (putenv, int, (char *string));
+/* Need to cast, because on mingw, the parameter is either
+   'const char *string' or 'char *string'.  */
+_GL_CXXALIAS_MDA_CAST (putenv, int, (char *string));
 # else
 _GL_CXXALIAS_SYS (putenv, int, (char *string));
 # endif
index c9fb36889ae8b4c9c7b394cd14285578dbd3beef..8a02899f3868fd0e205b385a863f91fc80628375 100644 (file)
    <io.h> and/or <direct.h>, not in <unistd.h>.
    They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(),
    _lseek(), _read(), _unlink(), _write() in <io.h>.  */
-#if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
-      || defined GNULIB_POSIXCHECK) \
-     && (defined _WIN32 && ! defined __CYGWIN__))
-# include <io.h>     /* mingw32, mingw64 */
-# include <direct.h> /* mingw64, MSVC 9 */
-#elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \
-       || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \
-       || defined GNULIB_POSIXCHECK) \
-      && (defined _WIN32 && ! defined __CYGWIN__)
+#if defined _WIN32 && !defined __CYGWIN__
 # include <io.h>
+# include <direct.h>
 #endif
 
 /* Native Windows platforms declare _execl*, _execv* in <process.h>.  */
@@ -937,7 +930,9 @@ _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
 #   undef getcwd
 #   define getcwd _getcwd
 #  endif
-_GL_CXXALIAS_MDA (getcwd, char *, (char *buf, size_t size));
+/* Need to cast, because on mingw, the second parameter is either
+   'int size' or 'size_t size'.  */
+_GL_CXXALIAS_MDA_CAST (getcwd, char *, (char *buf, size_t size));
 # else
 _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
 # endif