aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xalloc-oversized.h
diff options
context:
space:
mode:
authorPaul Eggert2017-01-10 07:48:37 -0800
committerPaul Eggert2017-01-10 07:49:55 -0800
commitfa0a2b4e7c81f57aecc1d94df00588a4dd5c281d (patch)
tree31408852501056452a337677c8f5b80fd3c24e7c /lib/xalloc-oversized.h
parent560a384038845e37228226313eccfc8d70132553 (diff)
downloademacs-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/xalloc-oversized.h')
-rw-r--r--lib/xalloc-oversized.h12
1 files changed, 2 insertions, 10 deletions
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) \