mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steve French <smfrench@austin.rr.com>
To: linux-kernel@vger.kernel.org
Subject: sparse warnings in string.h
Date: Tue, 30 Nov 2004 21:10:01 -0600	[thread overview]
Message-ID: <1101870601.6580.16.camel@smfhome.smfdom> (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.


                 reply	other threads:[~2004-12-01  3:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1101870601.6580.16.camel@smfhome.smfdom \
    --to=smfrench@austin.rr.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®