Linux-api Archive mirror
 help / color / mirror / Atom feed
* [PATCH] include/uapi/linux/swab.h: define a silent macro to avoid sparse error
@ 2015-06-14 22:23 Bilel DRIRA
       [not found] ` <1434320613-28700-1-git-send-email-bilel.dr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Bilel DRIRA @ 2015-06-14 22:23 UTC (permalink / raw
  To: linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Bilel DRIRA

define a silent macro when _CHECKER_ is defined.
This change fixes the following sparse errors:

include/uapi/linux/swab.h:60:16: error: undefined identifier '__builtin_bswap32'
include/uapi/linux/swab.h:60:33: error: not a function <noident>
include/uapi/linux/swab.h:71:16: error: undefined identifier '__builtin_bswap64'
include/uapi/linux/swab.h:71:33: error: not a function <noident>
include/uapi/linux/swab.h:60:33: error: not a function <noident>

Signed-off-by: Bilel DRIRA <bilel.dr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 include/uapi/linux/swab.h |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/uapi/linux/swab.h b/include/uapi/linux/swab.h
index 0e011eb..c04de49 100644
--- a/include/uapi/linux/swab.h
+++ b/include/uapi/linux/swab.h
@@ -5,6 +5,18 @@
 #include <linux/compiler.h>
 #include <asm/swab.h>
 
+#ifdef __CHECKER__
+
+#ifdef __HAVE_BUILTIN_BSWAP64__
+#define __builtin_bswap64(val) (0)
+#endif
+
+#ifdef __HAVE_BUILTIN_BSWAP32__
+#define __builtin_bswap32(val) (0)
+#endif
+
+#endif	/* __CHECKER__ */
+
 /*
  * casts are necessary for constants, because we never know how for sure
  * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] include/uapi/linux/swab.h: define a silent macro to avoid sparse error
       [not found] ` <1434320613-28700-1-git-send-email-bilel.dr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-06-15 23:06   ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2015-06-15 23:06 UTC (permalink / raw
  To: Bilel DRIRA
  Cc: linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Sun, Jun 14, 2015 at 11:23:32PM +0100, Bilel DRIRA wrote:
> define a silent macro when _CHECKER_ is defined.
> This change fixes the following sparse errors:
> 
> include/uapi/linux/swab.h:60:16: error: undefined identifier '__builtin_bswap32'
> include/uapi/linux/swab.h:60:33: error: not a function <noident>
> include/uapi/linux/swab.h:71:16: error: undefined identifier '__builtin_bswap64'
> include/uapi/linux/swab.h:71:33: error: not a function <noident>
> include/uapi/linux/swab.h:60:33: error: not a function <noident>
> 
> Signed-off-by: Bilel DRIRA <bilel.dr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  include/uapi/linux/swab.h |   12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/uapi/linux/swab.h b/include/uapi/linux/swab.h
> index 0e011eb..c04de49 100644
> --- a/include/uapi/linux/swab.h
> +++ b/include/uapi/linux/swab.h
> @@ -5,6 +5,18 @@
>  #include <linux/compiler.h>
>  #include <asm/swab.h>
>  
> +#ifdef __CHECKER__
> +
> +#ifdef __HAVE_BUILTIN_BSWAP64__
> +#define __builtin_bswap64(val) (0)
> +#endif
> +
> +#ifdef __HAVE_BUILTIN_BSWAP32__
> +#define __builtin_bswap32(val) (0)
> +#endif
> +
> +#endif	/* __CHECKER__ */

Shouldn't the tool be fixed instead of papering over the issue with
random defines like this?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-15 23:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-14 22:23 [PATCH] include/uapi/linux/swab.h: define a silent macro to avoid sparse error Bilel DRIRA
     [not found] ` <1434320613-28700-1-git-send-email-bilel.dr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-15 23:06   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).