Remove (un)likely from the kernel interface (XCC)
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 20 Oct 2015 19:53:55 +0000 (15:53 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 28 Oct 2015 16:05:14 +0000 (12:05 -0400)
Unfortunately, some user libraries out there also #define likely and
unlikely, and those include both ros/common.h and parlib/common.h.
Since we're not using likely/unlikely as part of the kernel interface, I
don't mind moving it out of ros/.  But it's more unfortunate that we
can't put it in a parlib header too.

Reinstall your kernel headers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/include/common.h
kern/include/compiler.h [new file with mode: 0644]
kern/include/ros/common.h
kern/include/ros/compiler.h [deleted file]
user/vmm/include/virtio.h

index e156f9d..5791f3a 100644 (file)
@@ -2,6 +2,7 @@
 #define ROS_KERN_COMMON_H
 
 #include <ros/common.h>
+#include <compiler.h>
 
 /* Force a rebuild of the whole kernel if 64BIT-ness changed */
 #ifdef CONFIG_64BIT
diff --git a/kern/include/compiler.h b/kern/include/compiler.h
new file mode 100644 (file)
index 0000000..4f06112
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef ROS_KERN_COMPILER_H
+#define ROS_KERN_COMPILER_H
+
+#ifdef __GNUC__
+
+#define likely(x) __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+
+#else /* #ifdef __GNUC__ */
+
+#define likely(x) (x)
+#define unlikely(x) (x)
+
+#endif /* #ifdef __GNUC__ */
+
+#endif /* ROS_KERN_COMPILER_H */
index 6979967..a09213c 100644 (file)
@@ -7,7 +7,6 @@
 #include <stdint.h>
 #include <sys/types.h>
 #include <stdbool.h>
-#include <ros/compiler.h>
 
 typedef uintptr_t physaddr_t;
 typedef long intreg_t;
diff --git a/kern/include/ros/compiler.h b/kern/include/ros/compiler.h
deleted file mode 100644 (file)
index 4f06112..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef ROS_KERN_COMPILER_H
-#define ROS_KERN_COMPILER_H
-
-#ifdef __GNUC__
-
-#define likely(x) __builtin_expect(!!(x), 1)
-#define unlikely(x) __builtin_expect(!!(x), 0)
-
-#else /* #ifdef __GNUC__ */
-
-#define likely(x) (x)
-#define unlikely(x) (x)
-
-#endif /* #ifdef __GNUC__ */
-
-#endif /* ROS_KERN_COMPILER_H */
index b6bdd50..21a6c02 100644 (file)
@@ -17,6 +17,7 @@ struct scatterlist {
        int length;
 };
 
+#define unlikely(x) (x)
 #define virtio_rmb(x) rmb()
 #define virtio_wmb(x) wmb()
 #define virtio_mb(x) mb()