Eli Zaretskii wrote: > > If you want stdio-consolesafe.c to be compiled although you don't import > > the 'stdio-h' module, you can do so by creating a module 'stdio-h-emacs' > > that includes just the appropriate definitions for this one source file. > > See > > https://www.gnu.org/software/gnulib/manual/html_node/Extending-Gnulib.html > > for this approach. > > I guess it's up to Paul, then: if he can afford creating such a module > and import it, I can work on integrating it with Emacs and its > auxiliary programs. Failing that, I guess we will steal the code from > stdio-consolesafe.c into the Emacs sources to do the same without > compiling the Gnulib file itself.
Duplicating the code should only be the last resort. I'm creating an auxiliary module 'stdio-windows' that you can use without the 'stdio-h' module. That should make it easier for Paul to implement the right things on the Emacs side. > > > There was one problem in this Gnulib merge which broke the MinGW build > > > of Emacs, and that's the change in acl_entries.c. Evidently, no one > > > envisioned that this file will be compiled in MinGW builds, but in > > > Emacs it is compiled > > > > Thanks for the report. Should be fixed by the patch below. > > Thanks. As I wrote earlier, I've arranged not to compile > acl_entries.c in the MinGW build, but it's good to know acl_entries.c > will again compile to a no-op on MS-Windows. The compilation error can occur on other platforms as well. Your workaround fixes it only for mingw. Therefore it will be good if Paul can run 'merge-gnulib' again soon. Bruno
>From 46bbad11b2785240c0e0b26050f84138897154eb Mon Sep 17 00:00:00 2001 From: Bruno Haible <[email protected]> Date: Thu, 6 Nov 2025 11:28:43 +0100 Subject: [PATCH] stdio-windows: New module. * modules/stdio-windows: New file, based on modules/stdio-h. * modules/stdio-h: Simplify accordingly. (Depends-on): Add stdio-windows. --- ChangeLog | 7 +++++++ modules/stdio-h | 19 +------------------ modules/stdio-windows | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 18 deletions(-) create mode 100644 modules/stdio-windows diff --git a/ChangeLog b/ChangeLog index 2e888bdab1..ab93d83349 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2025-11-06 Bruno Haible <[email protected]> + + stdio-windows: New module. + * modules/stdio-windows: New file, based on modules/stdio-h. + * modules/stdio-h: Simplify accordingly. + (Depends-on): Add stdio-windows. + 2025-11-05 Bruno Haible <[email protected]> acl-permissions: Don't use AC_REPLACE_FUNCS. diff --git a/modules/stdio-h b/modules/stdio-h index 619d868430..51940a8a8d 100644 --- a/modules/stdio-h +++ b/modules/stdio-h @@ -3,7 +3,6 @@ A GNU-like <stdio.h>. Files: lib/stdio.in.h -lib/stdio-consolesafe.c lib/stdio-read.c lib/stdio-write.c m4/stdio_h.m4 @@ -19,8 +18,7 @@ snippet/warn-on-use ssize_t stddef-h sys_types-h -stdckdint-h -fseterr +stdio-windows configure.ac-early: gl_STDIO_H_EARLY @@ -29,18 +27,6 @@ configure.ac: gl_STDIO_H gl_STDIO_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P -USES_MSVCRT=0 -case "$host_os" in - mingw* | windows*) - AC_EGREP_CPP([Special], [ -#ifndef _UCRT - Special -#endif - ], - [USES_MSVCRT=1]) - ;; -esac -gl_CONDITIONAL([GL_COND_OBJ_STDIO_CONSOLESAFE], [test $USES_MSVCRT = 1]) gl_CONDITIONAL([GL_COND_OBJ_STDIO_READ], [test $REPLACE_STDIO_READ_FUNCS = 1]) gl_CONDITIONAL([GL_COND_OBJ_STDIO_WRITE], [test $REPLACE_STDIO_WRITE_FUNCS = 1]) @@ -219,9 +205,6 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(AM_V_at)mv $@-t3 $@ MOSTLYCLEANFILES += stdio.h stdio.h-t1 stdio.h-t2 stdio.h-t3 -if GL_COND_OBJ_STDIO_CONSOLESAFE -lib_SOURCES += stdio-consolesafe.c -endif if GL_COND_OBJ_STDIO_READ lib_SOURCES += stdio-read.c endif diff --git a/modules/stdio-windows b/modules/stdio-windows new file mode 100644 index 0000000000..d9489e3e7c --- /dev/null +++ b/modules/stdio-windows @@ -0,0 +1,39 @@ +Description: +Auxiliary module for stdio.h on native Windows. + +Files: +lib/stdio-consolesafe.c + +Depends-on: +stdio-h +stdckdint-h +fseterr + +configure.ac: +AC_REQUIRE([AC_CANONICAL_HOST]) +USES_MSVCRT=0 +case "$host_os" in + mingw* | windows*) + AC_EGREP_CPP([Special], [ +#ifndef _UCRT + Special +#endif + ], + [USES_MSVCRT=1]) + ;; +esac +gl_CONDITIONAL([GL_COND_OBJ_STDIO_CONSOLESAFE], [test $USES_MSVCRT = 1]) + +Makefile.am: +if GL_COND_OBJ_STDIO_CONSOLESAFE +lib_SOURCES += stdio-consolesafe.c +endif + +Include: +<stdio.h> + +License: +LGPLv2+ + +Maintainer: +all -- 2.51.0
