diff options
| author | Paul Eggert | 2017-01-10 07:48:37 -0800 |
|---|---|---|
| committer | Paul Eggert | 2017-01-10 07:49:55 -0800 |
| commit | fa0a2b4e7c81f57aecc1d94df00588a4dd5c281d (patch) | |
| tree | 31408852501056452a337677c8f5b80fd3c24e7c /lib | |
| parent | 560a384038845e37228226313eccfc8d70132553 (diff) | |
| download | emacs-fa0a2b4e7c81f57aecc1d94df00588a4dd5c281d.tar.gz emacs-fa0a2b4e7c81f57aecc1d94df00588a4dd5c281d.zip | |
Merge from gnulib
This incorporates:
2017-01-09 maint: time stamp -> timestamp
2017-01-07 stdioext: Port to Minix 3.2 and newer
2017-01-06 glob, intprops, xalloc: work around Clang bug
2017-01-02 revert copyright-year change to synced files
* doc/misc/texinfo.tex, lib/fpending.c, lib/intprops.h, lib/mktime.c:
* lib/stat-time.h, lib/stdio-impl.h, lib/time.in.h, lib/timespec.h:
* lib/utimens.c, lib/xalloc-oversized.h:
Copy from gnulib.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/fpending.c | 2 | ||||
| -rw-r--r-- | lib/intprops.h | 10 | ||||
| -rw-r--r-- | lib/mktime.c | 2 | ||||
| -rw-r--r-- | lib/stat-time.h | 2 | ||||
| -rw-r--r-- | lib/stdio-impl.h | 4 | ||||
| -rw-r--r-- | lib/time.in.h | 2 | ||||
| -rw-r--r-- | lib/timespec.h | 6 | ||||
| -rw-r--r-- | lib/utimens.c | 10 | ||||
| -rw-r--r-- | lib/xalloc-oversized.h | 12 |
9 files changed, 18 insertions, 32 deletions
diff --git a/lib/fpending.c b/lib/fpending.c index 8761c77ca66..c9b77866858 100644 --- a/lib/fpending.c +++ b/lib/fpending.c | |||
| @@ -35,7 +35,7 @@ __fpending (FILE *fp) | |||
| 35 | #if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | 35 | #if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ |
| 36 | return fp->_IO_write_ptr - fp->_IO_write_base; | 36 | return fp->_IO_write_ptr - fp->_IO_write_base; |
| 37 | #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ | 37 | #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ |
| 38 | /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */ | 38 | /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ |
| 39 | return fp->_p - fp->_bf._base; | 39 | return fp->_p - fp->_bf._base; |
| 40 | #elif defined __EMX__ /* emx+gcc */ | 40 | #elif defined __EMX__ /* emx+gcc */ |
| 41 | return fp->_ptr - fp->_buffer; | 41 | return fp->_ptr - fp->_buffer; |
diff --git a/lib/intprops.h b/lib/intprops.h index e0c178fea8e..85ed61f8d8c 100644 --- a/lib/intprops.h +++ b/lib/intprops.h | |||
| @@ -23,10 +23,6 @@ | |||
| 23 | #include <limits.h> | 23 | #include <limits.h> |
| 24 | #include <verify.h> | 24 | #include <verify.h> |
| 25 | 25 | ||
| 26 | #ifndef __has_builtin | ||
| 27 | # define __has_builtin(x) 0 | ||
| 28 | #endif | ||
| 29 | |||
| 30 | /* Return a value with the common real type of E and V and the value of V. */ | 26 | /* Return a value with the common real type of E and V and the value of V. */ |
| 31 | #define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) | 27 | #define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) |
| 32 | 28 | ||
| @@ -241,12 +237,10 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); | |||
| 241 | : (max) >> (b) < (a)) | 237 | : (max) >> (b) < (a)) |
| 242 | 238 | ||
| 243 | /* True if __builtin_add_overflow (A, B, P) works when P is non-null. */ | 239 | /* True if __builtin_add_overflow (A, B, P) works when P is non-null. */ |
| 244 | #define _GL_HAS_BUILTIN_OVERFLOW \ | 240 | #define _GL_HAS_BUILTIN_OVERFLOW (5 <= __GNUC__) |
| 245 | (5 <= __GNUC__ || __has_builtin (__builtin_add_overflow)) | ||
| 246 | 241 | ||
| 247 | /* True if __builtin_add_overflow_p (A, B, C) works. */ | 242 | /* True if __builtin_add_overflow_p (A, B, C) works. */ |
| 248 | #define _GL_HAS_BUILTIN_OVERFLOW_P \ | 243 | #define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__) |
| 249 | (7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)) | ||
| 250 | 244 | ||
| 251 | /* The _GL*_OVERFLOW macros have the same restrictions as the | 245 | /* The _GL*_OVERFLOW macros have the same restrictions as the |
| 252 | *_RANGE_OVERFLOW macros, except that they do not assume that operands | 246 | *_RANGE_OVERFLOW macros, except that they do not assume that operands |
diff --git a/lib/mktime.c b/lib/mktime.c index b67514996f4..998882f5860 100644 --- a/lib/mktime.c +++ b/lib/mktime.c | |||
| @@ -153,7 +153,7 @@ isdst_differ (int a, int b) | |||
| 153 | 153 | ||
| 154 | /* Return an integer value measuring (YEAR1-YDAY1 HOUR1:MIN1:SEC1) - | 154 | /* Return an integer value measuring (YEAR1-YDAY1 HOUR1:MIN1:SEC1) - |
| 155 | (YEAR0-YDAY0 HOUR0:MIN0:SEC0) in seconds, assuming that the clocks | 155 | (YEAR0-YDAY0 HOUR0:MIN0:SEC0) in seconds, assuming that the clocks |
| 156 | were not adjusted between the time stamps. | 156 | were not adjusted between the timestamps. |
| 157 | 157 | ||
| 158 | The YEAR values uses the same numbering as TP->tm_year. Values | 158 | The YEAR values uses the same numbering as TP->tm_year. Values |
| 159 | need not be in the usual range. However, YEAR1 must not overflow | 159 | need not be in the usual range. However, YEAR1 must not overflow |
diff --git a/lib/stat-time.h b/lib/stat-time.h index b060cc7a7b5..9402b3fc1c0 100644 --- a/lib/stat-time.h +++ b/lib/stat-time.h | |||
| @@ -181,7 +181,7 @@ get_stat_birthtime (struct stat const *st) | |||
| 181 | || defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC) | 181 | || defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC) |
| 182 | /* FreeBSD and NetBSD sometimes signal the absence of knowledge by | 182 | /* FreeBSD and NetBSD sometimes signal the absence of knowledge by |
| 183 | using zero. Attempt to work around this problem. Alas, this can | 183 | using zero. Attempt to work around this problem. Alas, this can |
| 184 | report failure even for valid time stamps. Also, NetBSD | 184 | report failure even for valid timestamps. Also, NetBSD |
| 185 | sometimes returns junk in the birth time fields; work around this | 185 | sometimes returns junk in the birth time fields; work around this |
| 186 | bug if it is detected. */ | 186 | bug if it is detected. */ |
| 187 | if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000)) | 187 | if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000)) |
diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h index d2d4daa6e10..75a945eb724 100644 --- a/lib/stdio-impl.h +++ b/lib/stdio-impl.h | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | #include <errno.h> /* For detecting Plan9. */ | 29 | #include <errno.h> /* For detecting Plan9. */ |
| 30 | 30 | ||
| 31 | #if defined __sferror || defined __DragonFly__ || defined __ANDROID__ | 31 | #if defined __sferror || defined __DragonFly__ || defined __ANDROID__ |
| 32 | /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */ | 32 | /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ |
| 33 | 33 | ||
| 34 | # if defined __DragonFly__ /* DragonFly */ | 34 | # if defined __DragonFly__ /* DragonFly */ |
| 35 | /* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */ | 35 | /* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */ |
| @@ -58,7 +58,7 @@ | |||
| 58 | # define fp_ fp | 58 | # define fp_ fp |
| 59 | # endif | 59 | # endif |
| 60 | 60 | ||
| 61 | # if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __ANDROID__ /* NetBSD >= 1.5ZA, OpenBSD, Android */ | 61 | # if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __minix || defined __ANDROID__ /* NetBSD >= 1.5ZA, OpenBSD, Minix 3, Android */ |
| 62 | /* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> | 62 | /* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> |
| 63 | and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */ | 63 | and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */ |
| 64 | struct __sfileext | 64 | struct __sfileext |
diff --git a/lib/time.in.h b/lib/time.in.h index 3740364b094..fef89807f8a 100644 --- a/lib/time.in.h +++ b/lib/time.in.h | |||
| @@ -217,7 +217,7 @@ _GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer)); | |||
| 217 | _GL_CXXALIASWARN (gmtime); | 217 | _GL_CXXALIASWARN (gmtime); |
| 218 | # endif | 218 | # endif |
| 219 | 219 | ||
| 220 | /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store | 220 | /* Parse BUF as a timestamp, assuming FORMAT specifies its layout, and store |
| 221 | the resulting broken-down time into TM. See | 221 | the resulting broken-down time into TM. See |
| 222 | <http://www.opengroup.org/susv3xsh/strptime.html>. */ | 222 | <http://www.opengroup.org/susv3xsh/strptime.html>. */ |
| 223 | # if @GNULIB_STRPTIME@ | 223 | # if @GNULIB_STRPTIME@ |
diff --git a/lib/timespec.h b/lib/timespec.h index fc7b3d115b7..a5eca797ce3 100644 --- a/lib/timespec.h +++ b/lib/timespec.h | |||
| @@ -29,7 +29,7 @@ _GL_INLINE_HEADER_BEGIN | |||
| 29 | # define _GL_TIMESPEC_INLINE _GL_INLINE | 29 | # define _GL_TIMESPEC_INLINE _GL_INLINE |
| 30 | #endif | 30 | #endif |
| 31 | 31 | ||
| 32 | /* Resolution of timespec time stamps (in units per second), and log | 32 | /* Resolution of timespec timestamps (in units per second), and log |
| 33 | base 10 of the resolution. */ | 33 | base 10 of the resolution. */ |
| 34 | 34 | ||
| 35 | enum { TIMESPEC_RESOLUTION = 1000000000 }; | 35 | enum { TIMESPEC_RESOLUTION = 1000000000 }; |
| @@ -48,7 +48,7 @@ make_timespec (time_t s, long int ns) | |||
| 48 | 48 | ||
| 49 | /* Return negative, zero, positive if A < B, A == B, A > B, respectively. | 49 | /* Return negative, zero, positive if A < B, A == B, A > B, respectively. |
| 50 | 50 | ||
| 51 | For each time stamp T, this code assumes that either: | 51 | For each timestamp T, this code assumes that either: |
| 52 | 52 | ||
| 53 | * T.tv_nsec is in the range 0..999999999; or | 53 | * T.tv_nsec is in the range 0..999999999; or |
| 54 | * T.tv_sec corresponds to a valid leap second on a host that supports | 54 | * T.tv_sec corresponds to a valid leap second on a host that supports |
| @@ -56,7 +56,7 @@ make_timespec (time_t s, long int ns) | |||
| 56 | * T.tv_sec is the minimum time_t value and T.tv_nsec is -1; or | 56 | * T.tv_sec is the minimum time_t value and T.tv_nsec is -1; or |
| 57 | T.tv_sec is the maximum time_t value and T.tv_nsec is 2000000000. | 57 | T.tv_sec is the maximum time_t value and T.tv_nsec is 2000000000. |
| 58 | This allows for special struct timespec values that are less or | 58 | This allows for special struct timespec values that are less or |
| 59 | greater than all possible valid time stamps. | 59 | greater than all possible valid timestamps. |
| 60 | 60 | ||
| 61 | In all these cases, it is safe to subtract two tv_nsec values and | 61 | In all these cases, it is safe to subtract two tv_nsec values and |
| 62 | convert the result to integer without worrying about overflow on | 62 | convert the result to integer without worrying about overflow on |
diff --git a/lib/utimens.c b/lib/utimens.c index e2bb702e7dc..3643668c3a5 100644 --- a/lib/utimens.c +++ b/lib/utimens.c | |||
| @@ -154,14 +154,14 @@ update_timespec (struct stat const *statbuf, struct timespec *ts[2]) | |||
| 154 | return false; | 154 | return false; |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | /* Set the access and modification time stamps of FD (a.k.a. FILE) to be | 157 | /* Set the access and modification timestamps of FD (a.k.a. FILE) to be |
| 158 | TIMESPEC[0] and TIMESPEC[1], respectively. | 158 | TIMESPEC[0] and TIMESPEC[1], respectively. |
| 159 | FD must be either negative -- in which case it is ignored -- | 159 | FD must be either negative -- in which case it is ignored -- |
| 160 | or a file descriptor that is open on FILE. | 160 | or a file descriptor that is open on FILE. |
| 161 | If FD is nonnegative, then FILE can be NULL, which means | 161 | If FD is nonnegative, then FILE can be NULL, which means |
| 162 | use just futimes (or equivalent) instead of utimes (or equivalent), | 162 | use just futimes (or equivalent) instead of utimes (or equivalent), |
| 163 | and fail if on an old system without futimes (or equivalent). | 163 | and fail if on an old system without futimes (or equivalent). |
| 164 | If TIMESPEC is null, set the time stamps to the current time. | 164 | If TIMESPEC is null, set the timestamps to the current time. |
| 165 | Return 0 on success, -1 (setting errno) on failure. */ | 165 | Return 0 on success, -1 (setting errno) on failure. */ |
| 166 | 166 | ||
| 167 | int | 167 | int |
| @@ -190,7 +190,7 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2]) | |||
| 190 | return -1; | 190 | return -1; |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | /* Some Linux-based NFS clients are buggy, and mishandle time stamps | 193 | /* Some Linux-based NFS clients are buggy, and mishandle timestamps |
| 194 | of files in NFS file systems in some cases. We have no | 194 | of files in NFS file systems in some cases. We have no |
| 195 | configure-time test for this, but please see | 195 | configure-time test for this, but please see |
| 196 | <http://bugs.gentoo.org/show_bug.cgi?id=132673> for references to | 196 | <http://bugs.gentoo.org/show_bug.cgi?id=132673> for references to |
| @@ -411,7 +411,7 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2]) | |||
| 411 | } | 411 | } |
| 412 | } | 412 | } |
| 413 | 413 | ||
| 414 | /* Set the access and modification time stamps of FILE to be | 414 | /* Set the access and modification timestamps of FILE to be |
| 415 | TIMESPEC[0] and TIMESPEC[1], respectively. */ | 415 | TIMESPEC[0] and TIMESPEC[1], respectively. */ |
| 416 | int | 416 | int |
| 417 | utimens (char const *file, struct timespec const timespec[2]) | 417 | utimens (char const *file, struct timespec const timespec[2]) |
| @@ -419,7 +419,7 @@ utimens (char const *file, struct timespec const timespec[2]) | |||
| 419 | return fdutimens (-1, file, timespec); | 419 | return fdutimens (-1, file, timespec); |
| 420 | } | 420 | } |
| 421 | 421 | ||
| 422 | /* Set the access and modification time stamps of FILE to be | 422 | /* Set the access and modification timestamps of FILE to be |
| 423 | TIMESPEC[0] and TIMESPEC[1], respectively, without dereferencing | 423 | TIMESPEC[0] and TIMESPEC[1], respectively, without dereferencing |
| 424 | symlinks. Fail with ENOSYS if the platform does not support | 424 | symlinks. Fail with ENOSYS if the platform does not support |
| 425 | changing symlink timestamps, but FILE was a symlink. */ | 425 | changing symlink timestamps, but FILE was a symlink. */ |
diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h index 6b4e68b7c0e..ff0efc6ba40 100644 --- a/lib/xalloc-oversized.h +++ b/lib/xalloc-oversized.h | |||
| @@ -21,11 +21,6 @@ | |||
| 21 | #include <stddef.h> | 21 | #include <stddef.h> |
| 22 | #include <stdint.h> | 22 | #include <stdint.h> |
| 23 | 23 | ||
| 24 | /* Default for (non-Clang) compilers that lack __has_builtin. */ | ||
| 25 | #ifndef __has_builtin | ||
| 26 | # define __has_builtin(x) 0 | ||
| 27 | #endif | ||
| 28 | |||
| 29 | /* True if N * S would overflow in a size_t calculation, | 24 | /* True if N * S would overflow in a size_t calculation, |
| 30 | or would generate a value larger than PTRDIFF_MAX. | 25 | or would generate a value larger than PTRDIFF_MAX. |
| 31 | This expands to a constant expression if N and S are both constants. | 26 | This expands to a constant expression if N and S are both constants. |
| @@ -46,13 +41,10 @@ typedef size_t __xalloc_count_type; | |||
| 46 | positive and N must be nonnegative. This is a macro, not a | 41 | positive and N must be nonnegative. This is a macro, not a |
| 47 | function, so that it works correctly even when SIZE_MAX < N. */ | 42 | function, so that it works correctly even when SIZE_MAX < N. */ |
| 48 | 43 | ||
| 49 | #if 7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p) | 44 | #if 7 <= __GNUC__ |
| 50 | # define xalloc_oversized(n, s) \ | 45 | # define xalloc_oversized(n, s) \ |
| 51 | __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1) | 46 | __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1) |
| 52 | #elif ((5 <= __GNUC__ \ | 47 | #elif 5 <= __GNUC__ && !__STRICT_ANSI__ |
| 53 | || (__has_builtin (__builtin_mul_overflow) \ | ||
| 54 | && __has_builtin (__builtin_constant_p))) \ | ||
| 55 | && !__STRICT_ANSI__) | ||
| 56 | # define xalloc_oversized(n, s) \ | 48 | # define xalloc_oversized(n, s) \ |
| 57 | (__builtin_constant_p (n) && __builtin_constant_p (s) \ | 49 | (__builtin_constant_p (n) && __builtin_constant_p (s) \ |
| 58 | ? __xalloc_oversized (n, s) \ | 50 | ? __xalloc_oversized (n, s) \ |