From e277c2f1bd825a33bf9d639ee9fbfd3ed36a49f1 Mon Sep 17 00:00:00 2001 From: compudj Date: Fri, 11 Nov 2005 20:07:50 +0000 Subject: [PATCH] force inlining git-svn-id: http://ltt.polymtl.ca/svn@1326 04897980-b3bd-0310-b5e0-8ef037075253 --- genevent-new/gentest.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/genevent-new/gentest.c b/genevent-new/gentest.c index ae71da72..f7dfca95 100644 --- a/genevent-new/gentest.c +++ b/genevent-new/gentest.c @@ -1,18 +1,23 @@ +#define __KERNEL__ + #include #include #include #include #include +#include + #define min(a,b) (((a)<(b))?a:b) #define max(a,b) (((a)>(b))?a:b) #define BUG_ON(a) assert(!(a)) +// Useful outsize __KERNEL__. Not used here because inline is already redefined. #define force_inline inline __attribute__((always_inline)) /* Calculate the offset needed to align the type */ -static force_inline unsigned int ltt_align(size_t align_drift, +static inline unsigned int ltt_align(size_t align_drift, size_t size_of_type) { size_t alignment = min(sizeof(void*), size_of_type); @@ -40,7 +45,7 @@ struct lttng_mystruct2 { }; -static force_inline size_t lttng_get_size_mystruct2( +static inline size_t lttng_get_size_mystruct2( struct lttng_mystruct2 * obj) { size_t size=0, locsize; @@ -56,7 +61,7 @@ static force_inline size_t lttng_get_size_mystruct2( return sizeof(struct lttng_mystruct2); } -static force_inline size_t lttng_get_alignment_mystruct2( +static inline size_t lttng_get_alignment_mystruct2( struct lttng_mystruct2 *obj) { size_t align=0, localign; @@ -70,7 +75,7 @@ static force_inline size_t lttng_get_alignment_mystruct2( return align; } -static force_inline void lttng_write_mystruct2( +static inline void lttng_write_mystruct2( void **to_base, size_t *to, void **from, @@ -96,7 +101,7 @@ static force_inline void lttng_write_mystruct2( #define LTTNG_ARRAY_SIZE_mystruct_myarray 10 typedef uint64_t lttng_array_mystruct_myarray[LTTNG_ARRAY_SIZE_mystruct_myarray]; -static force_inline size_t lttng_get_size_array_mystruct_myarray( +static inline size_t lttng_get_size_array_mystruct_myarray( lttng_array_mystruct_myarray obj) { size_t size=0, locsize; @@ -112,7 +117,7 @@ static force_inline size_t lttng_get_size_array_mystruct_myarray( return size; } -static force_inline size_t lttng_get_alignment_array_mystruct_myarray( +static inline size_t lttng_get_alignment_array_mystruct_myarray( lttng_array_mystruct_myarray obj) { size_t align=0, localign; @@ -124,7 +129,7 @@ static force_inline size_t lttng_get_alignment_array_mystruct_myarray( } -static force_inline void lttng_write_array_mystruct_myarray( +static inline void lttng_write_array_mystruct_myarray( void **to_base, size_t *to, void **from, @@ -153,7 +158,7 @@ struct lttng_sequence_mystruct_mysequence { }; -static force_inline size_t lttng_get_size_sequence_mystruct_mysequence( +static inline size_t lttng_get_size_sequence_mystruct_mysequence( lttng_sequence_mystruct_mysequence *obj) { size_t size=0, locsize; @@ -167,7 +172,7 @@ static force_inline size_t lttng_get_size_sequence_mystruct_mysequence( return size; } -static force_inline size_t lttng_get_alignment_sequence_mystruct_mysequence( +static inline size_t lttng_get_alignment_sequence_mystruct_mysequence( lttng_sequence_mystruct_mysequence *obj) { size_t align=0, localign; @@ -182,7 +187,7 @@ static force_inline size_t lttng_get_alignment_sequence_mystruct_mysequence( } -static force_inline void lttng_write_sequence_mystruct_mysequence( +static inline void lttng_write_sequence_mystruct_mysequence( void **to_base, size_t *to, void **from, @@ -238,7 +243,7 @@ union lttng_mystruct_myunion { }; -static force_inline size_t lttng_get_size_mystruct_myunion( +static inline size_t lttng_get_size_mystruct_myunion( union lttng_mystruct_myunion *obj) { size_t size=0, locsize; @@ -255,7 +260,7 @@ static force_inline size_t lttng_get_size_mystruct_myunion( } -static force_inline size_t lttng_get_alignment_mystruct_myunion( +static inline size_t lttng_get_alignment_mystruct_myunion( union lttng_mystruct_myunion *obj) { size_t align=0, localign; @@ -270,7 +275,7 @@ static force_inline size_t lttng_get_alignment_mystruct_myunion( } -static force_inline void lttng_write_mystruct_myunion( +static inline void lttng_write_mystruct_myunion( void **to_base, size_t *to, void **from, @@ -301,7 +306,7 @@ struct lttng_mystruct { union lttng_mystruct_myunion myunion; }; -static force_inline size_t lttng_get_size_mystruct( +static inline size_t lttng_get_size_mystruct( struct lttng_mystruct *obj) { size_t size=0, locsize, localign; @@ -332,7 +337,7 @@ static force_inline size_t lttng_get_size_mystruct( } -static force_inline size_t lttng_get_alignment_mystruct( +static inline size_t lttng_get_alignment_mystruct( struct lttng_mystruct *obj) { size_t align=0, localign; @@ -358,7 +363,7 @@ static force_inline size_t lttng_get_alignment_mystruct( return align; } -static force_inline void lttng_write_mystruct( +static inline void lttng_write_mystruct( void **to_base, size_t *to, void **from, -- 2.34.1