1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00

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.
This commit is contained in:
Eli Zaretskii 2013-03-25 15:48:37 +02:00
parent b234d92c06
commit 553fabe73a
3 changed files with 34 additions and 7 deletions

View File

@ -1,3 +1,18 @@
2013-03-25 Eli Zaretskii <eliz@gnu.org>
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 <eliz@gnu.org>
Fix the MSVC build. (Bug#13939)

View File

@ -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

View File

@ -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 *);