Skip to contentSkip to conversation

sparse warnings in string.h

DISCUSSION Steve French 1 participant 1 message Dec 1, 2004

lore
Share & tools
lore
#0 lore raw

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.