include/fix_u32.h: try harder to not cause redefinition errors
authorDenys Vlasenko <vda.linux@googlemail.com>
Tue, 16 Mar 2010 00:22:35 +0000 (01:22 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 16 Mar 2010 00:22:35 +0000 (01:22 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
include/fix_u32.h

index 5652e9e48de84e10aa25387b6a4c9653a1d95375..c26e5d1922f34a1ac343ab222b8bb7ab8d26980e 100644 (file)
@@ -8,6 +8,17 @@
 #ifndef FIX_U32_H
 #define FIX_U32_H 1
 
+/* Try hard to pull in u32 types and such.
+ * Otherwise, #include "fix_u32.h" + #include <linux/foo.h>
+ * may end up typedef'ing bb_hack_u32 inside foo.h,
+ * and repeated typedefs aren't allowed in C/C++.
+ */
+#include <asm/types.h>
+#include <linux/types.h>
+
+/* In case above includes still failed to provide the types,
+ * provide them ourself
+ */
 #undef __u64
 #undef u64
 #undef u32
 #undef s8
 
 #define __u64 bb_hack___u64
-#define u64 bb_hack_u64
-#define u32 bb_hack_u32
-#define u16 bb_hack_u16
-#define u8  bb_hack_u8
+#define u64   bb_hack_u64
+#define u32   bb_hack_u32
+#define u16   bb_hack_u16
+#define u8    bb_hack_u8
 #define __s64 bb_hack___s64
-#define s64 bb_hack_s64
-#define s32 bb_hack_s32
-#define s16 bb_hack_s16
-#define s8  bb_hack_s8
+#define s64   bb_hack_s64
+#define s32   bb_hack_s32
+#define s16   bb_hack_s16
+#define s8    bb_hack_s8
 
 typedef uint64_t __u64;
 typedef uint64_t u64;