emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r114637: Make the MinGW32 build compatible with MinG


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r114637: Make the MinGW32 build compatible with MinGW runtime 4.x.
Date: Sat, 12 Oct 2013 13:12:16 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114637
revision-id: address@hidden
parent: address@hidden
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2013-10-12 16:11:14 +0300
message:
  Make the MinGW32 build compatible with MinGW runtime 4.x.
  
   nt/inc/dirent.h (struct dirent) [__MINGW_MAJOR_VERSION >= 4]: Make
   the layout of 'struct dirent' be compatible with MinGW32 runtime
   versions 4.0 and later.
   nt/inc/ms-w32.h (__MINGW_MAJOR_VERSION, __MINGW_MINOR_VERSION)
   (__MINGW_PATCHLEVEL) [!__MINGW64_VERSION_MAJOR]: Define, if not
   defined, but not for MinGW64.
   (_USE_32BIT_TIME_T) [__MINGW64_VERSION_MAJOR]: Define, to force
   use of 32-bit time_t type.
modified:
  nt/ChangeLog                   changelog-20091113204419-o5vbwnq5f7feedwu-1545
  nt/inc/dirent.h                ndir.h-20091113204419-o5vbwnq5f7feedwu-417
  nt/inc/ms-w32.h                msw32.h-20091113204419-o5vbwnq5f7feedwu-807
=== modified file 'nt/ChangeLog'
--- a/nt/ChangeLog      2013-10-07 21:37:19 +0000
+++ b/nt/ChangeLog      2013-10-12 13:11:14 +0000
@@ -1,3 +1,15 @@
+2013-10-12  Eli Zaretskii  <address@hidden>
+
+       * inc/dirent.h (struct dirent) [__MINGW_MAJOR_VERSION >= 4]: Make
+       the layout of 'struct dirent' be compatible with MinGW32 runtime
+       versions 4.0 and later.
+
+       * inc/ms-w32.h (__MINGW_MAJOR_VERSION, __MINGW_MINOR_VERSION)
+       (__MINGW_PATCHLEVEL) [!__MINGW64_VERSION_MAJOR]: Define, if not
+       defined, but not for MinGW64.
+       (_USE_32BIT_TIME_T) [__MINGW64_VERSION_MAJOR]: Define, to force
+       use of 32-bit time_t type.
+
 2013-10-07  Paul Eggert  <address@hidden>
 
        Improve support for popcount and counting trailing zeros (Bug#15550).

=== modified file 'nt/inc/dirent.h'
--- a/nt/inc/dirent.h   2013-01-28 14:41:08 +0000
+++ b/nt/inc/dirent.h   2013-10-12 13:11:14 +0000
@@ -19,6 +19,27 @@
        long            d_ino;          /* inode number of entry */
        unsigned short  d_reclen;       /* length of this record */
        unsigned short  d_namlen;       /* length of string in d_name */
+#if __MINGW_MAJOR_VERSION >= 4
+       /* MinGW.org runtime 4.x introduces a modified layout of
+          'struct dirent', which makes it binary incompatible with
+          previous versions.  To add insult to injury, the MinGW
+          startup code calls 'readdir', which is implemented in
+          w32.c.  So we need to define the same layout of this struct
+          as the MinGW runtime does, or else command-line globbing
+          will be broken.  (Versions of MinGW runtime after 4.0 are
+          supposed not to call 'readdir' from startup code, but we
+          had better be safe than sorry.)  */
+       unsigned        d_type;         /* File attributes */
+       /* The next 3 fields are declared 'time_t' in the MinGW 4.0
+          headers, but 'time_t' is by default a 64-bit type in 4.x,
+          and presumably the libmingwex library was compiled using
+          that default definition.  So we must use 64-bit types here,
+          even though our time_t is a 32-bit type.  What a mess!  */
+       __int64         d_time_create;
+       __int64         d_time_access;  /* always midnight local time */
+       __int64         d_time_write;
+       _fsize_t        d_size;
+#endif
        char            d_name[MAXNAMLEN+1];    /* name of file */
        };
 

=== modified file 'nt/inc/ms-w32.h'
--- a/nt/inc/ms-w32.h   2013-08-04 15:43:10 +0000
+++ b/nt/inc/ms-w32.h   2013-10-12 13:11:14 +0000
@@ -24,6 +24,32 @@
 #define WINDOWSNT
 #endif
 
+/* The @#$%^&! MinGW developers stopped updating the values of
+   __MINGW32_VERSION, __MINGW32_MAJOR_VERSION, and
+   __MINGW32_MINOR_VERSION values in v4.x of the runtime, to
+   "discourage its uses".  So the values of those macros can no longer
+   be trusted, and we need the workaround below, to have a single set
+   of macros we can trust.  (The .17 minor version is arbitrary.)  */
+#ifdef __MINGW32__
+#include <_mingw.h>
+#endif
+/* MinGW64 doesn't have this problem, and does not define
+   __MINGW_VERSION.  */
+#ifndef __MINGW64_VERSION_MAJOR
+# ifndef __MINGW_VERSION
+#  define __MINGW_VERSION 3.17
+#  undef __MINGW_MAJOR_VERSION
+#  define __MINGW_MAJOR_VERSION 3
+#  undef __MINGW_MINOR_VERSION
+#  define __MINGW_MINOR_VERSION 17
+#  undef __MINGW_PATCHLEVEL
+#  define __MINGW_PATCHLEVEL 0
+# endif
+#endif
+#if __MINGW_MAJOR_VERSION >= 4
+# define _USE_32BIT_TIME_T
+#endif
+
 /* #undef const */
 
 /* Number of chars of output in the buffer of a stdio stream. */


reply via email to

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