bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH 10/11] unistd: better 'inline'


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

* lib/unistd.c: New file.
* lib/unistd.in.h (_GL_UNISTD_INLINE):
New macro.  Replace all uses of 'static inline' with it.
Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
* m4/unistd_h.m4 (gl_UNISTD_H): Do not require AC_C_INLINE.
* modules/unistd (Files, lib_SOURCES): Add lib/unistd.c.
(Depends-on): Add extern-inline.
---
 ChangeLog       |  9 +++++++++
 lib/unistd.c    |  3 +++
 lib/unistd.in.h | 10 ++++++++--
 m4/unistd_h.m4  |  3 +--
 modules/unistd  |  3 +++
 5 files changed, 24 insertions(+), 4 deletions(-)
 create mode 100644 lib/unistd.c

diff --git a/ChangeLog b/ChangeLog
index b051eab..9e3a90c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2012-10-28  Paul Eggert  <address@hidden>
 
+       unistd: better 'inline'
+       * lib/unistd.c: New file.
+       * lib/unistd.in.h (_GL_UNISTD_INLINE):
+       New macro.  Replace all uses of 'static inline' with it.
+       Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
+       * m4/unistd_h.m4 (gl_UNISTD_H): Do not require AC_C_INLINE.
+       * modules/unistd (Files, lib_SOURCES): Add lib/unistd.c.
+       (Depends-on): Add extern-inline.
+
        sys_socket: better 'inline'
        * lib/sys_socket.c: New file.
        * lib/sys_socket.in.h (_GL_SYS_SOCKET_INLINE):
diff --git a/lib/unistd.c b/lib/unistd.c
new file mode 100644
index 0000000..6c6a8e2
--- /dev/null
+++ b/lib/unistd.c
@@ -0,0 +1,3 @@
+#include <config.h>
+#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE
+#include "unistd.h"
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 450d0be..317c9b7 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -127,6 +127,11 @@
 # include <getopt.h>
 #endif
 
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_UNISTD_INLINE
+# define _GL_UNISTD_INLINE _GL_INLINE
+#endif
+
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
 /* The definition of _GL_ARG_NONNULL is copied here.  */
@@ -404,7 +409,7 @@ extern char **environ;
 # endif
 #elif defined GNULIB_POSIXCHECK
 # if HAVE_RAW_DECL_ENVIRON
-static inline char ***
+_GL_UNISTD_INLINE char ***
 rpl_environ (void)
 {
   return &environ;
@@ -862,7 +867,7 @@ _GL_CXXALIAS_RPL (getpagesize, int, (void));
 #     define getpagesize() _gl_getpagesize ()
 #    else
 #     if !GNULIB_defined_getpagesize_function
-static inline int
+_GL_UNISTD_INLINE int
 getpagesize ()
 {
   return _gl_getpagesize ();
@@ -1530,6 +1535,7 @@ _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const 
void *buf, size_t count));
 _GL_CXXALIASWARN (write);
 #endif
 
+_GL_INLINE_HEADER_END
 
 #endif /* address@hidden@_UNISTD_H */
 #endif /* address@hidden@_UNISTD_H */
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index 7e7651b..f68fbff 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 65
+# unistd_h.m4 serial 66
 dnl Copyright (C) 2006-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,
@@ -11,7 +11,6 @@ AC_DEFUN([gl_UNISTD_H],
   dnl Use AC_REQUIRE here, so that the default behavior below is expanded
   dnl once only, before all statements that occur in other macros.
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  AC_REQUIRE([AC_C_INLINE])
 
   gl_CHECK_NEXT_HEADERS([unistd.h])
   if test $ac_cv_header_unistd_h = yes; then
diff --git a/modules/unistd b/modules/unistd
index 7911506..c887d4f 100644
--- a/modules/unistd
+++ b/modules/unistd
@@ -3,10 +3,12 @@ A GNU-like <unistd.h>.
 
 Files:
 m4/unistd_h.m4
+lib/unistd.c
 lib/unistd.in.h
 m4/off_t.m4
 
 Depends-on:
+extern-inline
 include_next
 snippet/arg-nonnull
 snippet/c++defs
@@ -20,6 +22,7 @@ gl_UNISTD_H
 
 Makefile.am:
 BUILT_SOURCES += unistd.h
+lib_SOURCES += unistd.c
 
 # We need the following in order to create an empty placeholder for
 # <unistd.h> when the system doesn't have one.
-- 
1.7.11.7




reply via email to

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