diff --git a/src/conf_post.h b/src/conf_post.h index a3fcb1f82c5..5b7548f20fa 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -389,10 +389,11 @@ extern int emacs_setenv_TZ (char const *); #endif /* MSDOS */ #if defined WINDOWSNT && !(defined OMIT_CONSOLESAFE && OMIT_CONSOLESAFE == 1) -# if !defined _UCRT -# include +# if !defined _UCRT || !(HAVE_DECL_GETDELIM && HAVE_DECL_GETLINE) # include # include +# if !defined _UCRT +# include /* Workarounds for MSVCRT bugs. @@ -418,20 +419,13 @@ extern int gl_consolesafe_vfprintf (FILE *restrict fp, extern int gl_consolesafe_vprintf (const char *restrict format, va_list args) ATTRIBUTE_FORMAT_PRINTF (1, 0) ARG_NONNULL ((1)); -# define fwrite gl_consolesafe_fwrite -# define fprintf gl_consolesafe_fprintf -# define printf gl_consolesafe_printf -# define vfprintf gl_consolesafe_vfprintf -# define vprintf gl_consolesafe_vprintf -# endif /* !_UCRT */ -#endif /* WINDOWSNT */ +# define fwrite gl_consolesafe_fwrite +# define fprintf gl_consolesafe_fprintf +# define printf gl_consolesafe_printf +# define vfprintf gl_consolesafe_vfprintf +# define vprintf gl_consolesafe_vprintf +# endif /* !_UCRT */ -#ifdef WINDOWSNT -/* MinGW64 doesn't have getdelim, called by Gnulib's getline, but the - MS-Windows build omits stdio.h module, where getdelim is declared. */ -# if !(HAVE_DECL_GETDELIM && HAVE_DECL_GETLINE) -# include -# include # if !HAVE_DECL_GETDELIM extern ssize_t getdelim (char **, size_t *, int, FILE *); # endif @@ -439,4 +433,4 @@ extern ssize_t getdelim (char **, size_t *, int, FILE *); extern ssize_t getline (char **, size_t *, FILE *); # endif # endif -#endif +#endif /* WINDOWSNT */