changeset 17174:263910906d80

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.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 20 Nov 2012 22:25:07 -0800
parents 69d9b9c93232
children 3aff72f6c8ba
files ChangeLog lib/unistd.c lib/unistd.in.h m4/unistd_h.m4 modules/unistd
diffstat 5 files changed, 24 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2012-11-29  Paul Eggert  <eggert@cs.ucla.edu>
 
+	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):
new file mode 100644
--- /dev/null
+++ b/lib/unistd.c
@@ -0,0 +1,3 @@
+#include <config.h>
+#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE
+#include "unistd.h"
--- 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 @@
 # 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 @@
 #     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_CXXALIASWARN (write);
 #endif
 
+_GL_INLINE_HEADER_END
 
 #endif /* _@GUARD_PREFIX@_UNISTD_H */
 #endif /* _@GUARD_PREFIX@_UNISTD_H */
--- 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 @@
   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
--- a/modules/unistd
+++ b/modules/unistd
@@ -3,10 +3,12 @@
 
 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 @@
 
 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.