From: Eli Zaretskii Date: Mon, 25 Mar 2013 13:48:37 +0000 (+0200) Subject: Fix incompatibilities between MinGW.org and MinGW64 headers X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~526^2~97 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=553fabe73ac34fa9f24daa48201923af04da7d88;p=emacs.git Fix incompatibilities between MinGW.org and MinGW64 headers Problems were reported by ׃scar Fuentes in http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00611.html. nt/inc/ms-w32.h (struct timespec): Don't define if _TIMESPEC_DEFINED is already defined. (sigset_t) [!_POSIX]: Typedef for MinGW64. (_WIN32_WINNT, WIN32_LEAN_AND_MEAN): Move definitions before including the first system header, to avoid redefinition if some system header defines a default value. nt/inc/sys/time.h (struct itimerval): Don't define if _TIMESPEC_DEFINED is already defined. --- diff --git a/nt/ChangeLog b/nt/ChangeLog index 7eb928b203b..20579d36c79 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,18 @@ +2013-03-25 Eli Zaretskii + + Fix incompatibilities between MinGW.org and MinGW64 headers + reported by Óscar Fuentes in + http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00611.html. + * inc/ms-w32.h (struct timespec): Don't define if + _TIMESPEC_DEFINED is already defined. + (sigset_t) [!_POSIX]: Typedef for MinGW64. + (_WIN32_WINNT, WIN32_LEAN_AND_MEAN): Move definitions before + including the first system header, to avoid redefinition if some + system header defines a default value. + + * inc/sys/time.h (struct itimerval): Don't define if + _TIMESPEC_DEFINED is already defined. + 2013-03-16 Eli Zaretskii Fix the MSVC build. (Bug#13939) diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index 12402390895..d3faa6d2b2f 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h @@ -127,6 +127,15 @@ typedef unsigned short mode_t; extern char *getenv (); #endif +/* Prevent accidental use of features unavailable in older Windows + versions we still support. MinGW64 defines this to a higher value + in its system headers, so define our override before including any + system headers. */ +#define _WIN32_WINNT 0x0400 + +/* Make a leaner executable. */ +#define WIN32_LEAN_AND_MEAN 1 + #ifdef HAVE_STRINGS_H #include "strings.h" #endif @@ -266,11 +275,14 @@ int _getpid (void); /* '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); @@ -321,6 +333,10 @@ typedef int sigset_t; typedef int ssize_t; #endif +#ifndef _POSIX /* MinGW64 */ +typedef _sigset_t sigset_t; +#endif + typedef void (_CALLBACK_ *signal_handler) (int); extern signal_handler sys_signal (int, signal_handler); @@ -366,13 +382,6 @@ extern char *get_emacs_configuration_options (void); #define _WINSOCKAPI_ 1 #define _WINSOCK_H -/* Prevent accidental use of features unavailable in - older Windows versions we still support. */ -#define _WIN32_WINNT 0x0400 - -/* Make a leaner executable. */ -#define WIN32_LEAN_AND_MEAN 1 - /* Defines size_t and alloca (). */ #ifdef emacs #define malloc e_malloc diff --git a/nt/inc/sys/time.h b/nt/inc/sys/time.h index c12c194fd2a..e49f0ea4de3 100644 --- a/nt/inc/sys/time.h +++ b/nt/inc/sys/time.h @@ -23,11 +23,14 @@ 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 *);