On Tue, Nov 3, 2015 at 5:26 AM, Pádraig Brady <p...@draigbrady.com> wrote: > FYI I just noticed this when compiling coreutils with GCC 5.1.1 > > test-intprops.c: In function 'main': > test-intprops.c:199:3: error: string length '5031' is greater than the length > '4095' ISO C99 compilers are required to support [-Werror=overlength-strings] > CHECK_BINOP (/, DIVIDE, INT_MIN, -1, int, > ^ > CC test-isatty.o > CC test-isblank.o > test-intprops.c:202:3: error: string length '4737' is greater than the length > '4095' ISO C99 compilers are required to support [-Werror=overlength-strings] > CHECK_BINOP (/, DIVIDE, (unsigned int) INT_MIN, -1u, unsigned int, > ^ > CC test-isnand-nolibm.o > In file included from test-intprops.c:28:0: > ../lib/intprops.h:357:60: error: suggest parentheses around '-' inside '<<' > [-Werror=parentheses] > #define INT_LEFT_SHIFT_WRAPV(a, b) _GL_INT_OP_WRAPV (a, b, <<)
I have fixed the latter with the attached, just-pushed patch:
From 24fb386f25ce0800577ac64f2d2303822e9e615c Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@fb.com> 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 <meyer...@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 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_<op>_<result> macros are like their INT_CONST_<op>_<result> -- 2.6.0