Commit 86392b7f authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

compiler: Add compiler noinline attribute and barrier helper

They are not needed at moment but will be needed at
parasite/restorer code rework time, so add them now
just to not forget.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Acked-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 0fe72423
...@@ -27,12 +27,18 @@ ...@@ -27,12 +27,18 @@
# define always_inline __always_inline # define always_inline __always_inline
#endif #endif
#ifndef noinline
# define noinline __attribute__((noinline))
#endif
#define __aligned(x) __attribute__((aligned(x))) #define __aligned(x) __attribute__((aligned(x)))
#ifndef offsetof #ifndef offsetof
# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) # define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif #endif
#define barrier() asm volatile("" ::: "memory")
#define container_of(ptr, type, member) ({ \ #define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );}) (type *)( (char *)__mptr - offsetof(type,member) );})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment