From 0026445dd6f4fb0dad763a1bead0d23c8d27137e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 18 Nov 2025 16:19:20 +0200 Subject: [PATCH] Fix MinGW build broken by integration of 'stdio-consolesafe' * src/conf_post.h: Avoid redirecting '*printf' functions if 'OMIT_CONSOLESAFE' is defined to 1. * nt/cmdproxy.c: * nt/ddeclient.c: Define 'OMIT_CONSOLESAFE' to 1 to avoid redirecting '*printf functions' to stdio-consolesafe replacements. * nt/Makefile.in (LIBS_ADDPM): Add -lgnu to link 'addpm' against Gnulib. (Bug#79855) --- nt/Makefile.in | 2 +- nt/cmdproxy.c | 4 ++++ nt/ddeclient.c | 3 +++ src/conf_post.h | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/nt/Makefile.in b/nt/Makefile.in index f9662183065..71d590b2c15 100644 --- a/nt/Makefile.in +++ b/nt/Makefile.in @@ -139,7 +139,7 @@ EMACS_MANIFEST = @EMACS_MANIFEST@ WINDRES = @WINDRES@ ## Extra libraries to use when linking addpm. -LIBS_ADDPM = -lole32 -luuid +LIBS_ADDPM = -L../lib -lgnu -lole32 -luuid ## Compilation and linking flags BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ diff --git a/nt/cmdproxy.c b/nt/cmdproxy.c index 8f4333e6139..8b2f18feade 100644 --- a/nt/cmdproxy.c +++ b/nt/cmdproxy.c @@ -28,6 +28,10 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ #define DEFER_MS_W32_H +/* We don't want to use the stdio-consolesafe redefinitions of *printf + functions, since (a) that pulls in stdio, which we don't want, see + below; and (b) we have our own implementations of *printf here. */ +#define OMIT_CONSOLESAFE 1 #include #include diff --git a/nt/ddeclient.c b/nt/ddeclient.c index 11dcfb5a3c5..52cfbde21eb 100644 --- a/nt/ddeclient.c +++ b/nt/ddeclient.c @@ -17,6 +17,9 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ #define DEFER_MS_W32_H +/* We only ever use fprintf for a fixed usage message below, so the + stdio-consolesafe module is overkill. */ +#define OMIT_CONSOLESAFE 1 #include #include diff --git a/src/conf_post.h b/src/conf_post.h index e946f6fc90b..99400d76210 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -397,7 +397,7 @@ extern int emacs_setenv_TZ (char const *); : S_ISSOCK (mode) ? DT_SOCK : DT_UNKNOWN) #endif /* MSDOS */ -#if defined WINDOWSNT +#if defined WINDOWSNT && !(defined OMIT_CONSOLESAFE && OMIT_CONSOLESAFE == 1) # if !defined _UCRT # include # include