Date: Mon, 21 Oct 2013 19:43:46 -0400 From: Sean Bruno <sean_bruno@yahoo.com> To: "freebsd-current@freebsd.org" <freebsd-current@freebsd.org> Cc: Matthew Fleming <mdf@FreeBSD.org> Subject: Re: gperf/src/options.cc -- quiesce clang warnings -Wlogical-op-parentheses Message-ID: <1382399026.7749.3.camel@localhost> In-Reply-To: <1382327452.2610.5.camel@localhost> References: <1382327452.2610.5.camel@localhost>
next in thread | previous in thread | raw e-mail | index | archive | help
--=-y8zD7hF9XmcViC+R9qTH
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
On Sun, 2013-10-20 at 23:50 -0400, Sean Bruno wrote:
> gperf has some clang warnings that seem to be harmless, but annoying
> regarding some of the logical operations around detecting ascii chars:
>=20
> c++ -O2 -pipe -I/usr/obj/usr/src/tmp/legacy/usr/include -Wno-c
> ++11-extensions
> -I/usr/src/gnu/usr.bin/gperf/../../../contrib/gperf/lib
> -I/usr/src/gnu/usr.bin/g
> perf
> -c /usr/src/gnu/usr.bin/gperf/../../../contrib/gperf/src/options.cc
> /usr/src/gnu/usr.bin/gperf/../../../contrib/gperf/src/options.cc:284:27:
> warning: '&&' within '||' [-Wlogical-op-parentheses]
> if (*arg >=3D 'A' && *arg <=3D 'Z' || *arg >=3D 'a' && *arg <=
=3D
> 'z')
> ~~~~~~~~~~~~^~~~~~~~~~~~~~ ~~
>=20
>=20
Heh, Matthew suggested the obvious in private mail, it seems that this
would be better "spelled" as "isalpha" :-)
Index: contrib/gperf/src/options.cc
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- contrib/gperf/src/options.cc (revision 256865)
+++ contrib/gperf/src/options.cc (working copy)
@@ -281,7 +281,7 @@
{
putchar (*arg);
arg++;
- if (*arg >=3D 'A' && *arg <=3D 'Z' || *arg >=3D 'a' && *arg <=3D=
'z')
+ if (isalpha(*arg))
{
putchar (*arg);
arg++;
@@ -293,7 +293,7 @@
putchar (*arg);
arg++;
}
- while (*arg >=3D 'A' && *arg <=3D 'Z' || *arg >=3D 'a' && *a=
rg
<=3D 'z' || *arg =3D=3D '-');
+ while (isalpha(*arg) || *arg =3D=3D '-');
if (*arg =3D=3D '=3D')
{
putchar (*arg);
--=-y8zD7hF9XmcViC+R9qTH
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (FreeBSD)
iQEcBAABAgAGBQJSZbwyAAoJEBkJRdwI6BaHYwUH/3dNBq2V2ickWEu6bdJSJ8S+
wurz4zAX1plbWKgWPrbig6owFzEJ28D/3glzH9b1FQTqkQIOCXBY4e7YD6GG3K7x
MAC82ryrem5YzLp7y/IMv0H+Cwyv7qR9pkL4fHzq4/nxRaMAEJSslgDOvxGlu++5
WZHKuoqkrWfglcTgCe5N5KFVdtpXG50kQs7p2bRPmIDKGAYHPUc9h7QgnKIqt8Va
6ihGaJMXC1pkIXxxReoLNT7czSeKPMog6/wBSS6Shtl5b7jHQfd49WKNKPdjBIYt
QCGpCGSl3mqxdo1JvTnWvuq9gX2Jv2/uSbALDGwJTYiMPMeauNNq+XdaHPowqu0=
=ZVph
-----END PGP SIGNATURE-----
--=-y8zD7hF9XmcViC+R9qTH--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1382399026.7749.3.camel>
