From: Mathieu Desnoyers Date: Fri, 18 Nov 2011 18:19:24 +0000 (-0500) Subject: Implement __rb_same_type X-Git-Tag: v1.9.1~73 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=0d4aa2df26584c00cdb504ff2b3d4a5fdd8f5f08;p=lttng-ust.git Implement __rb_same_type Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/core.h b/include/lttng/core.h index 0c483e88..2b962d5f 100644 --- a/include/lttng/core.h +++ b/include/lttng/core.h @@ -107,12 +107,4 @@ static inline unsigned int hweight32(unsigned int w) return (res + (res >> 16)) & 0x000000FF; } -#ifndef inline_memcpy -#define inline_memcpy memcpy -#endif - -#ifndef __same_type -#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) -#endif - #endif /* UST_CORE_H */ diff --git a/libringbuffer/backend_internal.h b/libringbuffer/backend_internal.h index dbe34fc1..c4fb7604 100644 --- a/libringbuffer/backend_internal.h +++ b/libringbuffer/backend_internal.h @@ -416,6 +416,10 @@ int update_read_sb_index(const struct lttng_ust_lib_ring_buffer_config *config, return 0; } +#ifndef inline_memcpy +#define inline_memcpy(dest, src, n) memcpy(dest, src, n) +#endif + /* * Use the architecture-specific memcpy implementation for constant-sized * inputs, but rely on an inline memcpy for length statically unknown. diff --git a/libringbuffer/frontend_types.h b/libringbuffer/frontend_types.h index 9c733d17..bccd5f85 100644 --- a/libringbuffer/frontend_types.h +++ b/libringbuffer/frontend_types.h @@ -119,6 +119,10 @@ void *channel_get_private(struct channel *chan) return ((char *) chan) + chan->priv_data_offset; } +#ifndef __rb_same_type +#define __rb_same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) +#endif + /* * Issue warnings and disable channels upon internal error. * Can receive struct lttng_ust_lib_ring_buffer or struct lttng_ust_lib_ring_buffer_backend @@ -129,11 +133,11 @@ void *channel_get_private(struct channel *chan) struct channel *__chan; \ int _____ret = caa_unlikely(cond); \ if (_____ret) { \ - if (__same_type(*(c), struct channel_backend)) \ + if (__rb_same_type(*(c), struct channel_backend)) \ __chan = caa_container_of((void *) (c), \ struct channel, \ backend); \ - else if (__same_type(*(c), struct channel)) \ + else if (__rb_same_type(*(c), struct channel)) \ __chan = (void *) (c); \ else \ BUG_ON(1); \