bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 08/11] stdio: better 'inline'


From: Paul Eggert
Subject: [PATCH 08/11] stdio: better 'inline'
Date: Mon, 29 Oct 2012 00:18:06 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121011 Thunderbird/16.0.1

* 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 c2fda94..c16ad3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2012-10-28  Paul Eggert  <address@hidden>
 
+       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 0000000..e6ed829
--- /dev/null
+++ b/lib/stdio.c
@@ -0,0 +1,3 @@
+#include <config.h>
+#define _GL_STDIO_INLINE _GL_EXTERN_INLINE
+#include "stdio.h"
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index fab325d..473c6ea 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -46,6 +46,11 @@
 #ifndef address@hidden@_STDIO_H
 #define address@hidden@_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 <stdarg.h>
 
@@ -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 /* address@hidden@_STDIO_H */
 #endif /* address@hidden@_STDIO_H */
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index 5298dd6..3bd6580 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 1eec2bf..c33ad31 100644
--- a/modules/stdio
+++ b/modules/stdio
@@ -2,10 +2,12 @@ Description:
 A GNU-like <stdio.h>.
 
 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 <stdio.h> when the system
 # doesn't have one that works with the given compiler.
-- 
1.7.11.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]