mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	David Howells <dhowells@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] swab: fix sparse warnings
Date: Tue, 30 Jul 2013 15:02:59 -0700	[thread overview]
Message-ID: <20130730150259.71b22fd0@nehalam.linuxnetplumber.net> (raw)

There are a lot of sparse warnings in networking code where a constant
ends up being byte swapped caused because there is no explicit
prototype for the __builtin_bswap functions.  Simplest workaround
is to just avoid them here, and use the normal swap routines when
doing sparse checks.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

--- a/include/uapi/linux/swab.h	2013-05-11 15:58:53.844321915 -0700
+++ b/include/uapi/linux/swab.h	2013-07-30 14:49:22.066773449 -0700
@@ -45,7 +45,7 @@
 
 static inline __attribute_const__ __u16 __fswab16(__u16 val)
 {
-#ifdef __HAVE_BUILTIN_BSWAP16__
+#if defined(__HAVE_BUILTIN_BSWAP16__) && !defined(__CHECKER__)
 	return __builtin_bswap16(val);
 #elif defined (__arch_swab16)
 	return __arch_swab16(val);
@@ -56,7 +56,7 @@ static inline __attribute_const__ __u16
 
 static inline __attribute_const__ __u32 __fswab32(__u32 val)
 {
-#ifdef __HAVE_BUILTIN_BSWAP32__
+#if defined(__HAVE_BUILTIN_BSWAP32__) && !defined(__CHECKER__)
 	return __builtin_bswap32(val);
 #elif defined(__arch_swab32)
 	return __arch_swab32(val);
@@ -67,7 +67,7 @@ static inline __attribute_const__ __u32
 
 static inline __attribute_const__ __u64 __fswab64(__u64 val)
 {
-#ifdef __HAVE_BUILTIN_BSWAP64__
+#if defined(__HAVE_BUILTIN_BSWAP64__) && !defined(__CHECKER__)
 	return __builtin_bswap64(val);
 #elif defined (__arch_swab64)
 	return __arch_swab64(val);

                 reply	other threads:[~2013-07-30 22:03 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=20130730150259.71b22fd0@nehalam.linuxnetplumber.net \
    --to=stephen@networkplumber.org \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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®