aboutsummaryrefslogtreecommitdiff
path: root/lib/util.h
diff options
context:
space:
mode:
authorAlex Wang <alexw@nicira.com>2013-07-22 15:47:19 -0700
committerBen Pfaff <blp@nicira.com>2013-07-23 12:34:41 -0700
commitdb5a101931c5393d5f9df600559882418d536878 (patch)
tree3e2820c844a3f20209736adad31ddfaa1b0f5e13 /lib/util.h
parent550f0db4e0fb3bf9952e8a88b71242491b9dde2a (diff)
clang: Fix the alignment warning.
This commit fixes the warning issued by 'clang' when pointer is casted to one with greater alignment. Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/util.h')
-rw-r--r--lib/util.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/util.h b/lib/util.h
index 911ad321..0db41be9 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -193,6 +193,10 @@ is_pow2(uintmax_t x)
#define ASSIGN_CONTAINER(OBJECT, POINTER, MEMBER) \
((OBJECT) = OBJECT_CONTAINING(POINTER, OBJECT, MEMBER), (void) 0)
+/* Given ATTR, and TYPE, cast the ATTR to TYPE by first casting ATTR to
+ * (void *). This is to suppress the alignment warning issued by clang. */
+#define ALIGNED_CAST(TYPE, ATTR) ((TYPE) (void *) (ATTR))
+
#ifdef __cplusplus
extern "C" {
#endif