clang: & precedence

Thomas Klausner wiz at NetBSD.org
Sat Nov 30 22:25:52 UTC 2013


Hi Torbjorn, Niels!

I got two conflicting answers here.

On Sat, Nov 30, 2013 at 12:15:33PM +0100, Torbjorn Granlund wrote:
> Fix clang to accept C, or suppress flags that makes it only accept a
> subset of the C language?

As I understand it, these warnings' intention is to not assume that C
programmers know precedence by heart, not to claim that it's
ill-defined. Combining that with -Werror is perhaps a bad idea, you're
probably right there.

(The tone of the answer doesn't make me want to work on gmp though.)

On Sat, Nov 30, 2013 at 01:04:07PM +0100, Niels Möller wrote:
> To me, adding parenthesis seems ok. I have difficulty remembering
> precedence for all operators, and I tend to use extra parentheses
> everywhere gcc -Wall suggests it.

This sounds more welcoming :)

Btw, there is a bug in the BINVERT_15 definition in
http://hg.gmplib.org:8000/gmp/file/a47cb5fc9aab/mpn/generic/toom_interpolate_7pts.c
it has a closing parenthesis too many at the end.

36 ((((GMP_NUMB_MAX >> (GMP_NUMB_BITS % 4)) / 15) * 14 * 16 & GMP_NUMB_MAX) + 15))

should be

36 ((((GMP_NUMB_MAX >> (GMP_NUMB_BITS % 4)) / 15) * 14 * 16 & GMP_NUMB_MAX) + 15)

(This was reported by Henning Petersen in NetBSD PR 48419.)

Cheers,
 Thomas


More information about the gmp-bugs mailing list