aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2013-10-12 16:11:14 +0300
committerEli Zaretskii2013-10-12 16:11:14 +0300
commit2f4586ad044ba5deedadbccd4ad913c565ca3367 (patch)
tree439405a79aaf07dab0c37fb518ce2d2063ccd781
parent18f19af2a797ac472dee3bd226fbd8c327f04fb6 (diff)
downloademacs-2f4586ad044ba5deedadbccd4ad913c565ca3367.tar.gz
emacs-2f4586ad044ba5deedadbccd4ad913c565ca3367.zip
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.
-rw-r--r--nt/ChangeLog12
-rw-r--r--nt/inc/dirent.h21
-rw-r--r--nt/inc/ms-w32.h26
3 files changed, 59 insertions, 0 deletions
diff --git a/nt/ChangeLog b/nt/ChangeLog
index 390a8eb0227..cdd9ec60b11 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,15 @@
12013-10-12 Eli Zaretskii <eliz@gnu.org>
2
3 * inc/dirent.h (struct dirent) [__MINGW_MAJOR_VERSION >= 4]: Make
4 the layout of 'struct dirent' be compatible with MinGW32 runtime
5 versions 4.0 and later.
6
7 * inc/ms-w32.h (__MINGW_MAJOR_VERSION, __MINGW_MINOR_VERSION)
8 (__MINGW_PATCHLEVEL) [!__MINGW64_VERSION_MAJOR]: Define, if not
9 defined, but not for MinGW64.
10 (_USE_32BIT_TIME_T) [__MINGW64_VERSION_MAJOR]: Define, to force
11 use of 32-bit time_t type.
12
12013-10-07 Paul Eggert <eggert@cs.ucla.edu> 132013-10-07 Paul Eggert <eggert@cs.ucla.edu>
2 14
3 Improve support for popcount and counting trailing zeros (Bug#15550). 15 Improve support for popcount and counting trailing zeros (Bug#15550).
diff --git a/nt/inc/dirent.h b/nt/inc/dirent.h
index 676b82d207b..328635c4853 100644
--- a/nt/inc/dirent.h
+++ b/nt/inc/dirent.h
@@ -19,6 +19,27 @@ struct dirent /* data from readdir() */
19 long d_ino; /* inode number of entry */ 19 long d_ino; /* inode number of entry */
20 unsigned short d_reclen; /* length of this record */ 20 unsigned short d_reclen; /* length of this record */
21 unsigned short d_namlen; /* length of string in d_name */ 21 unsigned short d_namlen; /* length of string in d_name */
22#if __MINGW_MAJOR_VERSION >= 4
23 /* MinGW.org runtime 4.x introduces a modified layout of
24 'struct dirent', which makes it binary incompatible with
25 previous versions. To add insult to injury, the MinGW
26 startup code calls 'readdir', which is implemented in
27 w32.c. So we need to define the same layout of this struct
28 as the MinGW runtime does, or else command-line globbing
29 will be broken. (Versions of MinGW runtime after 4.0 are
30 supposed not to call 'readdir' from startup code, but we
31 had better be safe than sorry.) */
32 unsigned d_type; /* File attributes */
33 /* The next 3 fields are declared 'time_t' in the MinGW 4.0
34 headers, but 'time_t' is by default a 64-bit type in 4.x,
35 and presumably the libmingwex library was compiled using
36 that default definition. So we must use 64-bit types here,
37 even though our time_t is a 32-bit type. What a mess! */
38 __int64 d_time_create;
39 __int64 d_time_access; /* always midnight local time */
40 __int64 d_time_write;
41 _fsize_t d_size;
42#endif
22 char d_name[MAXNAMLEN+1]; /* name of file */ 43 char d_name[MAXNAMLEN+1]; /* name of file */
23 }; 44 };
24 45
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h
index e670079eb35..d5257d9a937 100644
--- a/nt/inc/ms-w32.h
+++ b/nt/inc/ms-w32.h
@@ -24,6 +24,32 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
24#define WINDOWSNT 24#define WINDOWSNT
25#endif 25#endif
26 26
27/* The @#$%^&! MinGW developers stopped updating the values of
28 __MINGW32_VERSION, __MINGW32_MAJOR_VERSION, and
29 __MINGW32_MINOR_VERSION values in v4.x of the runtime, to
30 "discourage its uses". So the values of those macros can no longer
31 be trusted, and we need the workaround below, to have a single set
32 of macros we can trust. (The .17 minor version is arbitrary.) */
33#ifdef __MINGW32__
34#include <_mingw.h>
35#endif
36/* MinGW64 doesn't have this problem, and does not define
37 __MINGW_VERSION. */
38#ifndef __MINGW64_VERSION_MAJOR
39# ifndef __MINGW_VERSION
40# define __MINGW_VERSION 3.17
41# undef __MINGW_MAJOR_VERSION
42# define __MINGW_MAJOR_VERSION 3
43# undef __MINGW_MINOR_VERSION
44# define __MINGW_MINOR_VERSION 17
45# undef __MINGW_PATCHLEVEL
46# define __MINGW_PATCHLEVEL 0
47# endif
48#endif
49#if __MINGW_MAJOR_VERSION >= 4
50# define _USE_32BIT_TIME_T
51#endif
52
27/* #undef const */ 53/* #undef const */
28 54
29/* Number of chars of output in the buffer of a stdio stream. */ 55/* Number of chars of output in the buffer of a stdio stream. */