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
[-- Attachment #1 --]
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:
>
> 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 >= 'A' && *arg <= 'Z' || *arg >= 'a' && *arg <=
> 'z')
> ~~~~~~~~~~~~^~~~~~~~~~~~~~ ~~
>
>
Heh, Matthew suggested the obvious in private mail, it seems that this
would be better "spelled" as "isalpha" :-)
Index: contrib/gperf/src/options.cc
===================================================================
--- contrib/gperf/src/options.cc (revision 256865)
+++ contrib/gperf/src/options.cc (working copy)
@@ -281,7 +281,7 @@
{
putchar (*arg);
arg++;
- if (*arg >= 'A' && *arg <= 'Z' || *arg >= 'a' && *arg <= 'z')
+ if (isalpha(*arg))
{
putchar (*arg);
arg++;
@@ -293,7 +293,7 @@
putchar (*arg);
arg++;
}
- while (*arg >= 'A' && *arg <= 'Z' || *arg >= 'a' && *arg
<= 'z' || *arg == '-');
+ while (isalpha(*arg) || *arg == '-');
if (*arg == '=')
{
putchar (*arg);
[-- Attachment #2 --]
-----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-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1382399026.7749.3.camel>
