summaryrefslogtreecommitdiff
path: root/lib/xalloc-oversized.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-08-30 13:15:04 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2016-08-30 13:16:22 -0700
commit6cf3ee3d5474a61d6615a6a21d9e7723f7ba9151 (patch)
treed5cf44ee8f53d85a88fc9e8c355dfee252e9dfd8 /lib/xalloc-oversized.h
parent1145322a114bb7359fcfdbdce6ccb7d9d44c82ba (diff)
downloademacs-6cf3ee3d5474a61d6615a6a21d9e7723f7ba9151.tar.gz
Update from gnulib
This incorporates: 2016-08-30 intprops: tune INT_NEGATE_OVERFLOW for GCC 5 and 6 2016-08-29 xalloc-oversized.h: port change to GCC 6.2.0 2016-08-29 intprops.h: port recent changes to GCC 6.2.0 2016-08-29 intprops.h: use __typeof__ with GCC 7 2016-08-29 intprops.h, xalloc-oversized.h: work with gcc 7 2016-08-24 intprops: fix paren typo on old platforms 2016-08-24 intprops: port to OpenVMS * lib/intprops.h, 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 44f16441c79..53e6556c610 100644
--- a/lib/xalloc-oversized.h
+++ b/lib/xalloc-oversized.h
@@ -43,16 +43,8 @@
nonnegative. This is a macro, not a function, so that it
works correctly even when SIZE_MAX < N. */
-/* GCC 7 __builtin_mul_overflow should easily compute this. See:
- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68120 */
-#if 7 <= __GNUC__
-# define xalloc_oversized(n, s) __builtin_mul_overflow (n, s, (size_t *) NULL)
-
-/* GCC 5 and Clang __builtin_mul_overflow needs a temporary, and
- should be used only for non-constant operands, so that
- xalloc_oversized is a constant expression if both arguments are.
- Do not use this if pedantic, since pedantic GCC issues a diagnostic
- for ({ ... }). */
+#if 7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)
+# define xalloc_oversized(n, s) __builtin_mul_overflow_p (n, s, (size_t) 1)
#elif ((5 <= __GNUC__ \
|| (__has_builtin (__builtin_mul_overflow) \
&& __has_builtin (__builtin_constant_p))) \