diff options
author | Ken Raeburn <raeburn@raeburn.org> | 2015-11-01 01:42:21 -0400 |
---|---|---|
committer | Ken Raeburn <raeburn@raeburn.org> | 2015-11-01 01:42:21 -0400 |
commit | 39372e1a1032521be74575bb06f95a3898fbae30 (patch) | |
tree | 754bd242a23d2358ea116126fcb0a629947bd9ec /nt/inc | |
parent | 6a3121904d76e3b2f63007341d48c5c1af55de80 (diff) | |
parent | e11aaee266da52937a3a031cb108fe13f68958c3 (diff) | |
download | emacs-39372e1a1032521be74575bb06f95a3898fbae30.tar.gz |
merge from trunk
Diffstat (limited to 'nt/inc')
-rw-r--r-- | nt/inc/dirent.h | 23 | ||||
-rw-r--r-- | nt/inc/grp.h | 2 | ||||
-rw-r--r-- | nt/inc/inttypes.h | 4 | ||||
-rw-r--r-- | nt/inc/langinfo.h | 2 | ||||
-rw-r--r-- | nt/inc/mingw_time.h | 32 | ||||
-rw-r--r-- | nt/inc/ms-w32.h | 115 | ||||
-rw-r--r-- | nt/inc/nl_types.h | 2 | ||||
-rw-r--r-- | nt/inc/stdint.h | 2 | ||||
-rw-r--r-- | nt/inc/sys/mman.h | 31 | ||||
-rw-r--r-- | nt/inc/sys/socket.h | 2 | ||||
-rw-r--r-- | nt/inc/sys/stat.h | 9 | ||||
-rw-r--r-- | nt/inc/sys/wait.h | 2 |
12 files changed, 182 insertions, 44 deletions
diff --git a/nt/inc/dirent.h b/nt/inc/dirent.h index 676b82d207b..88f35bf16a9 100644 --- a/nt/inc/dirent.h +++ b/nt/inc/dirent.h @@ -19,7 +19,28 @@ struct dirent /* data from readdir() */ 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 */ - char d_name[MAXNAMLEN+1]; /* name of file */ +#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 * 4 + 1]; /* name of file */ }; typedef struct diff --git a/nt/inc/grp.h b/nt/inc/grp.h index 02c0ef7f3a0..7d4e6fbbe2f 100644 --- a/nt/inc/grp.h +++ b/nt/inc/grp.h @@ -1,6 +1,6 @@ /* Replacement grp.h file for building GNU Emacs on Windows. -Copyright (C) 2003-2013 Free Software Foundation, Inc. +Copyright (C) 2003-2015 Free Software Foundation, Inc. This file is part of GNU Emacs. diff --git a/nt/inc/inttypes.h b/nt/inc/inttypes.h index 4629ccb038c..a07d64e71ac 100644 --- a/nt/inc/inttypes.h +++ b/nt/inc/inttypes.h @@ -1,6 +1,6 @@ -/* Replacement inntypes.h file for building GNU Emacs on Windows with MSVC. +/* Replacement inttypes.h file for building GNU Emacs on Windows with MSVC. -Copyright (C) 2011-2013 Free Software Foundation, Inc. +Copyright (C) 2011-2015 Free Software Foundation, Inc. This file is part of GNU Emacs. diff --git a/nt/inc/langinfo.h b/nt/inc/langinfo.h index 93a56e548c7..c9d2e6ed497 100644 --- a/nt/inc/langinfo.h +++ b/nt/inc/langinfo.h @@ -1,6 +1,6 @@ /* Replacement langinfo.h file for building GNU Emacs on Windows. -Copyright (C) 2006-2013 Free Software Foundation, Inc. +Copyright (C) 2006-2015 Free Software Foundation, Inc. This file is part of GNU Emacs. diff --git a/nt/inc/mingw_time.h b/nt/inc/mingw_time.h new file mode 100644 index 00000000000..ef6eeaf0f35 --- /dev/null +++ b/nt/inc/mingw_time.h @@ -0,0 +1,32 @@ +/* Fix issues related to MinGW 4.x handling of time data types. */ + +#ifndef _MINGW_TIME_H +#define _MINGW_TIME_H + +/* 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 + +#endif diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index e670079eb35..e7a94e81c2d 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h @@ -1,6 +1,6 @@ /* System description file for Windows NT. -Copyright (C) 1993-1995, 2001-2013 Free Software Foundation, Inc. +Copyright (C) 1993-1995, 2001-2015 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -24,6 +24,18 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define WINDOWSNT #endif +#include <mingw_time.h> + +/* MinGW-w64 gcc does not automotically define a macro for + differentiating it fom MinGW gcc. We need to test the presence of + __MINGW64_VERSION_MAJOR in _mingw.h: */ +#ifdef __MINGW32__ +# include <_mingw.h> +# ifdef __MINGW64_VERSION_MAJOR +# define MINGW_W64 +# endif +#endif + /* #undef const */ /* Number of chars of output in the buffer of a stdio stream. */ @@ -46,10 +58,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ Look in <sys/time.h> for a timeval structure. */ #define HAVE_TIMEVAL 1 -/* But our select implementation doesn't allow us to make non-blocking - connects. So until that is fixed, this is necessary: */ -#define BROKEN_NON_BLOCKING_CONNECT 1 - /* And the select implementation does 1-byte read-ahead waiting for received packets, so datagrams are broken too. */ #define BROKEN_DATAGRAM_SOCKETS 1 @@ -137,7 +145,7 @@ extern char *getenv (); versions we still support. MinGW64 defines this to a higher value in its system headers, and is not really compatible with values lower than 0x0500, so leave it alone. */ -#ifndef _W64 +#ifndef MINGW_W64 # define _WIN32_WINNT 0x0400 #endif @@ -150,12 +158,13 @@ extern char *getenv (); #define MAXPATHLEN _MAX_PATH #endif +/* This is used to hold UTF-8 encoded file names. */ +#define MAX_UTF8_PATH (MAXPATHLEN * 4) + #ifdef HAVE_NTGUI # ifndef HAVE_WINDOW_SYSTEM # define HAVE_WINDOW_SYSTEM 1 -# endif -# ifndef HAVE_MENUS -# define HAVE_MENUS 1 +# define POLL_FOR_INPUT 1 # endif #endif @@ -163,7 +172,7 @@ extern char *getenv (); #ifdef emacs -#ifdef _W64 +#ifdef MINGW_W64 /* MinGW64 specific stuff. */ /* Make sure 'struct timespec' and 'struct timezone' are defined. */ #include <sys/types.h> @@ -174,10 +183,24 @@ extern char *getenv (); extern struct tm * sys_localtime (const time_t *); /* MinGW64 uses a 2-argument _setjmp, and setjmp is a macro defined to supply the 2nd arg correctly, so don't use _setjmp directly in that - case. */ + case. */ #undef HAVE__SETJMP #endif +/* The following is needed for recovery from C stack overflows. */ +#include <setjmp.h> +typedef jmp_buf sigjmp_buf; +#ifdef MINGW_W64 +/* Evidently, MinGW64's longjmp crashes when invoked from an exception + handler, see https://sourceforge.net/p/mingw-w64/mailman/message/32421953/. + This seems to be an unsolved problem in the MinGW64 runtime. So we + use the GCC intrinsics instead. FIXME. */ +#define sigsetjmp(j,m) __builtin_setjmp(j) +#else +#define sigsetjmp(j,m) setjmp(j) +#endif +extern void w32_reset_stack_overflow_guard (void); + #ifdef _MSC_VER #include <sys/timeb.h> #include <sys/stat.h> @@ -219,12 +242,23 @@ extern struct tm * sys_localtime (const time_t *); #define strerror sys_strerror #undef unlink #define unlink sys_unlink +#undef opendir +#define opendir sys_opendir +#undef closedir +#define closedir sys_closedir +#undef readdir +#define readdir sys_readdir +#undef seekdir +#define seekdir sys_seekdir /* This prototype is needed because some files include config.h _after_ the standard headers, so sys_unlink gets no prototype from stdio.h or io.h. */ extern int sys_unlink (const char *); #undef write #define write sys_write +#undef umask +#define umask sys_umask +extern int sys_umask (int); /* Subprocess calls that are emulated. */ #define spawnve sys_spawnve @@ -263,10 +297,12 @@ typedef int pid_t; #endif #define isatty _isatty #define _longjmp longjmp +/* MinGW64 defines lseek to invoke lseek64. */ +#ifndef lseek #define lseek _lseek +#endif #define popen _popen #define pclose _pclose -#define umask _umask #define strdup _strdup #define strupr _strupr #define strnicmp _strnicmp @@ -284,18 +320,6 @@ int _getpid (void); #include <time.h> #define tzname _tzname -/* 'struct timespec' is used by time-related functions in lib/ and - elsewhere, but we don't use lib/time.h where the structure is - defined. */ -/* MinGW64 defines 'struct timespec' and _TIMESPEC_DEFINED in sys/types.h. */ -#ifndef _TIMESPEC_DEFINED -struct timespec -{ - time_t tv_sec; /* seconds */ - long int tv_nsec; /* nanoseconds */ -}; -#endif - /* Required for functions in lib/time_r.c, since we don't use lib/time.h. */ extern struct tm *gmtime_r (time_t const * restrict, struct tm * restrict); extern struct tm *localtime_r (time_t const * restrict, struct tm * restrict); @@ -353,7 +377,7 @@ typedef int sigset_t; typedef int ssize_t; #endif -#ifdef _W64 /* MinGW64 */ +#ifdef MINGW_W64 #ifndef _POSIX typedef _sigset_t sigset_t; #endif @@ -376,13 +400,18 @@ extern int sigemptyset (sigset_t *); extern int sigaddset (sigset_t *, int); extern int sigfillset (sigset_t *); extern int sigprocmask (int, const sigset_t *, sigset_t *); +/* MinGW64 defines pthread_sigmask as zero in its pthread_signal.h + header, but we have an implementation for that function in w32proc.c. */ +#ifdef pthread_sigmask +#undef pthread_sigmask +#endif extern int pthread_sigmask (int, const sigset_t *, sigset_t *); extern int sigismember (const sigset_t *, int); extern int setpgrp (int, int); extern int sigaction (int, const struct sigaction *, struct sigaction *); extern int alarm (int); -extern int sys_kill (int, int); +extern int sys_kill (pid_t, int); /* For integration with MSDOS support. */ @@ -407,20 +436,36 @@ extern char *get_emacs_configuration_options (void); #define _WINSOCK_H /* Defines size_t and alloca (). */ -#ifdef emacs -#define malloc e_malloc -#define free e_free -#define realloc e_realloc -#define calloc e_calloc -#endif +#include <stdlib.h> +#include <sys/stat.h> #ifdef _MSC_VER #define alloca _alloca #else #include <malloc.h> #endif -#include <stdlib.h> -#include <sys/stat.h> +#ifdef emacs + +typedef void * (* malloc_fn)(size_t); +typedef void * (* realloc_fn)(void *, size_t); +typedef void (* free_fn)(void *); + +extern void *malloc_before_dump(size_t); +extern void *realloc_before_dump(void *, size_t); +extern void free_before_dump(void *); +extern void *malloc_after_dump(size_t); +extern void *realloc_after_dump(void *, size_t); +extern void free_after_dump(void *); + +extern malloc_fn the_malloc_fn; +extern realloc_fn the_realloc_fn; +extern free_fn the_free_fn; + +#define malloc(size) (*the_malloc_fn)(size) +#define free(ptr) (*the_free_fn)(ptr) +#define realloc(ptr, size) (*the_realloc_fn)(ptr, size) + +#endif /* Define for those source files that do not include enough NT system files. */ #ifndef NULL @@ -550,5 +595,7 @@ extern void _DebPrint (const char *fmt, ...); #endif #endif +/* Event name for when emacsclient starts the Emacs daemon on Windows. */ +#define W32_DAEMON_EVENT "EmacsServerEvent" /* ============================================================ */ diff --git a/nt/inc/nl_types.h b/nt/inc/nl_types.h index e3eb9eb5477..86772b6d8dd 100644 --- a/nt/inc/nl_types.h +++ b/nt/inc/nl_types.h @@ -1,6 +1,6 @@ /* Replacement nl_types.h file for building GNU Emacs on Windows. -Copyright (C) 2006-2013 Free Software Foundation, Inc. +Copyright (C) 2006-2015 Free Software Foundation, Inc. This file is part of GNU Emacs. diff --git a/nt/inc/stdint.h b/nt/inc/stdint.h index c9548c00e11..43c4be1b5c6 100644 --- a/nt/inc/stdint.h +++ b/nt/inc/stdint.h @@ -1,6 +1,6 @@ /* Replacement stdint.h file for building GNU Emacs on Windows. -Copyright (C) 2011-2013 Free Software Foundation, Inc. +Copyright (C) 2011-2015 Free Software Foundation, Inc. This file is part of GNU Emacs. diff --git a/nt/inc/sys/mman.h b/nt/inc/sys/mman.h new file mode 100644 index 00000000000..6990edcb59b --- /dev/null +++ b/nt/inc/sys/mman.h @@ -0,0 +1,31 @@ +/* + * sys/mman.h + * mman-win32 + */ + +#ifndef _SYS_MMAN_H_ +#define _SYS_MMAN_H_ + +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* We need MAP_ANON in src/buffer.c */ + +#define MAP_FILE 0 +#define MAP_SHARED 1 +#define MAP_PRIVATE 2 +#define MAP_TYPE 0xf +#define MAP_FIXED 0x10 +#define MAP_ANONYMOUS 0x20 +#define MAP_ANON MAP_ANONYMOUS + +#define MAP_FAILED ((void *)-1) + +#ifdef __cplusplus +}; +#endif + +#endif /* _SYS_MMAN_H_ */ diff --git a/nt/inc/sys/socket.h b/nt/inc/sys/socket.h index 02a0584820f..6ad121699c5 100644 --- a/nt/inc/sys/socket.h +++ b/nt/inc/sys/socket.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 2001-2013 Free Software Foundation, Inc. +/* Copyright (C) 1995, 2001-2015 Free Software Foundation, Inc. This file is part of GNU Emacs. diff --git a/nt/inc/sys/stat.h b/nt/inc/sys/stat.h index f1d8341141e..9b493539450 100644 --- a/nt/inc/sys/stat.h +++ b/nt/inc/sys/stat.h @@ -1,7 +1,7 @@ /* sys/stat.h supplied with MSVCRT uses too narrow data types for inode and user/group id, so we replace them with our own. -Copyright (C) 2008-2013 Free Software Foundation, Inc. +Copyright (C) 2008-2015 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -141,6 +141,13 @@ extern int w32_stat_get_owner_group; /* Prevent redefinition by other headers, e.g. wchar.h. */ #define _STAT_DEFINED +/* This prevents definition in MinGW's wchar.h of inline functions + that use struct _stat64i32 etc., which we don't define and don't + support in our implementation of 'stat' and 'fstat'. If we don't + prevent definition of those inline functions, any program (e.g., + test programs run by configure) that includes both wchar.h and + sys/stat.h will fail to compile. */ +#define _WSTAT_DEFINED int __cdecl __MINGW_NOTHROW fstat (int, struct stat*); int __cdecl __MINGW_NOTHROW stat (const char*, struct stat*); diff --git a/nt/inc/sys/wait.h b/nt/inc/sys/wait.h index d192453ff57..8f9628f1553 100644 --- a/nt/inc/sys/wait.h +++ b/nt/inc/sys/wait.h @@ -1,6 +1,6 @@ /* A limited emulation of sys/wait.h on Posix systems. -Copyright (C) 2012-2013 Free Software Foundation, Inc. +Copyright (C) 2012-2015 Free Software Foundation, Inc. This file is part of GNU Emacs. |