diff options
author | Alex Wang <alexw@nicira.com> | 2013-07-22 15:47:19 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2013-07-23 12:34:41 -0700 |
commit | db5a101931c5393d5f9df600559882418d536878 (patch) | |
tree | 3e2820c844a3f20209736adad31ddfaa1b0f5e13 /lib/util.h | |
parent | 550f0db4e0fb3bf9952e8a88b71242491b9dde2a (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.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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 |