From: Paul Eggert Date: Wed, 21 Nov 2012 06:25:07 +0000 (-0800) Subject: unistd: better 'inline' X-Git-Tag: v0.1~355 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=108828a0e95d3c4e89ff4f38fe4b39ae6218792e;p=gnulib.git 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 index 1869b71a76..b5e43ab2f9 100644 --- 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 index 0000000000..6c6a8e268c --- /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 index 450d0be9cf..317c9b7db9 100644 --- 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 @@ 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 /* _@GUARD_PREFIX@_UNISTD_H */ #endif /* _@GUARD_PREFIX@_UNISTD_H */ diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index 7e7651b9d2..f68fbff8ce 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 79115063c3..c887d4f16f 100644 --- a/modules/unistd +++ b/modules/unistd @@ -3,10 +3,12 @@ A GNU-like . 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 # when the system doesn't have one.