Re: small patch to suppress a warning

2021-02-16 Thread Niels Möller
Stephan Pleines  writes:

> So what is the verdict in this patch please?

Adding the pair of parentheses makes the code slightly more readable to
me. But it would still be nice if you could say what the warninsg
message to be suppressed is, and which compiler and version produces that
warning.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: small patch to suppress a warning

2021-02-16 Thread Stephan Pleines
So what is the verdict in this patch please?

On Thu, Feb 11, 2021 at 5:06 AM Hans Åberg  wrote:

>
> > On 11 Feb 2021, at 11:45, Torbjörn Granlund  wrote:
> >
> > I think there might be better places to discuss compiler warnings than
> > the gmp-bugs list.
> >
> > I think most of us agree that compiler warnings for valid C code are
> > sometimes useful.  For example, valid warnings about unitialised
> > variables seem pretty uncontroversial.
>
> Actually not, on Bison.
>
>
>
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: small patch to suppress a warning

2021-02-11 Thread Torbjörn Granlund
I think there might be better places to discuss compiler warnings than
the gmp-bugs list.

I think most of us agree that compiler warnings for valid C code are
sometimes useful.  For example, valid warnings about unitialised
variables seem pretty uncontroversial.

But please continue the discussion on clang's warning chattiness
elsewhere...

-- 
Torbjörn
Please encrypt, key id 0xC8601622
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: small patch to suppress a warning

2021-02-11 Thread Hans Åberg


> On 10 Feb 2021, at 23:55, Stephan Pleines  wrote:
> 
> Can you please elaborate why it is a compiler bug?

It is a legal C feature, so there should not be issued a warning.

___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: small patch to suppress a warning

2021-02-11 Thread Stephan Pleines
Can you please elaborate why it is a compiler bug?

On Wed, Feb 10, 2021 at 2:00 PM Hans Åberg  wrote:

> You do not say which compiler it is, but it looks like a clang bug.
>
>
> > On 10 Feb 2021, at 17:26, Stephan Pleines 
> wrote:
> >
> > Hi,
> >
> > This is a tiny patch to suppress a warning about operator precedence.
> >
> > Thank you,
> > Stephan
> >
> > diff -r 925753a1f950 mpz/pprime_p.c
> > --- a/mpz/pprime_p.cMon Dec 21 00:48:03 2020 +0100
> > +++ b/mpz/pprime_p.cWed Feb 10 08:21:36 2021 -0800
> > @@ -60,7 +60,7 @@
> >  int is_prime;
> >  unsigned long n0;
> >  n0 = mpz_get_ui (n);
> > - is_prime = n0 & (n0 > 1) ? isprime (n0) : n0 == 2;
> > + is_prime = (n0 & (n0 > 1)) ? isprime (n0) : n0 == 2;
> >  return is_prime ? 2 : 0;
> >}
> >   /* Negative number.  Negate and fall out.  */
> > ___
> > gmp-bugs mailing list
> > gmp-bugs@gmplib.org
> > https://gmplib.org/mailman/listinfo/gmp-bugs
>
>
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: small patch to suppress a warning

2021-02-11 Thread Hans Åberg
You do not say which compiler it is, but it looks like a clang bug.


> On 10 Feb 2021, at 17:26, Stephan Pleines  wrote:
> 
> Hi,
> 
> This is a tiny patch to suppress a warning about operator precedence.
> 
> Thank you,
> Stephan
> 
> diff -r 925753a1f950 mpz/pprime_p.c
> --- a/mpz/pprime_p.cMon Dec 21 00:48:03 2020 +0100
> +++ b/mpz/pprime_p.cWed Feb 10 08:21:36 2021 -0800
> @@ -60,7 +60,7 @@
>  int is_prime;
>  unsigned long n0;
>  n0 = mpz_get_ui (n);
> - is_prime = n0 & (n0 > 1) ? isprime (n0) : n0 == 2;
> + is_prime = (n0 & (n0 > 1)) ? isprime (n0) : n0 == 2;
>  return is_prime ? 2 : 0;
>}
>   /* Negative number.  Negate and fall out.  */
> ___
> gmp-bugs mailing list
> gmp-bugs@gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-bugs

___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs