lkml.org 
[lkml]   [2009]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3] timer: implement lockdep deadlock detection
From
Date
On Wed, 2009-01-28 at 19:06 +0100, Johannes Berg wrote:

> +/*
> + * All the indirection here is required to build the
> + * "<file>:<line>" string and the pointer to it.
> + */
> +#define ___TIMER_INITIALIZER(_fn, _exp, _dat, _kn) \
> + ____TIMER_INITIALIZER(_fn, _exp, _dat, (_kn), &(_kn))
> +#define __TIMER_INITIALIZER(_fn, _exp, _dat, _f, _c, _l) \
> + ___TIMER_INITIALIZER(_fn, _exp, _dat, _f # _c # _l)
> +#define _TIMER_INITIALIZER(_fn, _exp, _dat, _f, _l) \
> + __TIMER_INITIALIZER(_fn, _exp, _dat, _f, :, _l)
> +#define TIMER_INITIALIZER(_function, _expires, _data) \
> + _TIMER_INITIALIZER(_function, _expires, _data, __FILE__, __LINE__)

The regular way to write that would be:

#define __STR(foo) #foo
#define STR(foo) __STR(foo)

__FILE__ ":" STR(__LINE__)

I'm sure I saw that stringify thing somewhere in the kernel before, but
can't find it. I recently added it to lockdep.c, maybe we should add it
to kernel.h ?



\
 
 \ /
  Last update: 2009-01-29 14:41    [W:0.123 / U:1.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site