This is the mail archive of the mailing list for the newlib project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add cast in ctype.h macro to avoid gcc -pedantic warning.

On Feb 20 10:32, Sam Clegg wrote:
> Hi newlib,
> A tiny patch to ctype.h.  I found that without this gcc will generate
> a 'array subscript has type âcharâ' warnings when run with -pedantic
> and -Wall.  I found this when compiling libssh which uses -pedandic
> and -pedantic-errors.

This warning has been created deliberatly years ago.  If you're really
pedantic about your code, you should fix it by making sure to cast
signed chars to unsigned char before giving them to the ctype functions.
That's the non-standard behaviour this warning message is supposed to
catch.  See, for instance

"The c argument is an *int*, the value of which the application shall
 ensure is representable as an *unsigned char* or equal to the value
 of the macro EOF. If the argument has any other value, the behavior
 is *undefined*."


Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: pgpCl7lpAKSD4.pgp
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]