summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2015-11-03 08:32:27 -0800
committerJim Meyering <meyering@fb.com>2015-11-03 09:03:05 -0800
commit24fb386f25ce0800577ac64f2d2303822e9e615c (patch)
treecfaf3d4917116c2259711580363feb2e0f6070e7
parent77d702067d8bf61f96f2c4ef451a09651b27628b (diff)
downloadgnulib-24fb386f25ce0800577ac64f2d2303822e9e615c.tar.gz
intprops: add parentheses for when OP has precedence lower than "-"
* lib/intprops.h (_GL_INT_OP_WRAPV_VIA_UNSIGNED): In "a OP b - c", "a OP b" must be parenthesized for when OP is like "<<", which has lower precedence than the following "-". Reported by Pádraig Brady.
-rw-r--r--ChangeLog7
-rw-r--r--lib/intprops.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 81c5391abc..df3829d57d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-11-03 Jim Meyering <meyering@fb.com>
+
+ intprops: add parentheses for when OP has precedence lower than "-"
+ * lib/intprops.h (_GL_INT_OP_WRAPV_VIA_UNSIGNED): In "a OP b - c",
+ "a OP b" must be parenthesized for when OP is like "<<", which has
+ lower precedence than the following "-". Reported by Pádraig Brady.
+
2015-11-03 Pádraig Brady <P@draigBrady.com>
quotearg: constify get_quoting_style parameters
diff --git a/lib/intprops.h b/lib/intprops.h
index 4441f1c294..b561f14dd7 100644
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -401,7 +401,7 @@
#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, t) \
((unsigned t) (a) op (unsigned t) (b) <= TYPE_MAXIMUM (t) \
? (t) ((unsigned t) (a) op (unsigned t) (b)) \
- : ((t) ((unsigned t) (a) op (unsigned t) (b) - TYPE_MINIMUM (t)) \
+ : ((t) (((unsigned t) (a) op (unsigned t) (b)) - TYPE_MINIMUM (t)) \
+ TYPE_MINIMUM (t)))
/* Calls to the INT_<op>_<result> macros are like their INT_CONST_<op>_<result>