Move uninitialized_var() to compiler.h
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 2 Nov 2017 16:21:23 +0000 (12:21 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 16 Nov 2017 15:46:55 +0000 (10:46 -0500)
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/drivers/net/udrvr/compat.h
kern/include/compiler.h

index 4119a25..873879e 100644 (file)
@@ -129,7 +129,6 @@ void sg_free_table(struct sg_table *ptr);
 #define        __releases(x)
 #define        __acquire(x)                    (void)0
 #define        __release(x)                    (void)0
-#define uninitialized_var(x)           x = *(&(x))
 
 /* From include/asm-generic/bug.h: move to compat_todo.h */
 #define WARN_ON(condition) ({                                           \
index 5a3bfc2..0030b6f 100644 (file)
 #endif /* #ifdef __GNUC__ */
 
 #define __always_inline inline __attribute__((always_inline))
+
+#ifdef __GNUC__
+
+#define uninitialized_var(x) x = x
+
+#elif defined(__clang__)
+
+#define uninitialized_var(x) x = *(&(x))
+
+#endif