From cd91fb4b0ae2c05d72adb61bc47c232c2dad015a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Feb 2013 15:59:37 +0200 Subject: [PATCH] Don't use __STDC__ on MS-Windows unless necessary (Bug #9066). nt/inc/ms-w32.h (__STDC__): Fiddle with value only for MSVC. src/w32term.c : Declare 'volatile' unconditionally. --- nt/ChangeLog | 5 +++++ nt/inc/ms-w32.h | 10 +++++++++- src/ChangeLog | 3 +++ src/w32term.c | 4 ---- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/nt/ChangeLog b/nt/ChangeLog index 18911b90fa..81477e801d 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,8 @@ +2013-02-16 Eli Zaretskii + + * inc/ms-w32.h (__STDC__): Fiddle with value only for MSVC. + (Bug#9066) + 2013-02-13 Juanma Barranquero * config.nt: Sync with autogen/config.in. diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index a74c74b454..5c3caeb38c 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h @@ -265,8 +265,11 @@ struct timespec extern struct tm *gmtime_r (time_t const * restrict, struct tm * restrict); extern struct tm *localtime_r (time_t const * restrict, struct tm * restrict); +#ifdef _MSC_VER /* This is hacky, but is necessary to avoid warnings about macro - redefinitions using the SDK compilers. */ + redefinitions using the MSVC compilers, since, when __STDC__ is + undefined or zero, those compilers declare functions like fileno, + lseek, and chdir, for which we defined macros above. */ #ifndef __STDC__ #define __STDC__ 1 #define MUST_UNDEF__STDC__ @@ -278,6 +281,11 @@ extern struct tm *localtime_r (time_t const * restrict, struct tm * restrict); #undef __STDC__ #undef MUST_UNDEF__STDC__ #endif +#else /* !_MSC_VER */ +#include +#include +#include +#endif /* !_MSC_VER */ /* Defines that we need that aren't in the standard signal.h. */ #define SIGHUP 1 /* Hang up */ diff --git a/src/ChangeLog b/src/ChangeLog index d326532ecb..797a02b8f7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2013-02-16 Eli Zaretskii + * w32term.c : Declare 'volatile' + unconditionally. (Bug#9066) + * w32.c (set_errno): Reset h_errno and don't set it to any other value. Set errno instead. (check_errno): Reset h_errno. diff --git a/src/w32term.c b/src/w32term.c index c83ee31d20..170f33ecd6 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -191,11 +191,7 @@ static Time last_mouse_movement_time; /* Incremented by w32_read_socket whenever it really tries to read events. */ -#ifdef __STDC__ static int volatile input_signal_count; -#else -static int input_signal_count; -#endif #ifdef CYGWIN int w32_message_fd = -1; -- 2.20.1