Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Oct 2013 23:50:52 -0400
From:      Sean Bruno <sean_bruno@yahoo.com>
To:        "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>
Subject:   gperf/src/options.cc -- quiesce clang warnings -Wlogical-op-parentheses
Message-ID:  <1382327452.2610.5.camel@localhost>

next in thread | raw e-mail | index | archive | help

--=-cv+ODW3SEIWT6pW48P+B
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

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 >=3D 'A' && *arg <=3D 'Z' || *arg >=3D 'a' && *arg <=3D =
'z')
              ~~~~~~~~~~~~^~~~~~~~~~~~~~ ~~


I propose the following change:

Index: 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
--- options.cc  (revision 256712)
+++ 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 ( (*arg >=3D 'A' && *arg <=3D 'Z') || (*arg >=3D 'a' && *arg =
<=3D
'z') )
             {
               putchar (*arg);
               arg++;
@@ -293,7 +293,9 @@
                   putchar (*arg);
                   arg++;
                 }
-              while (*arg >=3D 'A' && *arg <=3D 'Z' || *arg >=3D 'a' && *a=
rg
<=3D 'z' || *arg =3D=3D '-');
+              while ( (*arg >=3D 'A' && *arg <=3D 'Z') ||
+                     (*arg >=3D 'a' && *arg <=3D 'z') ||
+                     (*arg =3D=3D '-') );
               if (*arg =3D=3D '=3D')
                 {
                   putchar (*arg);


--=-cv+ODW3SEIWT6pW48P+B
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)

iQEcBAABAgAGBQJSZKScAAoJEBkJRdwI6BaHEUQH/ipu5CM3zVkaZ4G+gYn3aavo
K4aa7iyKNU1LVlEF2tOyci7vUufKeAAmDqyo1YWNrKVB83/rXs3OEhIFErogLUVW
HgpsSzuFZmzy+CX07nI3BtvzDpkmxefUNvlMgvS9Qjbue0gzD3Fkfnqj2oW3jkIh
HkEY41firfx7lvN8DzhRl03eWfoz//Tq4yUB4cg3TDsL/rVbNKQC+TMbNzn1hWks
W/653GXNNLgs7Le5djL8crNAQJCgs2t/zDskI5HFMSYuoFxcoH3Izi7cx3McY4WI
9XyzZ9Ytj4ghlI+y2A7sAFYoxRy5N8GeUyEUE/Ks1FLxPRzNcs5n4JoggwrdTR8=
=xCRV
-----END PGP SIGNATURE-----

--=-cv+ODW3SEIWT6pW48P+B--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1382327452.2610.5.camel>