[Piglit] [PATCH] shader_runner: Cast isspace inputs to int to silence warnings.

Eric Anholt eric at anholt.net
Tue Feb 21 10:48:36 PST 2012


On Mon, 20 Feb 2012 20:31:20 -0800, Kenneth Graunke <kenneth at whitecape.org> wrote:
> On 02/19/2012 10:45 PM, Vinson Lee wrote:
> > Fixes these GCC warnings on Cygwin.
> > shader_runner.c: In function ‘strcpy_to_space’:
> > shader_runner.c:202:2: warning: array subscript has type ‘char’
> > shader_runner.c: In function ‘eat_whitespace’:
> > shader_runner.c:216:2: warning: array subscript has type ‘char’
> > shader_runner.c: In function ‘eat_text’:
> > shader_runner.c:229:2: warning: array subscript has type ‘char’
> 
> These are really bizarre warnings.  We're not doing array subscripting 
> here at all.  We're calling isspace() on a char.
> 
> This is perfectly legal, idiomatic, and common practice.  Isn't the 
> whole point of isspace() and friends to tell you what class a 
> /character/ is in?  Yes, they're specified with ints, but people use 
> chars all the time.  They're supposed to be silently promoted.
> 
> IMO, if the Cygwin compiler can't handle isspace() on chars, it's 
> broken.  I would just turn off the warning.
> 
> My vote on this patch (and the asmparsertest one) would be 'no'.

This was my reaction as well.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20120221/fa5d2854/attachment.pgp>


More information about the Piglit mailing list