+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)
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
/* '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);
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);
#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
#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 *);