bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Miscellaneous code readability improvements.


From: Joel E. Denny
Subject: Re: [PATCH] Miscellaneous code readability improvements.
Date: Thu, 27 Aug 2009 13:36:19 -0400 (EDT)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

Hi Eric.

On Thu, 27 Aug 2009, Eric Blake wrote:

> Joel E. Denny <jdenny <at> clemson.edu> writes:
> 
> >      char const *p = yytext + 1;
> > -    if (*p == ' ')
> > -      p = "` '";
> > +    char quoted_ws[] = "` '";
> > +    if (isspace (*p) && isprint (*p))
> 
> Oops.  Non-portable code, since an 8-bit signed char falls outside of the 
> valid 
> domain of is* (cygwin's headers catch this bug, and I have a pending bug 
> request asking glibc to warn in this case, too):
> 
> scan-gram.l: In function `gram_lex':
> scan-gram.l:621: warning: subscript has type `char'
> scan-gram.l:621: warning: subscript has type `char'
> 
> OK to apply this fix?

Thanks for catching the problem.  However, I'm a little confused.  My 
isspace man page says the argument is of type int.  It also says:

  These  functions  check  whether  c,  which  must  have the value of an
  unsigned char or EOF, falls into a certain character class according to
  the current locale.

Isn't EOF usually -1?  What type includes -1 and doesn't include signed 
char?

> From: Eric Blake <address@hidden>
> Date: Thu, 27 Aug 2009 10:56:53 -0600
> Subject: [PATCH] scan-gram: avoid portability trap with ctype usage.
> 
> * src/scan-gram.l (splice): Avoid compiler warning.

I would say the correct top-level construct is 
<SC_ESCAPED_STRING,SC_ESCAPED_CHARACTER> rather than splice.  git doesn't 
know how to read Flex specifications.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]