summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--lib/intprops.h6
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 7fe978f4a8..4b752fb06c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2019-08-14 Paul Eggert <eggert@cs.ucla.edu>
+ intprops: pacify picky GCC
+ * lib/intprops.h (_GL_BUILTIN_MUL_OVERFLOW):
+ Pacify GCC’s complaints about ignoring __builtin_mul_overflow’s
+ possibly-incorrect result.
+ (_GL_INT_MULTIPLY_RANGE_OVERFLOW): Pacify GCC’s complaints
+ about (A) used as a boolean, when A is an expression like 3 * 4.
+
intprops: support unsigned *_WRAPV results
Add support for unsigned, unsigned long, and unsigned long long
results to INT_ADD_WRAPV, INT_SUBTRACT_WRAPV, and
diff --git a/lib/intprops.h b/lib/intprops.h
index 556cadec80..54012874df 100644
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -366,7 +366,7 @@
#define _GL_BUILTIN_MUL_OVERFLOW(a, b, r) \
((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && EXPR_SIGNED (a) && EXPR_SIGNED (b) \
&& _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \
- ? (__builtin_mul_overflow (a, b, r), 1) \
+ ? ((void) __builtin_mul_overflow (a, b, r), 1) \
: __builtin_mul_overflow (a, b, r))
/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See:
@@ -540,7 +540,9 @@
: (tmax) / -(b)) \
<= -1 - (a))) \
: INT_NEGATE_OVERFLOW (_GL_INT_CONVERT (b, tmin)) && (b) == -1 \
- ? (EXPR_SIGNED (a) ? 0 < (a) + (tmin) : (a) && -1 - (tmin) < (a) - 1) \
+ ? (EXPR_SIGNED (a) \
+ ? 0 < (a) + (tmin) \
+ : 0 < (a) && -1 - (tmin) < (a) - 1) \
: (tmin) / (b) < (a)) \
: (b) == 0 \
? 0 \