2012-08-02 Paul Eggert <eggert@cs.ucla.edu>
+ Merge from gnulib (Bug#12116), incorporating:
+ 2012-08-01 extern-inline: new module
+ 2012-08-01 stat-time, timespec, u64, utimens: use extern-inline
+ * lib/stat-time.c, lib/utimespec.c, lib/u64.c, m4/extern-inline.m4:
+ New files. The new .c files are for instantiating extern inline
+ functions.
+
Port to Solaris 8.
Without this change, 'configure' fails because the recently-added
wait3 prototype in config.h messes up later 'configure' tests.
## begin gnulib module stat-time
+libgnu_a_SOURCES += stat-time.c
EXTRA_DIST += stat-time.h
## begin gnulib module timespec
+libgnu_a_SOURCES += timespec.c
EXTRA_DIST += timespec.h
## begin gnulib module u64
+libgnu_a_SOURCES += u64.c
EXTRA_DIST += u64.h
--- /dev/null
+#include <config.h>
+#define _GL_STAT_TIME_INLINE _GL_EXTERN_INLINE
+#include <stat-time.h>
#include <sys/stat.h>
#include <time.h>
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_STAT_TIME_INLINE
+# define _GL_STAT_TIME_INLINE _GL_INLINE
+#endif
+
/* STAT_TIMESPEC (ST, ST_XTIM) is the ST_XTIM member for *ST of type
struct timespec, if available. If not, then STAT_TIMESPEC_NS (ST,
ST_XTIM) is the nanosecond component of the ST_XTIM member for *ST,
#endif
/* Return the nanosecond component of *ST's access time. */
-static inline long int
+_GL_STAT_TIME_INLINE long int
get_stat_atime_ns (struct stat const *st)
{
# if defined STAT_TIMESPEC
}
/* Return the nanosecond component of *ST's status change time. */
-static inline long int
+_GL_STAT_TIME_INLINE long int
get_stat_ctime_ns (struct stat const *st)
{
# if defined STAT_TIMESPEC
}
/* Return the nanosecond component of *ST's data modification time. */
-static inline long int
+_GL_STAT_TIME_INLINE long int
get_stat_mtime_ns (struct stat const *st)
{
# if defined STAT_TIMESPEC
}
/* Return the nanosecond component of *ST's birth time. */
-static inline long int
+_GL_STAT_TIME_INLINE long int
get_stat_birthtime_ns (struct stat const *st)
{
# if defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
}
/* Return *ST's access time. */
-static inline struct timespec
+_GL_STAT_TIME_INLINE struct timespec
get_stat_atime (struct stat const *st)
{
#ifdef STAT_TIMESPEC
}
/* Return *ST's status change time. */
-static inline struct timespec
+_GL_STAT_TIME_INLINE struct timespec
get_stat_ctime (struct stat const *st)
{
#ifdef STAT_TIMESPEC
}
/* Return *ST's data modification time. */
-static inline struct timespec
+_GL_STAT_TIME_INLINE struct timespec
get_stat_mtime (struct stat const *st)
{
#ifdef STAT_TIMESPEC
/* Return *ST's birth time, if available; otherwise return a value
with tv_sec and tv_nsec both equal to -1. */
-static inline struct timespec
+_GL_STAT_TIME_INLINE struct timespec
get_stat_birthtime (struct stat const *st)
{
struct timespec t;
return t;
}
+_GL_INLINE_HEADER_END
+
#endif
--- /dev/null
+#include <config.h>
+#define _GL_TIMESPEC_INLINE _GL_EXTERN_INLINE
+#include <timespec.h>
# include <time.h>
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_TIMESPEC_INLINE
+# define _GL_TIMESPEC_INLINE _GL_INLINE
+#endif
+
/* Return negative, zero, positive if A < B, A == B, A > B, respectively.
For each time stamp T, this code assumes that either:
The (int) cast avoids a gcc -Wconversion warning. */
-static inline int
+_GL_TIMESPEC_INLINE int
timespec_cmp (struct timespec a, struct timespec b)
{
return (a.tv_sec < b.tv_sec ? -1
/* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be
nonnegative. */
-static inline int
+_GL_TIMESPEC_INLINE int
timespec_sign (struct timespec a)
{
return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec;
_GL_ATTRIBUTE_CONST;
/* Return an approximation to A, of type 'double'. */
-static inline double
+_GL_TIMESPEC_INLINE double
timespectod (struct timespec a)
{
return a.tv_sec + a.tv_nsec / 1e9;
void gettime (struct timespec *);
int settime (struct timespec const *);
+_GL_INLINE_HEADER_END
+
#endif
--- /dev/null
+#include <config.h>
+#define _GL_U64_INLINE _GL_EXTERN_INLINE
+#include <u64.h>
#include <stdint.h>
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_U64_INLINE
+# define _GL_U64_INLINE _GL_INLINE
+#endif
+
/* Return X rotated left by N bits, where 0 < N < 64. */
#define u64rol(x, n) u64or (u64shl (x, n), u64shr (x, 64 - n))
/* Given the high and low-order 32-bit quantities HI and LO, return a u64
value representing (HI << 32) + LO. */
-static inline u64
+_GL_U64_INLINE u64
u64hilo (uint32_t hi, uint32_t lo)
{
u64 r;
}
/* Return a u64 value representing LO. */
-static inline u64
+_GL_U64_INLINE u64
u64lo (uint32_t lo)
{
u64 r;
}
/* Return a u64 value representing SIZE. */
-static inline u64
+_GL_U64_INLINE u64
u64size (size_t size)
{
u64 r;
}
/* Return X < Y. */
-static inline int
+_GL_U64_INLINE int
u64lt (u64 x, u64 y)
{
return x.hi < y.hi || (x.hi == y.hi && x.lo < y.lo);
}
/* Return X & Y. */
-static inline u64
+_GL_U64_INLINE u64
u64and (u64 x, u64 y)
{
u64 r;
}
/* Return X | Y. */
-static inline u64
+_GL_U64_INLINE u64
u64or (u64 x, u64 y)
{
u64 r;
}
/* Return X ^ Y. */
-static inline u64
+_GL_U64_INLINE u64
u64xor (u64 x, u64 y)
{
u64 r;
}
/* Return X + Y. */
-static inline u64
+_GL_U64_INLINE u64
u64plus (u64 x, u64 y)
{
u64 r;
}
/* Return X << N. */
-static inline u64
+_GL_U64_INLINE u64
u64shl (u64 x, int n)
{
u64 r;
}
/* Return X >> N. */
-static inline u64
+_GL_U64_INLINE u64
u64shr (u64 x, int n)
{
u64 r;
}
#endif
+
+_GL_INLINE_HEADER_END
#include <config.h>
+#define _GL_UTIMENS_INLINE _GL_EXTERN_INLINE
#include "utimens.h"
#include <assert.h>
+/* Set file access and modification times.
+
+ Copyright 2012 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 3 of the License, or any
+ later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Paul Eggert. */
+
#include <time.h>
int fdutimens (int, char const *, struct timespec const [2]);
int utimens (char const *, struct timespec const [2]);
# include <fcntl.h>
# include <sys/stat.h>
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_UTIMENS_INLINE
+# define _GL_UTIMENS_INLINE _GL_INLINE
+#endif
+
int fdutimensat (int fd, int dir, char const *name, struct timespec const [2],
int atflag);
/* Using this function makes application code slightly more readable. */
-static inline int
+_GL_UTIMENS_INLINE int
lutimensat (int dir, char const *file, struct timespec const times[2])
{
return utimensat (dir, file, times, AT_SYMLINK_NOFOLLOW);
}
+
+_GL_INLINE_HEADER_END
+
#endif
--- /dev/null
+dnl 'extern inline' a la ISO C99.
+
+dnl Copyright 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,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_EXTERN_INLINE],
+[
+ AC_REQUIRE([AC_C_INLINE])
+ AH_VERBATIM([extern_inline],
+[/* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'.
+ _GL_EXTERN_INLINE is a portable alternative to 'extern inline'.
+ _GL_INLINE_HEADER_BEGIN contains useful stuff to put
+ in an include file, before uses of _GL_INLINE.
+ It suppresses GCC's bogus "no previous prototype for 'FOO'" diagnostic,
+ when FOO is an inline function in the header; see
+ <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>.
+ _GL_INLINE_HEADER_END contains useful stuff to put
+ in the same include file, after uses of _GL_INLINE. */
+#if __GNUC__ ? __GNUC_STDC_INLINE__ : 199901L <= __STDC_VERSION__
+# define _GL_INLINE inline
+# define _GL_EXTERN_INLINE extern inline
+# if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
+# define _GL_INLINE_HEADER_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"")
+# define _GL_INLINE_HEADER_END \
+ _Pragma ("GCC diagnostic pop")
+# endif
+#else
+# define _GL_INLINE static inline
+# define _GL_EXTERN_INLINE static inline
+#endif
+
+#ifndef _GL_INLINE_HEADER_BEGIN
+# define _GL_INLINE_HEADER_BEGIN
+# define _GL_INLINE_HEADER_END
+#endif])
+])
# Code from module environ:
# Code from module extensions:
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ # Code from module extern-inline:
# Code from module filemode:
# Code from module getloadavg:
# Code from module getopt-gnu:
gl_UNISTD_MODULE_INDICATOR([dup2])
gl_ENVIRON
gl_UNISTD_MODULE_INDICATOR([environ])
+AC_REQUIRE([gl_EXTERN_INLINE])
gl_FILEMODE
gl_GETLOADAVG
if test $HAVE_GETLOADAVG = 0; then
fi
gl_TIME_MODULE_INDICATOR([time_r])
gl_TIMESPEC
-AC_REQUIRE([AC_C_INLINE])
gl_UNISTD_H
gl_UTIMENS
gl_gnulib_enabled_dosname=false
lib/sha512.c
lib/sha512.h
lib/signal.in.h
+ lib/stat-time.c
lib/stat-time.h
lib/stat.c
lib/stdalign.in.h
lib/time_r.c
lib/timespec-add.c
lib/timespec-sub.c
+ lib/timespec.c
lib/timespec.h
+ lib/u64.c
lib/u64.h
lib/unistd.in.h
lib/utimens.c
m4/dup2.m4
m4/environ.m4
m4/extensions.m4
+ m4/extern-inline.m4
m4/filemode.m4
m4/getloadavg.m4
m4/getopt.m4