emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] concurrency 470e302: Fix the MS-Windows build


From: Eli Zaretskii
Subject: [Emacs-diffs] concurrency 470e302: Fix the MS-Windows build
Date: Mon, 02 Nov 2015 17:04:57 +0000

branch: concurrency
commit 470e3028d8a741d97349faa8fdeb148d913a49d0
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix the MS-Windows build
    
    * src/thread.h [WINDOWSNT]: Include sys/socket.h.
    
    * src/sysselect.h: Don't define fd_set and FD_* macros for
    MS-Windows here.
    * src/w32.h: Define them here.
    
    * src/process.h (sys_select): Declare prototype.
    
    * src/sysdep.c:
    * src/process.c:
    * src/filelock.c:
    * src/emacs.c:
    * src/callproc.c: Move inclusion of sys/select.h after lisp.h.
    * nt/inc/socket.h: Include w32.h instead of sysselect.h
---
 nt/inc/sys/socket.h |    2 +-
 src/callproc.c      |    6 ++----
 src/emacs.c         |   10 ++++------
 src/filelock.c      |    7 ++-----
 src/process.c       |    7 ++++---
 src/sysdep.c        |   22 +++++++++++-----------
 src/sysselect.h     |   38 ++++----------------------------------
 src/thread.h        |    4 ++++
 src/w32.c           |    3 +--
 src/w32.h           |   26 ++++++++++++++++++++++++++
 10 files changed, 59 insertions(+), 66 deletions(-)

diff --git a/nt/inc/sys/socket.h b/nt/inc/sys/socket.h
index 6ad1216..067effe 100644
--- a/nt/inc/sys/socket.h
+++ b/nt/inc/sys/socket.h
@@ -74,7 +74,7 @@ typedef unsigned short uint16_t;
 
 /* allow us to provide our own version of fd_set */
 #define fd_set ws_fd_set
-#include "sysselect.h"
+#include "w32.h"
 #endif /* EMACS_CONFIG_H */
 
 #if defined (HAVE_TIMEVAL) && defined (_MSC_VER)
diff --git a/src/callproc.c b/src/callproc.c
index a6c7bda..bb21c35 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -27,14 +27,12 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 
 #include <sys/file.h>
 #include <fcntl.h>
-#ifdef WINDOWSNT
-#define NOMINMAX
-#include <sys/socket.h>        /* for fcntl */
-#endif
 
 #include "lisp.h"
 
 #ifdef WINDOWSNT
+#define NOMINMAX
+#include <sys/socket.h>        /* for fcntl */
 #include <windows.h>
 #include "w32.h"
 #define _P_NOWAIT 1    /* from process.h */
diff --git a/src/emacs.c b/src/emacs.c
index 9dc4e42..f91e549 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -31,20 +31,18 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 
 #include <close-stream.h>
 
+#define MAIN_PROGRAM
+#include "lisp.h"
+
 #ifdef WINDOWSNT
 #include <fcntl.h>
 #include <sys/socket.h>
 #include <mbstring.h>
+#include "w32.h"
 #include "w32heap.h"
 #endif
 
-#define MAIN_PROGRAM
-#include "lisp.h"
-
 #if defined WINDOWSNT || defined HAVE_NTGUI
-#ifdef WINDOWSNT
-#include "w32.h"
-#endif
 #include "w32select.h"
 #include "w32font.h"
 #include "w32common.h"
diff --git a/src/filelock.c b/src/filelock.c
index b37319c..7f9b6e7 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -40,11 +40,6 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #include <sys/sysctl.h>
 #endif /* __FreeBSD__ */
 
-#ifdef WINDOWSNT
-#include <share.h>
-#include <sys/socket.h>        /* for fcntl */
-#endif
-
 #include <errno.h>
 
 #include <c-ctype.h>
@@ -53,6 +48,8 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #include "buffer.h"
 #include "coding.h"
 #ifdef WINDOWSNT
+#include <share.h>
+#include <sys/socket.h>        /* for fcntl */
 #include "w32.h"       /* for dostounix_filename */
 #endif
 
diff --git a/src/process.c b/src/process.c
index 791f8f5..5e9b687 100644
--- a/src/process.c
+++ b/src/process.c
@@ -29,6 +29,8 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #include <unistd.h>
 #include <fcntl.h>
 
+#include "lisp.h"
+
 /* Only MS-DOS does not define `subprocesses'.  */
 #ifdef subprocesses
 
@@ -92,8 +94,6 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 
 #endif /* subprocesses */
 
-#include "lisp.h"
-
 #include "systime.h"
 #include "systty.h"
 
@@ -126,7 +126,8 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #endif
 
 #ifdef WINDOWSNT
