From 01d0ac747bd4fb13d03afb06ba25ccf4d4d2d7c6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 20 Nov 2012 22:25:06 -0800 Subject: [PATCH] stdio: better 'inline' * lib/stdio.c: New file. * lib/stdio.in.h (_GL_STDIO_INLINE): New macro. Replace all uses of 'static inline' with it. Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END. * m4/stdio_h.m4 (gl_STDIO_H): Do not require AC_C_INLINE. * modules/stdio (Files, lib_SOURCES): Add lib/stdio.c. (Depends-on): Add extern-inline. --- ChangeLog | 9 +++++++++ lib/stdio.c | 3 +++ lib/stdio.in.h | 8 +++++++- m4/stdio_h.m4 | 3 +-- modules/stdio | 3 +++ 5 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 lib/stdio.c diff --git a/ChangeLog b/ChangeLog index d6de94099..5692442a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2012-11-29 Paul Eggert + stdio: better 'inline' + * lib/stdio.c: New file. + * lib/stdio.in.h (_GL_STDIO_INLINE): + New macro. Replace all uses of 'static inline' with it. + Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END. + * m4/stdio_h.m4 (gl_STDIO_H): Do not require AC_C_INLINE. + * modules/stdio (Files, lib_SOURCES): Add lib/stdio.c. + (Depends-on): Add extern-inline. + sigaction: better 'inline' * lib/sig-handler.c: New file. * lib/sig-handler.h (SIG_HANDLER_INLINE): diff --git a/lib/stdio.c b/lib/stdio.c new file mode 100644 index 000000000..e6ed82996 --- /dev/null +++ b/lib/stdio.c @@ -0,0 +1,3 @@ +#include +#define _GL_STDIO_INLINE _GL_EXTERN_INLINE +#include "stdio.h" diff --git a/lib/stdio.in.h b/lib/stdio.in.h index fab325d32..473c6ea87 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -46,6 +46,11 @@ #ifndef _@GUARD_PREFIX@_STDIO_H #define _@GUARD_PREFIX@_STDIO_H +_GL_INLINE_HEADER_BEGIN +#ifndef _GL_STDIO_INLINE +# define _GL_STDIO_INLINE _GL_INLINE +#endif + /* Get va_list. Needed on many systems, including glibc 2.8. */ #include @@ -581,7 +586,7 @@ _GL_CXXALIAS_SYS (fwrite, size_t, This affects only function declaration attributes, so it's not needed for C++. */ # if !defined __cplusplus && 0 < __USE_FORTIFY_LEVEL -static inline size_t _GL_ARG_NONNULL ((1, 4)) +_GL_STDIO_INLINE size_t _GL_ARG_NONNULL ((1, 4)) rpl_fwrite (const void *ptr, size_t s, size_t n, FILE *stream) { size_t r = fwrite (ptr, s, n, stream); @@ -1333,6 +1338,7 @@ _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - " "POSIX compliance"); #endif +_GL_INLINE_HEADER_END #endif /* _@GUARD_PREFIX@_STDIO_H */ #endif /* _@GUARD_PREFIX@_STDIO_H */ diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 index 5298dd6d9..3bd658036 100644 --- a/m4/stdio_h.m4 +++ b/m4/stdio_h.m4 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 42 +# stdio_h.m4 serial 43 dnl Copyright (C) 2007-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,7 +7,6 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_STDIO_H], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - AC_REQUIRE([AC_C_INLINE]) gl_NEXT_HEADERS([stdio.h]) dnl No need to create extra modules for these functions. Everyone who uses diff --git a/modules/stdio b/modules/stdio index 1eec2bf26..c33ad31d9 100644 --- a/modules/stdio +++ b/modules/stdio @@ -2,10 +2,12 @@ Description: A GNU-like . Files: +lib/stdio.c lib/stdio.in.h m4/stdio_h.m4 Depends-on: +extern-inline include_next snippet/arg-nonnull snippet/c++defs @@ -19,6 +21,7 @@ gl_STDIO_H Makefile.am: BUILT_SOURCES += stdio.h +lib_SOURCES += stdio.c # We need the following in order to create when the system # doesn't have one that works with the given compiler. -- 2.11.0