+2016-08-29 Paul Eggert <eggert@cs.ucla.edu>
+
+ intprops.h: use __typeof__ with GCC 7
+ * lib/intprops.h (_GL_ADD_OVERFLOW, _GL_SUBTRACT_OVERFLOW)
+ (_GL_MULTIPLY_OVERFLOW): Use __typeof__ as in the GCC manual.
+ This avoids computing the expression's value (which might overflow!).
+
2016-08-29 Jim Meyering <meyering@fb.com>
intprops.h, xalloc-oversized.h: work with gcc 7
that the result (e.g., A + B) has that type. */
#if _GL_HAS_BUILTIN_OVERFLOW_P
# define _GL_ADD_OVERFLOW(a, b, min, max) \
- __builtin_add_overflow_p (a, b, (a) + (b))
+ __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0)
# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \
- __builtin_sub_overflow_p (a, b, (a) - (b))
+ __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0)
# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \
- __builtin_mul_overflow_p (a, b, (a) * (b))
+ __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0)
#elif _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL
# define _GL_ADD_OVERFLOW(a, b, min, max) \
__builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0)