Skip to contentSkip to conversation

include/uapi/linux/swab.h: define a silent macro to avoid sparse error

PATCH In review Bilel DRIRA 2 participants 2 messages Jun 14, 2015 – Jun 15, 2015 ABI/API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 include/uapi/linux/swab.h: define a silent macro to avoid sparse error

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>

---
 include/uapi/linux/swab.h |   12 ++++++++++++
 1 file changed, 12 insertions(+)
include/uapi/linux/swab.h +12 -0
index 0e011eb..c04de49 100644
@@ -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.
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 23 lines · 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>

---
 include/uapi/linux/swab.h |   12 ++++++++++++
 1 file changed, 12 insertions(+)
include/uapi/linux/swab.h +1 -0
index 0e011eb..c04de49 100644
@@ -5,6 +5,18 @@
 #include <linux/compiler.h>
 #include <asm/swab.h>
 
+#ifdef __CHECKER__

include/uapi/linux/swab.h line 18

Quoted 10 lines
include/uapi/linux/swab.h +10 -0
+
+#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