From: Paul Eggert Date: Thu, 30 Aug 2012 04:09:50 +0000 (-0700) Subject: fchmodat, fchownat, fstatat: use extern-inline X-Git-Tag: v0.1~429 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=d202279380436696dc5889edcf07ad92ef59f541;p=gnulib.git fchmodat, fchownat, fstatat: use extern-inline * lib/fchmodat.c, lib/openat.h (FCHMODAT_INLINE): * lib/fchownat.c, lib/openat.h (FCHOWNAT_INLINE): * lib/fstatat.c, lib/openat.h (FSTATAT_INLINE): New macros. * lib/openat.h: Replace all uses of 'static inline' with them. Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END. * modules/fchmodat, modules/fchownat, modules/fstatat: * modules/openat-h: (Depends-on): Add extern-inline. (configure.ac): Remove AC_C_INLINE. --- diff --git a/ChangeLog b/ChangeLog index 4e899d75d1..39e733a8e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2012-09-22 Paul Eggert + fchmodat, fchownat, fstatat: use extern-inline + * lib/fchmodat.c, lib/openat.h (FCHMODAT_INLINE): + * lib/fchownat.c, lib/openat.h (FCHOWNAT_INLINE): + * lib/fstatat.c, lib/openat.h (FSTATAT_INLINE): + New macros. + * lib/openat.h: + Replace all uses of 'static inline' with them. + Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END. + * modules/fchmodat, modules/fchownat, modules/fstatat: + * modules/openat-h: + (Depends-on): + Add extern-inline. + (configure.ac): Remove AC_C_INLINE. + acl, mbchar, priv-set: use extern-inline * lib/set-mode-acl.c, lib/acl-internal.h (ACL_INTERNAL_INLINE): * lib/mbchar.c, lib/mbchar.h (MBCHAR_INLINE): diff --git a/lib/fchmodat.c b/lib/fchmodat.c index ce848fd4ee..b1940d5556 100644 --- a/lib/fchmodat.c +++ b/lib/fchmodat.c @@ -18,6 +18,8 @@ #include +#include FCHMODAT_INLINE _GL_EXTERN_INLINE + #include #include diff --git a/lib/fchownat.c b/lib/fchownat.c index 4f6a44d040..c6e2d56fed 100644 --- a/lib/fchownat.c +++ b/lib/fchownat.c @@ -23,6 +23,8 @@ #include +#include FCHOWNAT_INLINE _GL_EXTERN_INLINE + #include #include diff --git a/lib/fstatat.c b/lib/fstatat.c index 9b701c4d61..ed42fa8345 100644 --- a/lib/fstatat.c +++ b/lib/fstatat.c @@ -23,13 +23,15 @@ #define __need_system_sys_stat_h #include +#include FSTATAT_INLINE _GL_EXTERN_INLINE + /* Get the original definition of fstatat. It might be defined as a macro. */ #include #include #undef __need_system_sys_stat_h #if HAVE_FSTATAT -static inline int +static int orig_fstatat (int fd, char const *filename, struct stat *buf, int flags) { return fstatat (fd, filename, buf, flags); @@ -97,7 +99,7 @@ rpl_fstatat (int fd, char const *file, struct stat *st, int flag) because the preprocessor sees a use of a macro that requires two arguments but is only given one. Hence, we need an inline forwarder to get past the preprocessor. */ -static inline int +static int stat_func (char const *name, struct stat *st) { return stat (name, st); diff --git a/lib/openat.h b/lib/openat.h index d646250bb3..0f542c6ef4 100644 --- a/lib/openat.h +++ b/lib/openat.h @@ -26,6 +26,8 @@ #include #include +_GL_INLINE_HEADER_BEGIN + #if !HAVE_OPENAT int openat_permissive (int fd, char const *file, int flags, mode_t mode, @@ -49,13 +51,17 @@ _Noreturn void openat_save_fail (int); #if GNULIB_FCHOWNAT -static inline int +# ifndef FCHOWNAT_INLINE +# define FCHOWNAT_INLINE _GL_INLINE +# endif + +FCHOWNAT_INLINE int chownat (int fd, char const *file, uid_t owner, gid_t group) { return fchownat (fd, file, owner, group, 0); } -static inline int +FCHOWNAT_INLINE int lchownat (int fd, char const *file, uid_t owner, gid_t group) { return fchownat (fd, file, owner, group, AT_SYMLINK_NOFOLLOW); @@ -65,13 +71,17 @@ lchownat (int fd, char const *file, uid_t owner, gid_t group) #if GNULIB_FCHMODAT -static inline int +# ifndef FCHMODAT_INLINE +# define FCHMODAT_INLINE _GL_INLINE +# endif + +FCHMODAT_INLINE int chmodat (int fd, char const *file, mode_t mode) { return fchmodat (fd, file, mode, 0); } -static inline int +FCHMODAT_INLINE int lchmodat (int fd, char const *file, mode_t mode) { return fchmodat (fd, file, mode, AT_SYMLINK_NOFOLLOW); @@ -81,13 +91,17 @@ lchmodat (int fd, char const *file, mode_t mode) #if GNULIB_FSTATAT -static inline int +# ifndef FSTATAT_INLINE +# define FSTATAT_INLINE _GL_INLINE +# endif + +FSTATAT_INLINE int statat (int fd, char const *name, struct stat *st) { return fstatat (fd, name, st, 0); } -static inline int +FSTATAT_INLINE int lstatat (int fd, char const *name, struct stat *st) { return fstatat (fd, name, st, AT_SYMLINK_NOFOLLOW); @@ -101,4 +115,6 @@ lstatat (int fd, char const *name, struct stat *st) wrappers are not provided for accessat or euidaccessat, so as to avoid dragging in -lgen on some platforms. */ +_GL_INLINE_HEADER_END + #endif /* _GL_HEADER_OPENAT */ diff --git a/modules/fchmodat b/modules/fchmodat index f81dd81624..94fad771a3 100644 --- a/modules/fchmodat +++ b/modules/fchmodat @@ -13,6 +13,7 @@ extensions at-internal [test $HAVE_FCHMODAT = 0] dosname [test $HAVE_FCHMODAT = 0] errno [test $HAVE_FCHMODAT = 0] +extern-inline [test $HAVE_FCHMODAT = 0] fchdir [test $HAVE_FCHMODAT = 0] fcntl-h [test $HAVE_FCHMODAT = 0] openat-die [test $HAVE_FCHMODAT = 0] @@ -24,7 +25,6 @@ gl_FUNC_FCHMODAT if test $HAVE_FCHMODAT = 0; then AC_LIBOBJ([fchmodat]) fi -AC_REQUIRE([AC_C_INLINE]) dnl because 'inline' is used in lib/openat.h gl_MODULE_INDICATOR([fchmodat]) dnl for lib/openat.h gl_SYS_STAT_MODULE_INDICATOR([fchmodat]) diff --git a/modules/fchownat b/modules/fchownat index 886b6b36e8..7fba3edc20 100644 --- a/modules/fchownat +++ b/modules/fchownat @@ -13,6 +13,7 @@ extensions at-internal [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1] dosname [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1] errno [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1] +extern-inline [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1] fchdir [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1] fcntl-h [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1] lchown [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1] @@ -26,7 +27,6 @@ gl_FUNC_FCHOWNAT if test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1; then AC_LIBOBJ([fchownat]) fi -AC_REQUIRE([AC_C_INLINE]) dnl because 'inline' is used in lib/openat.h gl_MODULE_INDICATOR([fchownat]) dnl for lib/openat.h gl_UNISTD_MODULE_INDICATOR([fchownat]) diff --git a/modules/fstatat b/modules/fstatat index fa78faf6d9..69e9a7b641 100644 --- a/modules/fstatat +++ b/modules/fstatat @@ -14,6 +14,7 @@ extensions at-internal [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1] dosname [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1] errno [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1] +extern-inline [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1] fchdir [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1] fcntl-h [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1] lstat [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1] @@ -26,7 +27,6 @@ gl_FUNC_FSTATAT if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then AC_LIBOBJ([fstatat]) fi -AC_REQUIRE([AC_C_INLINE]) dnl because 'inline' is used in lib/openat.h gl_MODULE_INDICATOR([fstatat]) dnl for lib/openat.h gl_SYS_STAT_MODULE_INDICATOR([fstatat]) diff --git a/modules/openat-h b/modules/openat-h index 2af3b8885f..6165dff9f6 100644 --- a/modules/openat-h +++ b/modules/openat-h @@ -5,6 +5,7 @@ Files: lib/openat.h Depends-on: +extern-inline fcntl-h stdbool sys_stat