Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Oct 2013 09:47:11 +0100
From:      David Chisnall <theraven@FreeBSD.org>
To:        sbruno@FreeBSD.org
Cc:        Matthew Fleming <mdf@FreeBSD.org>, "freebsd-current@freebsd.org" <freebsd-current@FreeBSD.org>
Subject:   Re: gperf/src/options.cc -- quiesce clang warnings -Wlogical-op-parentheses
Message-ID:  <0744E30D-89EF-4340-A7DC-968AC27F302B@FreeBSD.org>
In-Reply-To: <1382399026.7749.3.camel@localhost>
References:  <1382327452.2610.5.camel@localhost> <1382399026.7749.3.camel@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
On 22 Oct 2013, at 00:43, Sean Bruno <sean_bruno@yahoo.com> wrote:

> Heh, Matthew suggested the obvious in private mail, it seems that this
> would be better "spelled" as "isalpha" :-)

This looks wrong.  The behaviour of isalpha() depends on the current =
locale.  You probably want isalpha_l(), with the "C" locale.

David

> 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' =
&& *arg
> <=3D 'z' || *arg =3D=3D '-');
> +              while (isalpha(*arg) || *arg =3D=3D '-');
>               if (*arg =3D=3D '=3D')
>                 {
>                   putchar (*arg);




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0744E30D-89EF-4340-A7DC-968AC27F302B>