Re: gperf/src/options.cc -- quiesce clang warnings -Wlogical-op-parentheses

From: David Chisnall <theraven_at_FreeBSD.org>
Date: Tue, 22 Oct 2013 09:47:11 +0100
On 22 Oct 2013, at 00:43, Sean Bruno <sean_bruno_at_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
> ===================================================================
> --- contrib/gperf/src/options.cc	(revision 256865)
> +++ contrib/gperf/src/options.cc	(working copy)
> _at__at_ -281,7 +281,7 _at__at_
>         {
>           putchar (*arg);
>           arg++;
> -          if (*arg >= 'A' && *arg <= 'Z' || *arg >= 'a' && *arg <= 'z')
> +          if (isalpha(*arg))
>             {
>               putchar (*arg);
>               arg++;
> _at__at_ -293,7 +293,7 _at__at_
>                   putchar (*arg);
>                   arg++;
>                 }
> -              while (*arg >= 'A' && *arg <= 'Z' || *arg >= 'a' && *arg
> <= 'z' || *arg == '-');
> +              while (isalpha(*arg) || *arg == '-');
>               if (*arg == '=')
>                 {
>                   putchar (*arg);
Received on Tue Oct 22 2013 - 06:47:25 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:43 UTC