From 24fb386f25ce0800577ac64f2d2303822e9e615c Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 3 Nov 2015 08:32:27 -0800 Subject: [PATCH] intprops: add parentheses for when OP has precedence lower than "-" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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. --- ChangeLog | 7 +++++++ lib/intprops.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 81c5391..df3829d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2015-11-03 Jim Meyering + + 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 quotearg: constify get_quoting_style parameters diff --git a/lib/intprops.h b/lib/intprops.h index 4441f1c..b561f14 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__ macros are like their INT_CONST__ -- 2.6.0