From 6e8bae1bf3ce6a05569ecab0a0e3ae72557bf637 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 24 Dec 2024 11:19:49 +0100 Subject: [PATCH] stdio: Support several gnulib-tool invocations better. * lib/stdio.in.h: Test _GL_SKIP_GNULIB_STDIO_H. (_GL_ALREADY_INCLUDING_STDIO_H): Rename to a macro that depends on GUARD_PREFIX. * lib/fopen.c: Set _GL_SKIP_GNULIB_STDIO_H instead of _GL_ALREADY_INCLUDING_STDIO_H. * lib/freopen.c: Likewise. --- ChangeLog | 10 ++++++++++ lib/fopen.c | 4 ++-- lib/freopen.c | 4 ++-- lib/stdio.in.h | 6 +++--- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 35c4132c89..494ed029d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2024-12-24 Bruno Haible + + stdio: Support several gnulib-tool invocations better. + * lib/stdio.in.h: Test _GL_SKIP_GNULIB_STDIO_H. + (_GL_ALREADY_INCLUDING_STDIO_H): Rename to a macro that depends on + GUARD_PREFIX. + * lib/fopen.c: Set _GL_SKIP_GNULIB_STDIO_H instead of + _GL_ALREADY_INCLUDING_STDIO_H. + * lib/freopen.c: Likewise. + 2024-12-24 Bruno Haible spawn: Support several gnulib-tool invocations better. diff --git a/lib/fopen.c b/lib/fopen.c index d3b57a987a..b9e6e37374 100644 --- a/lib/fopen.c +++ b/lib/fopen.c @@ -19,12 +19,12 @@ /* If the user's config.h happens to include , let it include only the system's here, so that orig_fopen doesn't recurse to rpl_fopen. */ -#define _GL_ALREADY_INCLUDING_STDIO_H +#define _GL_SKIP_GNULIB_STDIO_H #include /* Get the original definition of fopen. It might be defined as a macro. */ #include -#undef _GL_ALREADY_INCLUDING_STDIO_H +#undef _GL_SKIP_GNULIB_STDIO_H static FILE * orig_fopen (const char *filename, const char *mode) diff --git a/lib/freopen.c b/lib/freopen.c index e003c0ba7f..ab4a40dfe0 100644 --- a/lib/freopen.c +++ b/lib/freopen.c @@ -19,12 +19,12 @@ /* If the user's config.h happens to include , let it include only the system's here, so that orig_freopen doesn't recurse to rpl_freopen. */ -#define _GL_ALREADY_INCLUDING_STDIO_H +#define _GL_SKIP_GNULIB_STDIO_H #include /* Get the original definition of freopen. It might be defined as a macro. */ #include -#undef _GL_ALREADY_INCLUDING_STDIO_H +#undef _GL_SKIP_GNULIB_STDIO_H #include diff --git a/lib/stdio.in.h b/lib/stdio.in.h index 2462c29a3e..e5aa5a97ef 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -20,7 +20,7 @@ #endif @PRAGMA_COLUMNS@ -#if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H +#if defined __need_FILE || defined __need___FILE || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_STDIO_H || defined _GL_SKIP_GNULIB_STDIO_H /* Special invocation convention: - Inside glibc header files. - On OSF/1 5.1 we have a sequence of nested includes @@ -48,12 +48,12 @@ # endif #endif -#define _GL_ALREADY_INCLUDING_STDIO_H +#define _@GUARD_PREFIX@_ALREADY_INCLUDING_STDIO_H /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STDIO_H@ -#undef _GL_ALREADY_INCLUDING_STDIO_H +#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_STDIO_H #ifdef _GL_DEFINED__POSIX_C_SOURCE # undef _GL_DEFINED__POSIX_C_SOURCE -- 2.39.5