Message ID | CAB0OVGrQ3YEogpjy=V4=UbY4dfwpqZLEuzpUAGQx6vFed5+NEg@mail.gmail.com |
---|---|
State | Superseded |
Headers | show |
On Fri, May 05, 2017 at 09:26:05AM +0200, Carl Eugen Hoyos wrote: > 2017-05-05 3:12 GMT+02:00 Aaron Levinson <alevinsn@aracnet.com>: > > On 5/4/2017 4:32 PM, Carl Eugen Hoyos wrote: > >> Hi! > >> > >> It may be better to disable the warning. > >> > >> Carl Eugen > >> > >> - num = den ? num * intnum / den : (num * intnum ? INFINITY : NAN); > >> + num = den ? num * intnum / den : (num && intnum ? INFINITY : NAN); > > > > In order to preserve the original logic, why not do the following: > > > > + num = den ? num * intnum / den : (((num * intnum) != 0) ? INFINITY : NAN); > > Simpler patch attached. > > Carl Eugen > configure | 1 + > 1 file changed, 1 insertion(+) > 06cf250153c05fb3392bd88c4a88f8fa056c26f2 0001-configure-Silence-a-less-useful-warning.patch > From 65811b8d63aee1bb02dc3d379bfba74b72524e67 Mon Sep 17 00:00:00 2001 > From: Carl Eugen Hoyos <cehoyos@ag.or.at> > Date: Fri, 5 May 2017 09:24:28 +0200 > Subject: [PATCH] configure: Silence a less useful warning. > > Silences the following warning: > warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context] > --- > configure | 1 + > 1 file changed, 1 insertion(+) probably ok [...]
On 05.05.2017 09:26, Carl Eugen Hoyos wrote: > 2017-05-05 3:12 GMT+02:00 Aaron Levinson <alevinsn@aracnet.com>: >> On 5/4/2017 4:32 PM, Carl Eugen Hoyos wrote: >>> Hi! >>> >>> It may be better to disable the warning. >>> >>> Carl Eugen >>> >>> - num = den ? num * intnum / den : (num * intnum ? INFINITY : NAN); >>> + num = den ? num * intnum / den : (num && intnum ? INFINITY : NAN); >> >> In order to preserve the original logic, why not do the following: >> >> + num = den ? num * intnum / den : (((num * intnum) != 0) ? INFINITY : NAN); > > Simpler patch attached. The GCC warning is not that bad, IMHO both proposed code alternatives are more readable than the original line. Just my 2c. Tobias
From 65811b8d63aee1bb02dc3d379bfba74b72524e67 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos <cehoyos@ag.or.at> Date: Fri, 5 May 2017 09:24:28 +0200 Subject: [PATCH] configure: Silence a less useful warning. Silences the following warning: warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context] --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 804b0ce..bb969f0 100755 --- a/configure +++ b/configure @@ -6116,6 +6116,7 @@ check_cflags -Wmissing-prototypes check_cflags -Wno-pointer-to-int-cast check_cflags -Wstrict-prototypes check_cflags -Wempty-body +check_cflags -Wno-int-in-bool-context if enabled extra_warnings; then check_cflags -Wcast-qual -- 1.7.10.4