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

David Chisnall theraven at FreeBSD.org
Tue Oct 22 08:47:25 UTC 2013


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)
> @@ -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);



More information about the freebsd-current mailing list