# HG changeset patch # User Paul Eggert # Date 1353479107 28800 # Node ID 263910906d80d9f9095705111cb984f0b0678fbb # Parent 69d9b9c9323273e4b132e88b43a9d1c0af09cd18 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. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2012-11-29 Paul Eggert + 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 --- /dev/null +++ b/lib/unistd.c @@ -0,0 +1,3 @@ +#include +#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE +#include "unistd.h" diff --git a/lib/unistd.in.h b/lib/unistd.in.h --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -127,6 +127,11 @@ # include #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 */ diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 --- 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 diff --git a/modules/unistd b/modules/unistd --- 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 # when the system doesn't have one.