On Wednesday 03 February 2010, Bronislav Gabrhelik wrote:
> I am getting the error: array subscript has type `char' while
> compiling openocd-0.4.0-rc1. The platform is cygwin gcc v 4.3.4. Doe's
> anyone use this version of gcc?

I use that version from the latest cygwin, to do test builds.

And I just made one ... worked fine.  Are you maybe not using
the current code from the git repository?


> The problem is with functions like tolower() toupper() ischar(),
> etc... I had to typecast an argument to (unsigned char) to get rid of
> this error. After changing the third file I gave up and solved problem
> by adding  -Wno-char-subscripts into config.in and config as I don't
> know how to generate config from config.in.

That error is a bit bothersome to me ... someone appears to
have gone to some real effort to make that break.  Normally,
a char (signed or unsigned) would automatically be promoted
to an integer, generating no warnings.

My guess is that somebody observed that confusion between
signed and unsigned characters is common, and could cause
problems in various situations if negative indices are used
with pointers where they won't work.  (Problem == various
flavors of memory access error, including "wrong address";
or maybe data corruption for write accesses.)

Nonetheless, what I've done when I see that in test builds
is to just cast the parameter to "int" (restoring standard
behavior).

- Dave
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to