-#include "w32.h"
+extern int sys_select (int, fd_set *, fd_set *, fd_set *,
+                       struct timespec *, sigset_t *);
 #endif
 
 /* Work around GCC 4.7.0 bug with strict overflow checking; see
diff --git a/src/sysdep.c b/src/sysdep.c
index ba6be57..d75dcd3 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -39,17 +39,6 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #include <c-ctype.h>
 #include <utimens.h>
 
-#ifdef HAVE_SOCKETS
-#include <sys/socket.h>
-#include <netdb.h>
-#endif /* HAVE_SOCKETS */
-
-#ifdef TRY_AGAIN
-#ifndef HAVE_H_ERRNO
-extern int h_errno;
-#endif
-#endif /* TRY_AGAIN */
-
 #include "lisp.h"
 #include "sysselect.h"
 #include "blockinput.h"
@@ -68,6 +57,17 @@ extern int h_errno;
 # include <math.h>
 #endif
 
+#ifdef HAVE_SOCKETS
+#include <sys/socket.h>
+#include <netdb.h>
+#endif /* HAVE_SOCKETS */
+
+#ifdef TRY_AGAIN
+#ifndef HAVE_H_ERRNO
+extern int h_errno;
+#endif
+#endif /* TRY_AGAIN */
+
 #ifdef WINDOWSNT
 #define read sys_read
 #define write sys_write
diff --git a/src/sysselect.h b/src/sysselect.h
index e0f7b4e..d6c5d1c 100644
--- a/src/sysselect.h
+++ b/src/sysselect.h
@@ -25,40 +25,10 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 
-#ifdef WINDOWSNT
-
-/* File descriptor set emulation.  */
-
-/* MSVC runtime library has limit of 64 descriptors by default */
-#define FD_SETSIZE  64
-typedef struct {
-  unsigned int bits[FD_SETSIZE / 32];
-} fd_set;
-
-/* standard access macros */
-#define FD_SET(n, p) \
-  do { \
-    if ((n) < FD_SETSIZE) { \
-      (p)->bits[(n)/32] |= (1 << (n)%32); \
-    } \
-  } while (0)
-#define FD_CLR(n, p) \
-  do { \
-    if ((n) < FD_SETSIZE) { \
-      (p)->bits[(n)/32] &= ~(1 << (n)%32); \
-    } \
-  } while (0)
-#define FD_ISSET(n, p) ((n) < FD_SETSIZE ? ((p)->bits[(n)/32] & (1 << (n)%32)) 
: 0)
-#define FD_ZERO(p) memset((p), 0, sizeof(fd_set))
-
-#define SELECT_TYPE fd_set
-
-#include "systime.h"
-extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
-                      struct timespec *, sigset_t *);
-
-#else  /* not WINDOWSNT */
-
+/* The w32 build defines select stuff in w32.h, which is included
+   where w32 needs it, but not where sysselect.h is included.  The w32
+   definitions in w32.h are incompatible with the below.  */
+#ifndef WINDOWSNT
 #ifdef FD_SET
 #ifndef FD_SETSIZE
 #define FD_SETSIZE 64
diff --git a/src/thread.h b/src/thread.h
index d155837..91bab82 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -21,6 +21,10 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 
 #include "regex.h"
 
+#ifdef WINDOWSNT
+#include <sys/socket.h>
+#endif
+
 #include "sysselect.h"         /* FIXME */
 #include "systime.h"           /* FIXME */
 
diff --git a/src/w32.c b/src/w32.c
index 0966b8d..93eb628 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -42,8 +42,6 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #include <config.h>
 #include <mbstring.h>  /* for _mbspbrk, _mbslwr, _mbsrchr, ... */
 
-#include <sys/socket.h>
-
 #undef access
 #undef chdir
 #undef chmod
@@ -205,6 +203,7 @@ typedef struct _REPARSE_DATA_BUFFER {
 #endif
 
 /* TCP connection support.  */
+#include <sys/socket.h>
 #undef socket
 #undef bind
 #undef connect
diff --git a/src/w32.h b/src/w32.h
index 7de0547..29a3ae3 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -25,6 +25,32 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 
 #include <windows.h>
 
+/* File descriptor set emulation.  */
+
+/* MSVC runtime library has limit of 64 descriptors by default */
+#define FD_SETSIZE  64
+typedef struct {
+  unsigned int bits[FD_SETSIZE / 32];
+} fd_set;
+
+/* standard access macros */
+#define FD_SET(n, p) \
+  do { \
+    if ((n) < FD_SETSIZE) { \
+      (p)->bits[(n)/32] |= (1 << (n)%32); \
+    } \
+  } while (0)
+#define FD_CLR(n, p) \
+  do { \
+    if ((n) < FD_SETSIZE) { \
+      (p)->bits[(n)/32] &= ~(1 << (n)%32); \
+    } \
+  } while (0)
+#define FD_ISSET(n, p) ((n) < FD_SETSIZE ? ((p)->bits[(n)/32] & (1 << (n)%32)) 
: 0)
+#define FD_ZERO(p) memset((p), 0, sizeof(fd_set))
+
+#define SELECT_TYPE fd_set
+
 /* ------------------------------------------------------------------------- */
 
 /* child_process.status values */



reply via email to

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