sparse warnings in string.h

From: Steve French
Date: Tue Nov 30 2004 - 22:08:26 EST


sparse generates warnings as follows:

include/asm/string.h:384:26: warning: cast truncates bits from constant
value (bdbdbdbd becomes bd)
include/asm/string.h:387:27: warning: cast truncates bits from constant
value (bdbdbdbd becomes bdbd)
include/asm/string.h:390:27: warning: cast truncates bits from constant
value (bdbdbdbd becomes bdbd)
include/asm/string.h:391:30: warning: cast truncates bits from constant
value (bdbdbdbd becomes bd)


on two of the cifs vfs C files because of include/asm/string.h due to
the the following case statement in the common include file:

static inline void * __constant_c_and_count_memset(void * s, unsigned
long pattern, size_t count)
{
switch (count) {
case 0:
return s;
case 1:
*(unsigned char *)s = pattern;
return s;
case 2:
*(unsigned short *)s = pattern;
return s;
case 3:
*(unsigned short *)s = pattern;
*(2+(unsigned char *)s) = pattern;


Any ideas of how to get around these sparse warnings (they are the only
ones that appear in my code)? I suspect that no one wants to modify
string.h to eliminate the warning because of the comments about compiler
optimization.

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