]> Savannah Git Hosting - gnulib.git/commitdiff
intprops: add parentheses for when OP has precedence lower than "-"
authorJim Meyering <meyering@fb.com>
Tue, 3 Nov 2015 16:32:27 +0000 (08:32 -0800)
committerJim Meyering <meyering@fb.com>
Tue, 3 Nov 2015 17:03:05 +0000 (09:03 -0800)
* 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
lib/intprops.h

index 81c5391abce9c0bbddc1d70812e3d95ea3256b6a..df3829d57dfe3c9d762b275d54fb93f1f2f9bd0e 100644 (file)
--- 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
index 4441f1c294e7215db3aabdcf76825016b9406781..b561f14dd72725843cd0a6721e5d283264318b93 100644 (file)
 #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>