lkml.org 
[lkml]   [2008]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: optimizing out inline functions
Sam Ravnborg wrote:
> On Wed, May 28, 2008 at 02:51:02PM -0500, Steve French wrote:
>> In trying to remove some macros, I ran across another kernel style
<<--SNIP-->>
> With reference to a recent thread about kconfig
> I would prefer:
> static inline void some_debug_function(var1)
> {
> if (KCONFIG_DEBUG_SOMETHING) {
> something = var1;
> printk(some debug text);
> }
> }
>
>
> But we do not have KCONFIG_DEBUG_SOMETHING available
> so the second best is to use an empty function
> to keep the typechecking in place.
>
> IIRC gcc optimize both away.

Another way would be to have:

static inline void some_debug_function(var1)
{
#ifdef KCONFIG_DEBUG_SOMETHING
something = var1;
printk(some debug text);
#endif
}

BUT, this probably violates some styling rules.

James
}


\
 
 \ /
  Last update: 2008-05-28 23:05    [W:0.029 / U:1.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site