Re: patch: signed char issues

From: Russell King (rmk@arm.linux.org.uk)
Date: Mon Apr 24 2000 - 12:27:17 EST


Philip Blundell writes:
> GCC already warns about comparison between an unsigned type and a negative
> constant. It also has the capability to warn about any comparison between a
> signed type and an unsigned one, though I don't think this is used by default
> when building the kernel because it generates a lot of noise.
>
> There doesn't seem to be any warning for assignment of a negative value to an
> unsigned variable, though I don't imagine it would be hard to add.

Maybe it does need to be a generic type, but I was meaning a trap for code
written specifically without "unsigned" or "signed" before the "char" and with
a negative assignment or comparison.

This would certainly allow the most common cases to be trapped, both in the
kernel and in buggy getopt() uses in userland.

Any suggestions for a new -W flag name for this?
   _____
  |_____| ------------------------------------------------- ---+---+-
  | | Russell King rmk@arm.linux.org.uk --- ---
  | | | | http://www.arm.linux.org.uk/~rmk/aboutme.html / / |
  | +-+-+ --- -+-
  / | THE developer of ARM Linux |+| /|\
 / | | | --- |
    +-+-+ ------------------------------------------------- /\\\ |

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Apr 30 2000 - 21:00:08 EST