diff options
| author | Paul Eggert | 2017-11-02 21:02:12 -0700 |
|---|---|---|
| committer | Paul Eggert | 2017-11-02 21:02:12 -0700 |
| commit | aa7542467238b06ed056054965ba444595b85453 (patch) | |
| tree | 3071c15ff777ef5727ccd254d9ddbf513a06c0cc /lib | |
| parent | 5fcfdf433d74e8ecb35f86fdc071ce11ca0b0364 (diff) | |
| parent | a87ce5c4b41ca8146c764b1186a6162c069b1933 (diff) | |
| download | emacs-aa7542467238b06ed056054965ba444595b85453.tar.gz emacs-aa7542467238b06ed056054965ba444595b85453.zip | |
Merge from origin/emacs-26
a87ce5c4b4 * src/lisp.h (GCALIGNED): Clarify comment (Bug#29040).
8a31e9993f ; etc/NEWS: Add cpp-message-min-time-interval. (Bug#28961)
ac0bb9a192 Improve the doc of eshell-cmpl-* custom variables (Bug#25069)
36400c7dc9 Fix mouse-scrollbar offset on GNUstep and old macOS (bug#2...
04bc1410c2 Merge from Gnulib
6b08ad5263 Fix alignment portability problems
a9f8706fa8 Fix completion of colon after CSS property (Bug#29056)
9031dec527 ; * src/alloc.c (sweep_symbols): Fix last change.
fdd3dcfa4e * src/alloc.c (sweep_symbols): Tweak last change
27964af438 In frame parameters documentation mention desktop saving/r...
1bd4e7c243 ; Fix typo in ChangeLog.3
4182a60d31 Don't have frameset save the 'client' parameter (Bug#29067)
9d31a97092 ; Spelling fixes
460a25f212 Handle generic variables in cl-defgeneric Edebug spec
dc0a25c2f9 Give a more sensible message if file-attributes fails (Bug...
8453423c7c Avoid wrong value from file-attributes on Linux kernel bef...
70621e2571 Fix customization of debugger-print-function (Bug#29077)
# Conflicts:
# etc/NEWS
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/timespec.h | 22 | ||||
| -rw-r--r-- | lib/unistd.in.h | 5 |
2 files changed, 17 insertions, 10 deletions
diff --git a/lib/timespec.h b/lib/timespec.h index 3831301578e..cc34067374f 100644 --- a/lib/timespec.h +++ b/lib/timespec.h | |||
| @@ -33,6 +33,8 @@ _GL_INLINE_HEADER_BEGIN | |||
| 33 | extern "C" { | 33 | extern "C" { |
| 34 | #endif | 34 | #endif |
| 35 | 35 | ||
| 36 | #include "verify.h" | ||
| 37 | |||
| 36 | /* Resolution of timespec timestamps (in units per second), and log | 38 | /* Resolution of timespec timestamps (in units per second), and log |
| 37 | base 10 of the resolution. */ | 39 | base 10 of the resolution. */ |
| 38 | 40 | ||
| @@ -67,23 +69,29 @@ make_timespec (time_t s, long int ns) | |||
| 67 | any platform of interest to the GNU project, since all such | 69 | any platform of interest to the GNU project, since all such |
| 68 | platforms have 32-bit int or wider. | 70 | platforms have 32-bit int or wider. |
| 69 | 71 | ||
| 70 | Replacing "(int) (a.tv_nsec - b.tv_nsec)" with something like | 72 | Replacing "a.tv_nsec - b.tv_nsec" with something like |
| 71 | "a.tv_nsec < b.tv_nsec ? -1 : a.tv_nsec > b.tv_nsec" would cause | 73 | "a.tv_nsec < b.tv_nsec ? -1 : a.tv_nsec > b.tv_nsec" would cause |
| 72 | this function to work in some cases where the above assumption is | 74 | this function to work in some cases where the above assumption is |
| 73 | violated, but not in all cases (e.g., a.tv_sec==1, a.tv_nsec==-2, | 75 | violated, but not in all cases (e.g., a.tv_sec==1, a.tv_nsec==-2, |
| 74 | b.tv_sec==0, b.tv_nsec==999999999) and is arguably not worth the | 76 | b.tv_sec==0, b.tv_nsec==999999999) and is arguably not worth the |
| 75 | extra instructions. Using a subtraction has the advantage of | 77 | extra instructions. Using a subtraction has the advantage of |
| 76 | detecting some invalid cases on platforms that detect integer | 78 | detecting some invalid cases on platforms that detect integer |
| 77 | overflow. | 79 | overflow. */ |
| 78 | |||
| 79 | The (int) cast avoids a gcc -Wconversion warning. */ | ||
| 80 | 80 | ||
| 81 | _GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE | 81 | _GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE |
| 82 | timespec_cmp (struct timespec a, struct timespec b) | 82 | timespec_cmp (struct timespec a, struct timespec b) |
| 83 | { | 83 | { |
| 84 | return (a.tv_sec < b.tv_sec ? -1 | 84 | if (a.tv_sec < b.tv_sec) |
| 85 | : a.tv_sec > b.tv_sec ? 1 | 85 | return -1; |
| 86 | : (int) (a.tv_nsec - b.tv_nsec)); | 86 | if (a.tv_sec > b.tv_sec) |
| 87 | return 1; | ||
| 88 | |||
| 89 | /* Pacify gcc -Wstrict-overflow (bleeding-edge circa 2017-10-02). See: | ||
| 90 | http://lists.gnu.org/archive/html/bug-gnulib/2017-10/msg00006.html */ | ||
| 91 | assume (-1 <= a.tv_nsec && a.tv_nsec <= 2 * TIMESPEC_RESOLUTION); | ||
| 92 | assume (-1 <= b.tv_nsec && b.tv_nsec <= 2 * TIMESPEC_RESOLUTION); | ||
| 93 | |||
| 94 | return a.tv_nsec - b.tv_nsec; | ||
| 87 | } | 95 | } |
| 88 | 96 | ||
| 89 | /* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be | 97 | /* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be |
diff --git a/lib/unistd.in.h b/lib/unistd.in.h index c1dd07ff8cd..ca8090a3526 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h | |||
| @@ -134,9 +134,8 @@ | |||
| 134 | /* The definition of _GL_WARN_ON_USE is copied here. */ | 134 | /* The definition of _GL_WARN_ON_USE is copied here. */ |
| 135 | 135 | ||
| 136 | 136 | ||
| 137 | /* Get getopt(), optarg, optind, opterr, optopt. | 137 | /* Get getopt(), optarg, optind, opterr, optopt. */ |
| 138 | But avoid namespace pollution on glibc systems. */ | 138 | #if @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT |
| 139 | #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT | ||
| 140 | # include <getopt-cdefs.h> | 139 | # include <getopt-cdefs.h> |
| 141 | # include <getopt-pfx-core.h> | 140 | # include <getopt-pfx-core.h> |
| 142 | #endif | 141 | #endif |