bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ and read redefinition


From: Daniel R. Hurtmans
Subject: Re: C++ and read redefinition
Date: Mon, 7 Dec 2020 14:17:33 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.3

Hello Bruno,

Works wonderfully!
For the record I'm using x86_64-w64-mingw32-g++ (GCC) 10.2.0

Thanks again,

Daniel


On 07/12/2020 13:54, Bruno Haible wrote:
Hello Daniel,

I made the changes, and it almost works (at least errors which where
generated before are gone).
But now I get these:
...

Probably you're using a different version of mingw than I do. I'm adding
this change. Hope it helps.


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.

diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index c7ec078..a76fbdc 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -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
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index c9fb368..8a02899 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -97,16 +97,9 @@
     <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



--
/----------------------------------------------------------------------\
| Daniel R. Hurtmans            http://www.ulb.ac.be/cpm               |
| Daniel.Hurtmans@ulb.ac.be                                            |
|                                                                      |
| Phone:  +32-2-650 49 40       Fax:   +32-2-650 42 32                 |
| Université Libre de Bruxelles / SQUARES                              |
|   |\     ___,,--,        _                                           |
|   /,`--''        \-,,__,'/   50 Av F.D. Roosevelt CPi 160/09         |
| |,4   ) )_    ) /~-----'     B-1050 Bruxelles, BELGIUM               |
\-'---^~(_/-_)--(_/_)--------------------------------------------------/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]