diff options
| author | Eli Zaretskii | 2013-03-25 15:48:37 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2013-03-25 15:48:37 +0200 |
| commit | 553fabe73ac34fa9f24daa48201923af04da7d88 (patch) | |
| tree | 3312d7746fd2871c84ccfe09ae25d3b28cf2f0fe | |
| parent | b234d92c0695c4f500a4a14496008f377de76f3e (diff) | |
| download | emacs-553fabe73ac34fa9f24daa48201923af04da7d88.tar.gz emacs-553fabe73ac34fa9f24daa48201923af04da7d88.zip | |
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.
| -rw-r--r-- | nt/ChangeLog | 15 | ||||
| -rw-r--r-- | nt/inc/ms-w32.h | 23 | ||||
| -rw-r--r-- | nt/inc/sys/time.h | 3 |
3 files changed, 34 insertions, 7 deletions
diff --git a/nt/ChangeLog b/nt/ChangeLog index 7eb928b203b..20579d36c79 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog | |||
| @@ -1,3 +1,18 @@ | |||
| 1 | 2013-03-25 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | Fix incompatibilities between MinGW.org and MinGW64 headers | ||
| 4 | reported by Óscar Fuentes in | ||
| 5 | http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00611.html. | ||
| 6 | * inc/ms-w32.h (struct timespec): Don't define if | ||
| 7 | _TIMESPEC_DEFINED is already defined. | ||
| 8 | (sigset_t) [!_POSIX]: Typedef for MinGW64. | ||
| 9 | (_WIN32_WINNT, WIN32_LEAN_AND_MEAN): Move definitions before | ||
| 10 | including the first system header, to avoid redefinition if some | ||
| 11 | system header defines a default value. | ||
| 12 | |||
| 13 | * inc/sys/time.h (struct itimerval): Don't define if | ||
| 14 | _TIMESPEC_DEFINED is already defined. | ||
| 15 | |||
| 1 | 2013-03-16 Eli Zaretskii <eliz@gnu.org> | 16 | 2013-03-16 Eli Zaretskii <eliz@gnu.org> |
| 2 | 17 | ||
| 3 | Fix the MSVC build. (Bug#13939) | 18 | 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; | |||
| 127 | extern char *getenv (); | 127 | extern char *getenv (); |
| 128 | #endif | 128 | #endif |
| 129 | 129 | ||
| 130 | /* Prevent accidental use of features unavailable in older Windows | ||
| 131 | versions we still support. MinGW64 defines this to a higher value | ||
| 132 | in its system headers, so define our override before including any | ||
| 133 | system headers. */ | ||
| 134 | #define _WIN32_WINNT 0x0400 | ||
| 135 | |||
| 136 | /* Make a leaner executable. */ | ||
| 137 | #define WIN32_LEAN_AND_MEAN 1 | ||
| 138 | |||
| 130 | #ifdef HAVE_STRINGS_H | 139 | #ifdef HAVE_STRINGS_H |
| 131 | #include "strings.h" | 140 | #include "strings.h" |
| 132 | #endif | 141 | #endif |
| @@ -266,11 +275,14 @@ int _getpid (void); | |||
| 266 | /* 'struct timespec' is used by time-related functions in lib/ and | 275 | /* 'struct timespec' is used by time-related functions in lib/ and |
| 267 | elsewhere, but we don't use lib/time.h where the structure is | 276 | elsewhere, but we don't use lib/time.h where the structure is |
| 268 | defined. */ | 277 | defined. */ |
| 278 | /* MinGW64 defines 'struct timespec' and _TIMESPEC_DEFINED in sys/types.h. */ | ||
| 279 | #ifndef _TIMESPEC_DEFINED | ||
| 269 | struct timespec | 280 | struct timespec |
| 270 | { | 281 | { |
| 271 | time_t tv_sec; /* seconds */ | 282 | time_t tv_sec; /* seconds */ |
| 272 | long int tv_nsec; /* nanoseconds */ | 283 | long int tv_nsec; /* nanoseconds */ |
| 273 | }; | 284 | }; |
| 285 | #endif | ||
| 274 | 286 | ||
| 275 | /* Required for functions in lib/time_r.c, since we don't use lib/time.h. */ | 287 | /* Required for functions in lib/time_r.c, since we don't use lib/time.h. */ |
| 276 | extern struct tm *gmtime_r (time_t const * restrict, struct tm * restrict); | 288 | extern struct tm *gmtime_r (time_t const * restrict, struct tm * restrict); |
| @@ -321,6 +333,10 @@ typedef int sigset_t; | |||
| 321 | typedef int ssize_t; | 333 | typedef int ssize_t; |
| 322 | #endif | 334 | #endif |
| 323 | 335 | ||
| 336 | #ifndef _POSIX /* MinGW64 */ | ||
| 337 | typedef _sigset_t sigset_t; | ||
| 338 | #endif | ||
| 339 | |||
| 324 | typedef void (_CALLBACK_ *signal_handler) (int); | 340 | typedef void (_CALLBACK_ *signal_handler) (int); |
| 325 | extern signal_handler sys_signal (int, signal_handler); | 341 | extern signal_handler sys_signal (int, signal_handler); |
| 326 | 342 | ||
| @@ -366,13 +382,6 @@ extern char *get_emacs_configuration_options (void); | |||
| 366 | #define _WINSOCKAPI_ 1 | 382 | #define _WINSOCKAPI_ 1 |
| 367 | #define _WINSOCK_H | 383 | #define _WINSOCK_H |
| 368 | 384 | ||
| 369 | /* Prevent accidental use of features unavailable in | ||
| 370 | older Windows versions we still support. */ | ||
| 371 | #define _WIN32_WINNT 0x0400 | ||
| 372 | |||
| 373 | /* Make a leaner executable. */ | ||
| 374 | #define WIN32_LEAN_AND_MEAN 1 | ||
| 375 | |||
| 376 | /* Defines size_t and alloca (). */ | 385 | /* Defines size_t and alloca (). */ |
| 377 | #ifdef emacs | 386 | #ifdef emacs |
| 378 | #define malloc e_malloc | 387 | #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 *); | |||
| 23 | #define ITIMER_REAL 0 | 23 | #define ITIMER_REAL 0 |
| 24 | #define ITIMER_PROF 1 | 24 | #define ITIMER_PROF 1 |
| 25 | 25 | ||
| 26 | /* MinGW64 defines 'struct itimerval' and _TIMESPEC_DEFINED in sys/types.h. */ | ||
| 27 | #ifndef _TIMESPEC_DEFINED | ||
| 26 | struct itimerval | 28 | struct itimerval |
| 27 | { | 29 | { |
| 28 | struct timeval it_interval; /* timer interval */ | 30 | struct timeval it_interval; /* timer interval */ |
| 29 | struct timeval it_value; /* current value */ | 31 | struct timeval it_value; /* current value */ |
| 30 | }; | 32 | }; |
| 33 | #endif | ||
| 31 | 34 | ||
| 32 | int getitimer (int, struct itimerval *); | 35 | int getitimer (int, struct itimerval *); |
| 33 | int setitimer (int, struct itimerval *, struct itimerval *); | 36 | int setitimer (int, struct itimerval *, struct itimerval *); |