Fix MS-Windows build broken by recent updates in MinGW64 headers

* nt/inc/ms-w32.h (strerror): Redirect to sys_strerror after
including <string.h>, to prevent the linker from thinking it
should be imported from some DLL.  Reported by Richard Copley
<rcopley@gmail.com>.

* src/w32.c: Remove now unneeded prototype of sys_strerror.
This commit is contained in:
Eli Zaretskii 2026-01-22 19:36:54 +02:00
parent 5290b5dddb
commit 7b9d3e90ce
2 changed files with 7 additions and 5 deletions

View file

@ -227,7 +227,6 @@ extern void w32_reset_stack_overflow_guard (void);
#define select sys_select #define select sys_select
#define pselect sys_select #define pselect sys_select
#define sleep sys_sleep #define sleep sys_sleep
#define strerror sys_strerror
#undef unlink #undef unlink
#define unlink sys_unlink #define unlink sys_unlink
#undef opendir #undef opendir
@ -268,6 +267,13 @@ extern int sys_umask (int);
#define cmputc sys_cmputc #define cmputc sys_cmputc
#define Wcm_clear sys_Wcm_clear #define Wcm_clear sys_Wcm_clear
/* MinGW64 system headers include string.h too early, causing the
compiler to emit a warning about sys_strerror having no
prototype, or the linker fail to link. */
#include <string.h>
#define strerror sys_strerror
char *sys_strerror (int);
#endif /* emacs */ #endif /* emacs */
/* Used both in Emacs, in lib-src, and in Gnulib. */ /* Used both in Emacs, in lib-src, and in Gnulib. */

View file

@ -84,10 +84,6 @@ int sys_dup2 (int, int);
int sys_read (int, char *, unsigned int); int sys_read (int, char *, unsigned int);
int sys_write (int, const void *, unsigned int); int sys_write (int, const void *, unsigned int);
struct tm *sys_localtime (const time_t *); struct tm *sys_localtime (const time_t *);
/* MinGW64 system headers include string.h too early, causing the
compiler to emit a warning about sys_strerror having no
prototype. */
char *sys_strerror (int);
clock_t sys_clock (void); clock_t sys_clock (void);
#ifdef HAVE_MODULES #ifdef HAVE_MODULES