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>

index | next in thread | raw e-mail

[-- Attachment #1 --]
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')
              ~~~~~~~~~~~~^~~~~~~~~~~~~~ ~~


I propose the following change:

Index: options.cc
===================================================================
--- options.cc  (revision 256712)
+++ options.cc  (working copy)
@@ -281,7 +281,7 @@
         {
           putchar (*arg);
           arg++;
-          if (*arg >= 'A' && *arg <= 'Z' || *arg >= 'a' && *arg <= 'z')
+          if ( (*arg >= 'A' && *arg <= 'Z') || (*arg >= 'a' && *arg <=
'z') )
             {
               putchar (*arg);
               arg++;
@@ -293,7 +293,9 @@
                   putchar (*arg);
                   arg++;
                 }
-              while (*arg >= 'A' && *arg <= 'Z' || *arg >= 'a' && *arg
<= 'z' || *arg == '-');
+              while ( (*arg >= 'A' && *arg <= 'Z') ||
+                     (*arg >= 'a' && *arg <= 'z') ||
+                     (*arg == '-') );
               if (*arg == '=')
                 {
                   putchar (*arg);


[-- Attachment #2 --]
-----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-----
help

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