unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Latest EMACS on BZR trunk does not compile with MinGW
@ 2014-06-03 20:00 Vincent Belaïche
  2014-06-03 20:22 ` Paul Eggert
  2014-06-03 21:14 ` Latest EMACS on BZR trunk does not compile with MinGW Eli Zaretskii
  0 siblings, 2 replies; 38+ messages in thread
From: Vincent Belaïche @ 2014-06-03 20:00 UTC (permalink / raw)
  To: EMACS devel list

Here is what I get:

dup2.c:35:0: warning: "WIN32_LEAN_AND_MEAN" redefined [enabled by default]
c:/Programme/GNU/installation/emacs-install/emacs/trunk/nt/inc/ms-w32.h:148:0: note: this is the location of the previous definition
dup2.c:38:26: fatal error: msvc-inval.h: No such file or directory
compilation terminated.


msvc-inval.h, given its naming, is probably a file from the MS Visual C
compiler suite, it seems that it is not available with MinGW --- at
least with the version of the gcc suite installed on my machine.

Here is the problematic piece of code from dup2.c:

-----------------------------------------------------------------------
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__

/* Get declarations of the native Windows API functions.  */
#  define WIN32_LEAN_AND_MEAN
#  include <windows.h>

#  include "msvc-inval.h"

/* Get _get_osfhandle.  */
#  include "msvc-nothrow.h"

static int
ms_windows_dup2 (int fd, int desired_fd)
{
  int result;

  /* If fd is closed, mingw hangs on dup2 (fd, fd).  If fd is open,
     dup2 (fd, fd) returns 0, but all further attempts to use fd in
     future dup2 calls will hang.  */
  if (fd == desired_fd)
    {
      if ((HANDLE) _get_osfhandle (fd) == INVALID_HANDLE_VALUE)
        {
          errno = EBADF;
          return -1;
        }
      return fd;
    }

  /* Wine 1.0.1 return 0 when desired_fd is negative but not -1:
     http://bugs.winehq.org/show_bug.cgi?id=21289 */
  if (desired_fd < 0)
    {
      errno = EBADF;
      return -1;
    }

  TRY_MSVC_INVAL
    {
      result = dup2 (fd, desired_fd);
    }
  CATCH_MSVC_INVAL
    {
      errno = EBADF;
      result = -1;
    }
  DONE_MSVC_INVAL;

  if (result == 0)
    result = desired_fd;

  return result;
}

#  define dup2 ms_windows_dup2

# endif
-----------------------------------------------------------------------

Maybe the  

 `&& ! defined __CYGWIN__'

wherever used in this file for this topic should be replaced by

`&& defined _MSC_VER' 

or something like that --- I cannot remember exactly the #definition
that one can use to detect MSVC compiler.

An alternative would be to use

`&& ! defined __CYGWIN__ && ! defined __MINGW32__'

but well, if the msvc_xxx.h file are MSVC specific, I would prefer the
other one.

VBR,
   Vincent.



^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2014-06-10 20:21 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-03 20:00 Latest EMACS on BZR trunk does not compile with MinGW Vincent Belaïche
2014-06-03 20:22 ` Paul Eggert
2014-06-03 20:56   ` Óscar Fuentes
2014-06-03 21:15   ` Eli Zaretskii
2014-06-03 21:21     ` Vincent Belaïche
2014-06-04  6:47       ` Eli Zaretskii
2014-06-04 13:17         ` Vincent Belaïche
2014-06-04 13:31           ` Eli Zaretskii
2014-06-04 15:28             ` Vincent Belaïche
2014-06-04 15:44               ` Eli Zaretskii
2014-06-04 15:54                 ` Dani Moncayo
2014-06-04 16:05                   ` Eli Zaretskii
2014-06-04 21:50                     ` Dani Moncayo
2014-06-05  0:42                       ` Stefan Monnier
2014-06-05  2:51                         ` Eli Zaretskii
2014-06-05  3:40                           ` Óscar Fuentes
2014-06-05  7:03                             ` Dani Moncayo
2014-06-05  9:03                               ` Vincent Belaïche
2014-06-05 15:09                                 ` Eli Zaretskii
2014-06-05 14:51                             ` Eli Zaretskii
2014-06-05 16:19                               ` Óscar Fuentes
2014-06-05 17:52                                 ` Eli Zaretskii
2014-06-05 13:31                           ` Stefan Monnier
2014-06-05 15:15                             ` Eli Zaretskii
2014-06-05 16:50                               ` Stefan Monnier
2014-06-05 18:07                                 ` Eli Zaretskii
2014-06-05 19:35                                   ` Paul Eggert
2014-06-05 19:54                                     ` Eli Zaretskii
2014-06-10 19:25                                     ` Dani Moncayo
2014-06-10 20:21                                       ` Eli Zaretskii
2014-06-05 20:54                                   ` Stefan Monnier
2014-06-05  2:47                       ` Eli Zaretskii
2014-06-04 12:22     ` Using Qunsupported__w32_dialog Dmitry Antipov
2014-06-04 13:09       ` Eli Zaretskii
2014-06-04 13:37         ` Dmitry Antipov
2014-06-04 13:47           ` Eli Zaretskii
2014-06-04 14:06             ` Eli Zaretskii
2014-06-03 21:14 ` Latest EMACS on BZR trunk does not compile with MinGW Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).