]> code.delx.au - gnu-emacs/commitdiff
Fix more incompatibilities between MinGW.org and MinGW64 headers
authorEli Zaretskii <eliz@gnu.org>
Tue, 26 Mar 2013 08:21:27 +0000 (10:21 +0200)
committerEli Zaretskii <eliz@gnu.org>
Tue, 26 Mar 2013 08:21:27 +0000 (10:21 +0200)
Reported by ׃scar Fuentes in
  http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00699.html
and in
  http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00707.html.

 nt/inc/ms-w32.h (USE_NO_MINGW_SETJMP_TWO_ARGS) [_W64]: Define to 1.
 For MinGW64, include sys/types.h and time.h.
 nt/inc/sys/time.h (struct timeval) [!_W64]: Guard definition with _W64.
 (struct timezone) [!_TIMEZONE_DEFINED]: Guard definition with
 _TIMEZONE_DEFINED.
 nt/addpm.c (_WIN32_IE) [_W64]: For MinGW64, don't define to 0x400.
 nt/inc/sys/stat.h: Remove _CRTIMP from prototypes of fstat, stat,
 lstat, and fstatat.

 lib-src/ntlib.c (struct timespec) [!_TIMEZONE_DEFINED]: Define the
 struct only if _TIMEZONE_DEFINED is not defined.

 src/w32term.c (WCRANGE, GLYPHSET): Don't define if _W64 is defined.
 src/w32.c (REPARSE_DATA_BUFFER): Guard with
 MAXIMUM_REPARSE_DATA_BUFFER_SIZE being defined.

lib-src/ChangeLog
lib-src/ntlib.c
nt/ChangeLog
nt/addpm.c
nt/inc/ms-w32.h
nt/inc/sys/stat.h
nt/inc/sys/time.h
src/ChangeLog
src/w32.c
src/w32term.c

index 03412aa23b9afd39cfb46f9817c21cfc8d2a8b9b..10758d80872e6a90efe96cf55a187d0313a5835d 100644 (file)
@@ -1,3 +1,9 @@
+2013-03-26  Eli Zaretskii  <eliz@gnu.org>
+
+       Fix incompatibilities between MinGW.org and MinGW64 headers.
+       * ntlib.c (struct timespec) [!_TIMEZONE_DEFINED]: Define the
+       struct only if _TIMEZONE_DEFINED is not defined.
+
 2013-03-23  cg  <chengang31@gmail.com>  (tiny change)
 
        * makefile.w32-in (LIB_SRC): Move before first use.
index f43117457cb1de29b8f065ce0f13820b84abef8d..849abc2ede508353b3c94c123c8268292840fc0b 100644 (file)
@@ -34,11 +34,15 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "ntlib.h"
 
+/* MinGW64 defines _TIMEZONE_DEFINED and defines 'struct timespec' in
+   its system headers.  */
+#ifndef _TIMEZONE_DEFINED
 struct timezone
 {
   int          tz_minuteswest; /* minutes west of Greenwich */
   int          tz_dsttime;     /* type of dst correction */
 };
+#endif
 
 #define MAXPATHLEN _MAX_PATH
 
index 20579d36c79a1007908145efe88dd35d2f485484..f4fa0a7ee5322631e3b9ded8028b9ce3e97723ff 100644 (file)
@@ -1,3 +1,23 @@
+2013-03-26  Eli Zaretskii  <eliz@gnu.org>
+
+       Fix more incompatibilities between MinGW.org and MinGW64 headers
+       reported by Óscar Fuentes in
+       http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00699.html
+       and in
+       http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00707.html.
+       * inc/ms-w32.h (USE_NO_MINGW_SETJMP_TWO_ARGS) [_W64]: Define to 1.
+       For MinGW64, include sys/types.h and time.h.
+
+       * inc/sys/time.h (struct timeval) [!_W64]: Guard definition with
+       _W64.
+       (struct timezone) [!_TIMEZONE_DEFINED]: Guard definition with
+       _TIMEZONE_DEFINED.
+
+       * addpm.c (_WIN32_IE) [_W64]: For MinGW64, don't define to 0x400.
+
+       * inc/sys/stat.h: Remove _CRTIMP from prototypes of fstat, stat,
+       lstat, and fstatat.
+
 2013-03-25  Eli Zaretskii  <eliz@gnu.org>
 
        Fix incompatibilities between MinGW.org and MinGW64 headers
index 6ed625d908f33881a9eb4b98bfded5e64adccb44..8079d51dd64b024d48143f739b77e39d47e8331e 100644 (file)
@@ -34,7 +34,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    installed, then the DDE fallback for creating icons the Windows 3.1
    progman way will be used instead, but that is prone to lockups
    caused by other applications not servicing their message queues.  */
+/* MinGW64 defines _W64 and barfs if _WIN32_IE is defined to anything
+   below 0x500.  */
+#ifndef _W64
 #define _WIN32_IE 0x400
+#endif
 /* Request C Object macros for COM interfaces.  */
 #define COBJMACROS 1
 
index d3faa6d2b2ff5f1fa039eb09a0470841971ef988..ccab3695c6c6a0990ec7b94c2ec4c52faa1c79aa 100644 (file)
@@ -154,6 +154,14 @@ extern char *getenv ();
 
 #ifdef emacs
 
