diff options
| author | Paul Eggert | 2012-08-01 21:46:10 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-08-01 21:46:10 -0700 |
| commit | a0d4efe9c3c01fde58b401ee5ab88f052128fa85 (patch) | |
| tree | 70862330c792d4ba0d16d9b389e742d65ddf2004 | |
| parent | 13294f95172c68a5e77143f917231e0f17f37537 (diff) | |
| download | emacs-a0d4efe9c3c01fde58b401ee5ab88f052128fa85.tar.gz emacs-a0d4efe9c3c01fde58b401ee5ab88f052128fa85.zip | |
Merge from gnulib, for extern-inline.
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.
Fixes: debbugs:12116
| -rw-r--r-- | ChangeLog | 7 | ||||
| -rw-r--r-- | lib/gnulib.mk | 3 | ||||
| -rw-r--r-- | lib/stat-time.c | 3 | ||||
| -rw-r--r-- | lib/stat-time.h | 23 | ||||
| -rw-r--r-- | lib/timespec.c | 3 | ||||
| -rw-r--r-- | lib/timespec.h | 13 | ||||
| -rw-r--r-- | lib/u64.c | 3 | ||||
| -rw-r--r-- | lib/u64.h | 27 | ||||
| -rw-r--r-- | lib/utimens.c | 1 | ||||
| -rw-r--r-- | lib/utimens.h | 29 | ||||
| -rw-r--r-- | m4/extern-inline.m4 | 40 | ||||
| -rw-r--r-- | m4/gnulib-comp.m4 | 7 |
12 files changed, 136 insertions, 23 deletions
| @@ -1,5 +1,12 @@ | |||
| 1 | 2012-08-02 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2012-08-02 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Merge from gnulib (Bug#12116), incorporating: | ||
| 4 | 2012-08-01 extern-inline: new module | ||
| 5 | 2012-08-01 stat-time, timespec, u64, utimens: use extern-inline | ||
| 6 | * lib/stat-time.c, lib/utimespec.c, lib/u64.c, m4/extern-inline.m4: | ||
| 7 | New files. The new .c files are for instantiating extern inline | ||
| 8 | functions. | ||
| 9 | |||
| 3 | Port to Solaris 8. | 10 | Port to Solaris 8. |
| 4 | Without this change, 'configure' fails because the recently-added | 11 | Without this change, 'configure' fails because the recently-added |
| 5 | wait3 prototype in config.h messes up later 'configure' tests. | 12 | wait3 prototype in config.h messes up later 'configure' tests. |
diff --git a/lib/gnulib.mk b/lib/gnulib.mk index c85b923029e..0cc0e68bb7b 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk | |||
| @@ -465,6 +465,7 @@ EXTRA_libgnu_a_SOURCES += stat.c | |||
| 465 | 465 | ||
| 466 | ## begin gnulib module stat-time | 466 | ## begin gnulib module stat-time |
| 467 | 467 | ||
| 468 | libgnu_a_SOURCES += stat-time.c | ||
| 468 | 469 | ||
| 469 | EXTRA_DIST += stat-time.h | 470 | EXTRA_DIST += stat-time.h |
| 470 | 471 | ||
| @@ -1092,6 +1093,7 @@ EXTRA_libgnu_a_SOURCES += time_r.c | |||
| 1092 | 1093 | ||
| 1093 | ## begin gnulib module timespec | 1094 | ## begin gnulib module timespec |
| 1094 | 1095 | ||
| 1096 | libgnu_a_SOURCES += timespec.c | ||
| 1095 | 1097 | ||
| 1096 | EXTRA_DIST += timespec.h | 1098 | EXTRA_DIST += timespec.h |
| 1097 | 1099 | ||
| @@ -1111,6 +1113,7 @@ libgnu_a_SOURCES += timespec-sub.c | |||
| 1111 | 1113 | ||
| 1112 | ## begin gnulib module u64 | 1114 | ## begin gnulib module u64 |
| 1113 | 1115 | ||
| 1116 | libgnu_a_SOURCES += u64.c | ||
| 1114 | 1117 | ||
| 1115 | EXTRA_DIST += u64.h | 1118 | EXTRA_DIST += u64.h |
| 1116 | 1119 | ||
diff --git a/lib/stat-time.c b/lib/stat-time.c new file mode 100644 index 00000000000..1a907ef250b --- /dev/null +++ b/lib/stat-time.c | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | #include <config.h> | ||
| 2 | #define _GL_STAT_TIME_INLINE _GL_EXTERN_INLINE | ||
| 3 | #include <stat-time.h> | ||
diff --git a/lib/stat-time.h b/lib/stat-time.h index 30c2acdab63..74dd00aeb3e 100644 --- a/lib/stat-time.h +++ b/lib/stat-time.h | |||
| @@ -23,6 +23,11 @@ | |||
| 23 | #include <sys/stat.h> | 23 | #include <sys/stat.h> |
| 24 | #include <time.h> | 24 | #include <time.h> |
| 25 | 25 | ||
| 26 | _GL_INLINE_HEADER_BEGIN | ||
| 27 | #ifndef _GL_STAT_TIME_INLINE | ||
| 28 | # define _GL_STAT_TIME_INLINE _GL_INLINE | ||
| 29 | #endif | ||
| 30 | |||
| 26 | /* STAT_TIMESPEC (ST, ST_XTIM) is the ST_XTIM member for *ST of type | 31 | /* STAT_TIMESPEC (ST, ST_XTIM) is the ST_XTIM member for *ST of type |
| 27 | struct timespec, if available. If not, then STAT_TIMESPEC_NS (ST, | 32 | struct timespec, if available. If not, then STAT_TIMESPEC_NS (ST, |
| 28 | ST_XTIM) is the nanosecond component of the ST_XTIM member for *ST, | 33 | ST_XTIM) is the nanosecond component of the ST_XTIM member for *ST, |
| @@ -46,7 +51,7 @@ | |||
| 46 | #endif | 51 | #endif |
| 47 | 52 | ||
| 48 | /* Return the nanosecond component of *ST's access time. */ | 53 | /* Return the nanosecond component of *ST's access time. */ |
| 49 | static inline long int | 54 | _GL_STAT_TIME_INLINE long int |
| 50 | get_stat_atime_ns (struct stat const *st) | 55 | get_stat_atime_ns (struct stat const *st) |
| 51 | { | 56 | { |
| 52 | # if defined STAT_TIMESPEC | 57 | # if defined STAT_TIMESPEC |
| @@ -59,7 +64,7 @@ get_stat_atime_ns (struct stat const *st) | |||
| 59 | } | 64 | } |
| 60 | 65 | ||
| 61 | /* Return the nanosecond component of *ST's status change time. */ | 66 | /* Return the nanosecond component of *ST's status change time. */ |
| 62 | static inline long int | 67 | _GL_STAT_TIME_INLINE long int |
| 63 | get_stat_ctime_ns (struct stat const *st) | 68 | get_stat_ctime_ns (struct stat const *st) |
| 64 | { | 69 | { |
| 65 | # if defined STAT_TIMESPEC | 70 | # if defined STAT_TIMESPEC |
| @@ -72,7 +77,7 @@ get_stat_ctime_ns (struct stat const *st) | |||
| 72 | } | 77 | } |
| 73 | 78 | ||
| 74 | /* Return the nanosecond component of *ST's data modification time. */ | 79 | /* Return the nanosecond component of *ST's data modification time. */ |
| 75 | static inline long int | 80 | _GL_STAT_TIME_INLINE long int |
| 76 | get_stat_mtime_ns (struct stat const *st) | 81 | get_stat_mtime_ns (struct stat const *st) |
| 77 | { | 82 | { |
| 78 | # if defined STAT_TIMESPEC | 83 | # if defined STAT_TIMESPEC |
| @@ -85,7 +90,7 @@ get_stat_mtime_ns (struct stat const *st) | |||
| 85 | } | 90 | } |
| 86 | 91 | ||
| 87 | /* Return the nanosecond component of *ST's birth time. */ | 92 | /* Return the nanosecond component of *ST's birth time. */ |
| 88 | static inline long int | 93 | _GL_STAT_TIME_INLINE long int |
| 89 | get_stat_birthtime_ns (struct stat const *st) | 94 | get_stat_birthtime_ns (struct stat const *st) |
| 90 | { | 95 | { |
| 91 | # if defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC | 96 | # if defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC |
| @@ -100,7 +105,7 @@ get_stat_birthtime_ns (struct stat const *st) | |||
| 100 | } | 105 | } |
| 101 | 106 | ||
| 102 | /* Return *ST's access time. */ | 107 | /* Return *ST's access time. */ |
| 103 | static inline struct timespec | 108 | _GL_STAT_TIME_INLINE struct timespec |
| 104 | get_stat_atime (struct stat const *st) | 109 | get_stat_atime (struct stat const *st) |
| 105 | { | 110 | { |
| 106 | #ifdef STAT_TIMESPEC | 111 | #ifdef STAT_TIMESPEC |
| @@ -114,7 +119,7 @@ get_stat_atime (struct stat const *st) | |||
| 114 | } | 119 | } |
| 115 | 120 | ||
| 116 | /* Return *ST's status change time. */ | 121 | /* Return *ST's status change time. */ |
| 117 | static inline struct timespec | 122 | _GL_STAT_TIME_INLINE struct timespec |
| 118 | get_stat_ctime (struct stat const *st) | 123 | get_stat_ctime (struct stat const *st) |
| 119 | { | 124 | { |
| 120 | #ifdef STAT_TIMESPEC | 125 | #ifdef STAT_TIMESPEC |
| @@ -128,7 +133,7 @@ get_stat_ctime (struct stat const *st) | |||
| 128 | } | 133 | } |
| 129 | 134 | ||
| 130 | /* Return *ST's data modification time. */ | 135 | /* Return *ST's data modification time. */ |
| 131 | static inline struct timespec | 136 | _GL_STAT_TIME_INLINE struct timespec |
| 132 | get_stat_mtime (struct stat const *st) | 137 | get_stat_mtime (struct stat const *st) |
| 133 | { | 138 | { |
| 134 | #ifdef STAT_TIMESPEC | 139 | #ifdef STAT_TIMESPEC |
| @@ -143,7 +148,7 @@ get_stat_mtime (struct stat const *st) | |||
| 143 | 148 | ||
| 144 | /* Return *ST's birth time, if available; otherwise return a value | 149 | /* Return *ST's birth time, if available; otherwise return a value |
| 145 | with tv_sec and tv_nsec both equal to -1. */ | 150 | with tv_sec and tv_nsec both equal to -1. */ |
| 146 | static inline struct timespec | 151 | _GL_STAT_TIME_INLINE struct timespec |
| 147 | get_stat_birthtime (struct stat const *st) | 152 | get_stat_birthtime (struct stat const *st) |
| 148 | { | 153 | { |
| 149 | struct timespec t; | 154 | struct timespec t; |
| @@ -186,4 +191,6 @@ get_stat_birthtime (struct stat const *st) | |||
| 186 | return t; | 191 | return t; |
| 187 | } | 192 | } |
| 188 | 193 | ||
| 194 | _GL_INLINE_HEADER_END | ||
| 195 | |||
| 189 | #endif | 196 | #endif |
diff --git a/lib/timespec.c b/lib/timespec.c new file mode 100644 index 00000000000..16a77647228 --- /dev/null +++ b/lib/timespec.c | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | #include <config.h> | ||
| 2 | #define _GL_TIMESPEC_INLINE _GL_EXTERN_INLINE | ||
| 3 | #include <timespec.h> | ||
diff --git a/lib/timespec.h b/lib/timespec.h index a58707947ce..d0a2194f61d 100644 --- a/lib/timespec.h +++ b/lib/timespec.h | |||
| @@ -21,6 +21,11 @@ | |||
| 21 | 21 | ||
| 22 | # include <time.h> | 22 | # include <time.h> |
| 23 | 23 | ||
| 24 | _GL_INLINE_HEADER_BEGIN | ||
| 25 | #ifndef _GL_TIMESPEC_INLINE | ||
| 26 | # define _GL_TIMESPEC_INLINE _GL_INLINE | ||
| 27 | #endif | ||
| 28 | |||
| 24 | /* Return negative, zero, positive if A < B, A == B, A > B, respectively. | 29 | /* Return negative, zero, positive if A < B, A == B, A > B, respectively. |
| 25 | 30 | ||
| 26 | For each time stamp T, this code assumes that either: | 31 | For each time stamp T, this code assumes that either: |
| @@ -49,7 +54,7 @@ | |||
| 49 | 54 | ||
| 50 | The (int) cast avoids a gcc -Wconversion warning. */ | 55 | The (int) cast avoids a gcc -Wconversion warning. */ |
| 51 | 56 | ||
| 52 | static inline int | 57 | _GL_TIMESPEC_INLINE int |
| 53 | timespec_cmp (struct timespec a, struct timespec b) | 58 | timespec_cmp (struct timespec a, struct timespec b) |
| 54 | { | 59 | { |
| 55 | return (a.tv_sec < b.tv_sec ? -1 | 60 | return (a.tv_sec < b.tv_sec ? -1 |
| @@ -59,7 +64,7 @@ timespec_cmp (struct timespec a, struct timespec b) | |||
| 59 | 64 | ||
| 60 | /* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be | 65 | /* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be |
| 61 | nonnegative. */ | 66 | nonnegative. */ |
| 62 | static inline int | 67 | _GL_TIMESPEC_INLINE int |
| 63 | timespec_sign (struct timespec a) | 68 | timespec_sign (struct timespec a) |
| 64 | { | 69 | { |
| 65 | return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec; | 70 | return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec; |
| @@ -73,7 +78,7 @@ struct timespec dtotimespec (double) | |||
| 73 | _GL_ATTRIBUTE_CONST; | 78 | _GL_ATTRIBUTE_CONST; |
| 74 | 79 | ||
| 75 | /* Return an approximation to A, of type 'double'. */ | 80 | /* Return an approximation to A, of type 'double'. */ |
| 76 | static inline double | 81 | _GL_TIMESPEC_INLINE double |
| 77 | timespectod (struct timespec a) | 82 | timespectod (struct timespec a) |
| 78 | { | 83 | { |
| 79 | return a.tv_sec + a.tv_nsec / 1e9; | 84 | return a.tv_sec + a.tv_nsec / 1e9; |
| @@ -82,4 +87,6 @@ timespectod (struct timespec a) | |||
| 82 | void gettime (struct timespec *); | 87 | void gettime (struct timespec *); |
| 83 | int settime (struct timespec const *); | 88 | int settime (struct timespec const *); |
| 84 | 89 | ||
| 90 | _GL_INLINE_HEADER_END | ||
| 91 | |||
| 85 | #endif | 92 | #endif |
diff --git a/lib/u64.c b/lib/u64.c new file mode 100644 index 00000000000..30dcb45b61f --- /dev/null +++ b/lib/u64.c | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | #include <config.h> | ||
| 2 | #define _GL_U64_INLINE _GL_EXTERN_INLINE | ||
| 3 | #include <u64.h> | ||
| @@ -19,6 +19,11 @@ | |||
| 19 | 19 | ||
| 20 | #include <stdint.h> | 20 | #include <stdint.h> |
| 21 | 21 | ||
| 22 | _GL_INLINE_HEADER_BEGIN | ||
| 23 | #ifndef _GL_U64_INLINE | ||
| 24 | # define _GL_U64_INLINE _GL_INLINE | ||
| 25 | #endif | ||
| 26 | |||
| 22 | /* Return X rotated left by N bits, where 0 < N < 64. */ | 27 | /* Return X rotated left by N bits, where 0 < N < 64. */ |
| 23 | #define u64rol(x, n) u64or (u64shl (x, n), u64shr (x, 64 - n)) | 28 | #define u64rol(x, n) u64or (u64shl (x, n), u64shr (x, 64 - n)) |
| 24 | 29 | ||
| @@ -54,7 +59,7 @@ typedef struct { uint32_t lo, hi; } u64; | |||
| 54 | 59 | ||
| 55 | /* Given the high and low-order 32-bit quantities HI and LO, return a u64 | 60 | /* Given the high and low-order 32-bit quantities HI and LO, return a u64 |
| 56 | value representing (HI << 32) + LO. */ | 61 | value representing (HI << 32) + LO. */ |
| 57 | static inline u64 | 62 | _GL_U64_INLINE u64 |
| 58 | u64hilo (uint32_t hi, uint32_t lo) | 63 | u64hilo (uint32_t hi, uint32_t lo) |
| 59 | { | 64 | { |
| 60 | u64 r; | 65 | u64 r; |
| @@ -64,7 +69,7 @@ u64hilo (uint32_t hi, uint32_t lo) | |||
| 64 | } | 69 | } |
| 65 | 70 | ||
| 66 | /* Return a u64 value representing LO. */ | 71 | /* Return a u64 value representing LO. */ |
| 67 | static inline u64 | 72 | _GL_U64_INLINE u64 |
| 68 | u64lo (uint32_t lo) | 73 | u64lo (uint32_t lo) |
| 69 | { | 74 | { |
| 70 | u64 r; | 75 | u64 r; |
| @@ -74,7 +79,7 @@ u64lo (uint32_t lo) | |||
| 74 | } | 79 | } |
| 75 | 80 | ||
| 76 | /* Return a u64 value representing SIZE. */ | 81 | /* Return a u64 value representing SIZE. */ |
| 77 | static inline u64 | 82 | _GL_U64_INLINE u64 |
| 78 | u64size (size_t size) | 83 | u64size (size_t size) |
| 79 | { | 84 | { |
| 80 | u64 r; | 85 | u64 r; |
| @@ -84,14 +89,14 @@ u64size (size_t size) | |||
| 84 | } | 89 | } |
| 85 | 90 | ||
| 86 | /* Return X < Y. */ | 91 | /* Return X < Y. */ |
| 87 | static inline int | 92 | _GL_U64_INLINE int |
| 88 | u64lt (u64 x, u64 y) | 93 | u64lt (u64 x, u64 y) |
| 89 | { | 94 | { |
| 90 | return x.hi < y.hi || (x.hi == y.hi && x.lo < y.lo); | 95 | return x.hi < y.hi || (x.hi == y.hi && x.lo < y.lo); |
| 91 | } | 96 | } |
| 92 | 97 | ||
| 93 | /* Return X & Y. */ | 98 | /* Return X & Y. */ |
| 94 | static inline u64 | 99 | _GL_U64_INLINE u64 |
| 95 | u64and (u64 x, u64 y) | 100 | u64and (u64 x, u64 y) |
| 96 | { | 101 | { |
| 97 | u64 r; | 102 | u64 r; |
| @@ -101,7 +106,7 @@ u64and (u64 x, u64 y) | |||
| 101 | } | 106 | } |
| 102 | 107 | ||
| 103 | /* Return X | Y. */ | 108 | /* Return X | Y. */ |
| 104 | static inline u64 | 109 | _GL_U64_INLINE u64 |
| 105 | u64or (u64 x, u64 y) | 110 | u64or (u64 x, u64 y) |
| 106 | { | 111 | { |
| 107 | u64 r; | 112 | u64 r; |
| @@ -111,7 +116,7 @@ u64or (u64 x, u64 y) | |||
| 111 | } | 116 | } |
| 112 | 117 | ||
| 113 | /* Return X ^ Y. */ | 118 | /* Return X ^ Y. */ |
| 114 | static inline u64 | 119 | _GL_U64_INLINE u64 |
| 115 | u64xor (u64 x, u64 y) | 120 | u64xor (u64 x, u64 y) |
| 116 | { | 121 | { |
| 117 | u64 r; | 122 | u64 r; |
| @@ -121,7 +126,7 @@ u64xor (u64 x, u64 y) | |||
| 121 | } | 126 | } |
| 122 | 127 | ||
| 123 | /* Return X + Y. */ | 128 | /* Return X + Y. */ |
| 124 | static inline u64 | 129 | _GL_U64_INLINE u64 |
| 125 | u64plus (u64 x, u64 y) | 130 | u64plus (u64 x, u64 y) |
| 126 | { | 131 | { |
| 127 | u64 r; | 132 | u64 r; |
| @@ -131,7 +136,7 @@ u64plus (u64 x, u64 y) | |||
| 131 | } | 136 | } |
| 132 | 137 | ||
| 133 | /* Return X << N. */ | 138 | /* Return X << N. */ |
| 134 | static inline u64 | 139 | _GL_U64_INLINE u64 |
| 135 | u64shl (u64 x, int n) | 140 | u64shl (u64 x, int n) |
| 136 | { | 141 | { |
| 137 | u64 r; | 142 | u64 r; |
| @@ -149,7 +154,7 @@ u64shl (u64 x, int n) | |||
| 149 | } | 154 | } |
| 150 | 155 | ||
| 151 | /* Return X >> N. */ | 156 | /* Return X >> N. */ |
| 152 | static inline u64 | 157 | _GL_U64_INLINE u64 |
| 153 | u64shr (u64 x, int n) | 158 | u64shr (u64 x, int n) |
| 154 | { | 159 | { |
| 155 | u64 r; | 160 | u64 r; |
| @@ -167,3 +172,5 @@ u64shr (u64 x, int n) | |||
| 167 | } | 172 | } |
| 168 | 173 | ||
| 169 | #endif | 174 | #endif |
| 175 | |||
| 176 | _GL_INLINE_HEADER_END | ||
diff --git a/lib/utimens.c b/lib/utimens.c index c126b9551a6..f06918cc23e 100644 --- a/lib/utimens.c +++ b/lib/utimens.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | #include <config.h> | 22 | #include <config.h> |
| 23 | 23 | ||
| 24 | #define _GL_UTIMENS_INLINE _GL_EXTERN_INLINE | ||
| 24 | #include "utimens.h" | 25 | #include "utimens.h" |
| 25 | 26 | ||
| 26 | #include <assert.h> | 27 | #include <assert.h> |
diff --git a/lib/utimens.h b/lib/utimens.h index 8c47cf93f88..f765d102b77 100644 --- a/lib/utimens.h +++ b/lib/utimens.h | |||
| @@ -1,3 +1,22 @@ | |||
| 1 | /* Set file access and modification times. | ||
| 2 | |||
| 3 | Copyright 2012 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This program is free software: you can redistribute it and/or modify it | ||
| 6 | under the terms of the GNU General Public License as published by the | ||
| 7 | Free Software Foundation; either version 3 of the License, or any | ||
| 8 | later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 17 | |||
| 18 | /* Written by Paul Eggert. */ | ||
| 19 | |||
| 1 | #include <time.h> | 20 | #include <time.h> |
| 2 | int fdutimens (int, char const *, struct timespec const [2]); | 21 | int fdutimens (int, char const *, struct timespec const [2]); |
| 3 | int utimens (char const *, struct timespec const [2]); | 22 | int utimens (char const *, struct timespec const [2]); |
| @@ -7,13 +26,21 @@ int lutimens (char const *, struct timespec const [2]); | |||
| 7 | # include <fcntl.h> | 26 | # include <fcntl.h> |
| 8 | # include <sys/stat.h> | 27 | # include <sys/stat.h> |
| 9 | 28 | ||
| 29 | _GL_INLINE_HEADER_BEGIN | ||
| 30 | #ifndef _GL_UTIMENS_INLINE | ||
| 31 | # define _GL_UTIMENS_INLINE _GL_INLINE | ||
| 32 | #endif | ||
| 33 | |||
| 10 | int fdutimensat (int fd, int dir, char const *name, struct timespec const [2], | 34 | int fdutimensat (int fd, int dir, char const *name, struct timespec const [2], |
| 11 | int atflag); | 35 | int atflag); |
| 12 | 36 | ||
| 13 | /* Using this function makes application code slightly more readable. */ | 37 | /* Using this function makes application code slightly more readable. */ |
| 14 | static inline int | 38 | _GL_UTIMENS_INLINE int |
| 15 | lutimensat (int dir, char const *file, struct timespec const times[2]) | 39 | lutimensat (int dir, char const *file, struct timespec const times[2]) |
| 16 | { | 40 | { |
| 17 | return utimensat (dir, file, times, AT_SYMLINK_NOFOLLOW); | 41 | return utimensat (dir, file, times, AT_SYMLINK_NOFOLLOW); |
| 18 | } | 42 | } |
| 43 | |||
| 44 | _GL_INLINE_HEADER_END | ||
| 45 | |||
| 19 | #endif | 46 | #endif |
diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4 new file mode 100644 index 00000000000..cacf8a08b16 --- /dev/null +++ b/m4/extern-inline.m4 | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | dnl 'extern inline' a la ISO C99. | ||
| 2 | |||
| 3 | dnl Copyright 2012 Free Software Foundation, Inc. | ||
| 4 | dnl This file is free software; the Free Software Foundation | ||
| 5 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 6 | dnl with or without modifications, as long as this notice is preserved. | ||
| 7 | |||
| 8 | AC_DEFUN([gl_EXTERN_INLINE], | ||
| 9 | [ | ||
| 10 | AC_REQUIRE([AC_C_INLINE]) | ||
| 11 | AH_VERBATIM([extern_inline], | ||
| 12 | [/* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'. | ||
| 13 | _GL_EXTERN_INLINE is a portable alternative to 'extern inline'. | ||
| 14 | _GL_INLINE_HEADER_BEGIN contains useful stuff to put | ||
| 15 | in an include file, before uses of _GL_INLINE. | ||
| 16 | It suppresses GCC's bogus "no previous prototype for 'FOO'" diagnostic, | ||
| 17 | when FOO is an inline function in the header; see | ||
| 18 | <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. | ||
| 19 | _GL_INLINE_HEADER_END contains useful stuff to put | ||
| 20 | in the same include file, after uses of _GL_INLINE. */ | ||
| 21 | #if __GNUC__ ? __GNUC_STDC_INLINE__ : 199901L <= __STDC_VERSION__ | ||
| 22 | # define _GL_INLINE inline | ||
| 23 | # define _GL_EXTERN_INLINE extern inline | ||
| 24 | # if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ | ||
| 25 | # define _GL_INLINE_HEADER_BEGIN \ | ||
| 26 | _Pragma ("GCC diagnostic push") \ | ||
| 27 | _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") | ||
| 28 | # define _GL_INLINE_HEADER_END \ | ||
| 29 | _Pragma ("GCC diagnostic pop") | ||
| 30 | # endif | ||
| 31 | #else | ||
| 32 | # define _GL_INLINE static inline | ||
| 33 | # define _GL_EXTERN_INLINE static inline | ||
| 34 | #endif | ||
| 35 | |||
| 36 | #ifndef _GL_INLINE_HEADER_BEGIN | ||
| 37 | # define _GL_INLINE_HEADER_BEGIN | ||
| 38 | # define _GL_INLINE_HEADER_END | ||
| 39 | #endif]) | ||
| 40 | ]) | ||
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index b0cd185a2b5..c4deb8d42fb 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 | |||
| @@ -55,6 +55,7 @@ AC_DEFUN([gl_EARLY], | |||
| 55 | # Code from module environ: | 55 | # Code from module environ: |
| 56 | # Code from module extensions: | 56 | # Code from module extensions: |
| 57 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | 57 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
| 58 | # Code from module extern-inline: | ||
| 58 | # Code from module filemode: | 59 | # Code from module filemode: |
| 59 | # Code from module getloadavg: | 60 | # Code from module getloadavg: |
| 60 | # Code from module getopt-gnu: | 61 | # Code from module getopt-gnu: |
| @@ -151,6 +152,7 @@ fi | |||
| 151 | gl_UNISTD_MODULE_INDICATOR([dup2]) | 152 | gl_UNISTD_MODULE_INDICATOR([dup2]) |
| 152 | gl_ENVIRON | 153 | gl_ENVIRON |
| 153 | gl_UNISTD_MODULE_INDICATOR([environ]) | 154 | gl_UNISTD_MODULE_INDICATOR([environ]) |
| 155 | AC_REQUIRE([gl_EXTERN_INLINE]) | ||
| 154 | gl_FILEMODE | 156 | gl_FILEMODE |
| 155 | gl_GETLOADAVG | 157 | gl_GETLOADAVG |
| 156 | if test $HAVE_GETLOADAVG = 0; then | 158 | if test $HAVE_GETLOADAVG = 0; then |
| @@ -261,7 +263,6 @@ if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then | |||
| 261 | fi | 263 | fi |
| 262 | gl_TIME_MODULE_INDICATOR([time_r]) | 264 | gl_TIME_MODULE_INDICATOR([time_r]) |
| 263 | gl_TIMESPEC | 265 | gl_TIMESPEC |
| 264 | AC_REQUIRE([AC_C_INLINE]) | ||
| 265 | gl_UNISTD_H | 266 | gl_UNISTD_H |
| 266 | gl_UTIMENS | 267 | gl_UTIMENS |
| 267 | gl_gnulib_enabled_dosname=false | 268 | gl_gnulib_enabled_dosname=false |
| @@ -565,6 +566,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 565 | lib/sha512.c | 566 | lib/sha512.c |
| 566 | lib/sha512.h | 567 | lib/sha512.h |
| 567 | lib/signal.in.h | 568 | lib/signal.in.h |
| 569 | lib/stat-time.c | ||
| 568 | lib/stat-time.h | 570 | lib/stat-time.h |
| 569 | lib/stat.c | 571 | lib/stat.c |
| 570 | lib/stdalign.in.h | 572 | lib/stdalign.in.h |
| @@ -590,7 +592,9 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 590 | lib/time_r.c | 592 | lib/time_r.c |
| 591 | lib/timespec-add.c | 593 | lib/timespec-add.c |
| 592 | lib/timespec-sub.c | 594 | lib/timespec-sub.c |
| 595 | lib/timespec.c | ||
| 593 | lib/timespec.h | 596 | lib/timespec.h |
| 597 | lib/u64.c | ||
| 594 | lib/u64.h | 598 | lib/u64.h |
| 595 | lib/unistd.in.h | 599 | lib/unistd.in.h |
| 596 | lib/utimens.c | 600 | lib/utimens.c |
| @@ -603,6 +607,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 603 | m4/dup2.m4 | 607 | m4/dup2.m4 |
| 604 | m4/environ.m4 | 608 | m4/environ.m4 |
| 605 | m4/extensions.m4 | 609 | m4/extensions.m4 |
| 610 | m4/extern-inline.m4 | ||
| 606 | m4/filemode.m4 | 611 | m4/filemode.m4 |
| 607 | m4/getloadavg.m4 | 612 | m4/getloadavg.m4 |
| 608 | m4/getopt.m4 | 613 | m4/getopt.m4 |