[ovs-dev] [PATCH] datapath: Fix sparse warning on BUILD_BUG_ON_INVALID()

Andy Zhou azhou at nicira.com
Sat Dec 21 00:25:51 UTC 2013


Sparse gives the following warnings when compile against Linux kernel
3.5:

 CHECK   /root/projs/ovs/openvswitch/datapath/linux/skbuff-openvswitch.c
 include/linux/mm.h:405:9: error: undefined identifier
 'BUILD_BUG_ON_INVALID'
 include/linux/mm.h:405:9: error: not a function <noident>

The same issues may exists on 3.6 as well.

Signed-off-by: Andy Zhou <azhou at nicira.com>
---
 datapath/linux/compat/include/linux/bug.h |   13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 datapath/linux/compat/include/linux/bug.h

diff --git a/datapath/linux/compat/include/linux/bug.h b/datapath/linux/compat/include/linux/bug.h
new file mode 100644
index 0000000..551f07f
--- /dev/null
+++ b/datapath/linux/compat/include/linux/bug.h
@@ -0,0 +1,13 @@
+#ifndef __LINUX_BUG_WRAPPER_H
+#define __LINUX_BUG_WRAPPER_H 1
+
+#include_next <linux/bug.h>
+
+#ifdef __CHECKER__
+#ifndef BUILD_BUG_ON_INVALID
+#define  BUILD_BUG_ON_INVALID(e) (0)
+#endif  
+
+#endif /* __CHECKER__ */
+
+#endif
-- 
1.7.9.5




More information about the dev mailing list