mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* sparse warnings in string.h
@ 2004-12-01  3:10 Steve French
  0 siblings, 0 replies; only message in thread
From: Steve French @ 2004-12-01  3:10 UTC (permalink / raw)
  To: linux-kernel

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-12-01  3:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-01  3:10 sparse warnings in string.h Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®