+#ifdef _W64
+/* MinGW64 specific stuff.  */
+#define USE_NO_MINGW_SETJMP_TWO_ARGS 1
+/* Make sure 'struct timespec' and 'struct timezone' are defined.  */
+#include <sys/types.h>
+#include <time.h>
+#endif
+
 #ifdef _MSC_VER
 #include <sys/timeb.h>
 #include <sys/stat.h>
index c356283c04b1a285b02064b040d072d0482b874b..31129bbf4f30d22237f22dd75ef53ec775683c9a 100644 (file)
@@ -106,11 +106,11 @@ extern int w32_stat_get_owner_group;
 /* Prevent redefinition by other headers, e.g. wchar.h.  */
 #define _STAT_DEFINED
 
-_CRTIMP int __cdecl __MINGW_NOTHROW    fstat (int, struct stat*);
-_CRTIMP int __cdecl __MINGW_NOTHROW    chmod (const char*, int);
-_CRTIMP int __cdecl __MINGW_NOTHROW    stat (const char*, struct stat*);
-_CRTIMP int __cdecl __MINGW_NOTHROW    lstat (const char*, struct stat*);
-_CRTIMP int __cdecl __MINGW_NOTHROW    fstatat (int, char const *,
+int __cdecl __MINGW_NOTHROW    fstat (int, struct stat*);
+int __cdecl __MINGW_NOTHROW    stat (const char*, struct stat*);
+int __cdecl __MINGW_NOTHROW    lstat (const char*, struct stat*);
+int __cdecl __MINGW_NOTHROW    fstatat (int, char const *,
                                                 struct stat *, int);
+_CRTIMP int __cdecl __MINGW_NOTHROW    chmod (const char*, int);
 
 #endif /* INC_SYS_STAT_H_ */
index e49f0ea4de3b3a433028480d603e79da4140d890..80c725385bb31e252a304acbf9126b5fd2c1ed55 100644 (file)
@@ -6,31 +6,34 @@
  * have the below stuff.
  */
 
+/* The guards are for MinGW64, which defines these structs on its
+   system headers which are included by ms-w32.h.  */
+#ifndef _W64
 struct timeval
 {
   long         tv_sec;         /* seconds */
   long         tv_usec;        /* microseconds */
 };
+#endif
 
+#ifndef _TIMEZONE_DEFINED
 struct timezone
 {
   int          tz_minuteswest; /* minutes west of Greenwich */
   int          tz_dsttime;     /* type of dst correction */
 };
+#endif
 
 void gettimeofday (struct timeval *, struct timezone *);
 
 #define ITIMER_REAL      0
 #define ITIMER_PROF      1
 
-/* MinGW64 defines 'struct itimerval' and _TIMESPEC_DEFINED in sys/types.h.  */
-#ifndef _TIMESPEC_DEFINED
 struct itimerval
 {
   struct  timeval it_interval; /* timer interval */
   struct  timeval it_value;    /* current value */
 };
-#endif
 
 int getitimer (int, struct itimerval *);
 int setitimer (int, struct itimerval *, struct itimerval *);
index 107d2af866b6e8619fa3c359756b82a5e6e0269c..669c8e99a27a9a50ce90c08cf368c60bc44c5e44 100644 (file)
@@ -1,3 +1,11 @@
+2013-03-26  Eli Zaretskii  <eliz@gnu.org>
+
+       Fix incompatibilities between MinGW.org and MinGW64 headers.
+       * w32term.c (WCRANGE, GLYPHSET): Don't define if _W64 is defined.
+
+       * w32.c (REPARSE_DATA_BUFFER): Guard with
+       MAXIMUM_REPARSE_DATA_BUFFER_SIZE being defined.
+
 2013-03-25  Jan Djärv  <jan.h.d@swipnet.se>
 
        * xterm.c: Include X11/XKBlib.h
index 647faf94ef17c9da6ba5da71f6b71be37aa21071..f34d98bc1b8c78822655e9c9d642f9a155e2d94a 100644 (file)
--- a/src/w32.c
+++ b/src/w32.c
@@ -127,7 +127,7 @@ typedef struct _PROCESS_MEMORY_COUNTERS_EX {
 #define SDDL_REVISION_1        1
 #endif /* SDDL_REVISION_1 */
 
-#ifdef _MSC_VER
+#ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE
 /* MSVC doesn't provide the definition of REPARSE_DATA_BUFFER and the
    associated macros, except on ntifs.h, which cannot be included
    because it triggers conflicts with other Windows API headers.  So
index e02b5a612294487fdf30bddc871eda85aceea223..5f7952c2ec28f641b8ce38be95be346670939f64 100644 (file)
@@ -109,9 +109,10 @@ struct w32_display_info *x_display_list;
 Lisp_Object w32_display_name_list;
 
 
-#if _WIN32_WINNT < 0x0500
+#if _WIN32_WINNT < 0x0500 && !defined(_W64)
 /* Pre Windows 2000, this was not available, but define it here so
-   that Emacs compiled on such a platform will run on newer versions.  */
+   that Emacs compiled on such a platform will run on newer versions.
+   MinGW64 (_W64) defines these unconditionally, so avoid redefining.  */
 
 typedef struct tagWCRANGE
 {