Re: [PATCH 2/6] typesafe: kthread_create and kthread_run

2008-01-20 Thread Bert Wesarg
On Jan 20, 2008 11:04 PM, Rusty Russell <[EMAIL PROTECTED]> wrote: > On Monday 21 January 2008 03:43:40 Bert Wesarg wrote: > > No, it is a matter of conforming to C99 or to GNU extensions. > > Hi Bert! > > Not sure I see the point of your message. > > The original use the ... varargs GNU

Re: [PATCH 2/6] typesafe: kthread_create and kthread_run

2008-01-20 Thread Rusty Russell
On Monday 21 January 2008 03:43:40 Bert Wesarg wrote: > No, it is a matter of conforming to C99 or to GNU extensions. Hi Bert! Not sure I see the point of your message. The original use the ... varargs GNU extension, your two argument version is the C99-safe variant, and your three args +

Re: [PATCH 2/6] typesafe: kthread_create and kthread_run

2008-01-20 Thread Bert Wesarg
On Jan 20, 2008 5:24 PM, Johannes Weiner <[EMAIL PROTECTED]> wrote: > Hi, > > "Bert Wesarg" <[EMAIL PROTECTED]> writes: > > > On Jan 20, 2008 12:25 PM, Jan Engelhardt <[EMAIL PROTECTED]> wrote: > >> > >> On Jan 20 2008 20:48, Rusty Russell wrote: > >> >+ */ > >> >+#define kthread_create(threadfn,

Re: [PATCH 2/6] typesafe: kthread_create and kthread_run

2008-01-20 Thread Johannes Weiner
Hi, "Bert Wesarg" <[EMAIL PROTECTED]> writes: > On Jan 20, 2008 12:25 PM, Jan Engelhardt <[EMAIL PROTECTED]> wrote: >> >> On Jan 20 2008 20:48, Rusty Russell wrote: >> >+ */ >> >+#define kthread_create(threadfn, data, namefmt...) ({ \ >> >+ int (*_threadfn)(typeof(data)) =

Re: [PATCH 2/6] typesafe: kthread_create and kthread_run

2008-01-20 Thread Bert Wesarg
On Jan 20, 2008 12:25 PM, Jan Engelhardt <[EMAIL PROTECTED]> wrote: > > On Jan 20 2008 20:48, Rusty Russell wrote: > >+ */ > >+#define kthread_create(threadfn, data, namefmt...) ({ \ > >+ int (*_threadfn)(typeof(data)) = (threadfn);\ > >+ __kthread_create((void

Re: [PATCH 2/6] typesafe: kthread_create and kthread_run

2008-01-20 Thread Jan Engelhardt
On Jan 20 2008 20:48, Rusty Russell wrote: >+ */ >+#define kthread_create(threadfn, data, namefmt...) ({ \ >+ int (*_threadfn)(typeof(data)) = (threadfn);\ >+ __kthread_create((void *)_threadfn, (data), namefmt); \ >+}) If you have namefmt... you need that varagrs

[PATCH 2/6] typesafe: kthread_create and kthread_run

2008-01-20 Thread Rusty Russell
Simple statement expression with a temporary variable does the typechecking for us: that the kthread function matches the data type. If the function doesn't match, we get: warning: initialization from incompatible pointer type It's actually slightly over-strict, since you can hand void

[PATCH 2/6] typesafe: kthread_create and kthread_run

2008-01-20 Thread Rusty Russell
Simple statement expression with a temporary variable does the typechecking for us: that the kthread function matches the data type. If the function doesn't match, we get: warning: initialization from incompatible pointer type It's actually slightly over-strict, since you can hand void

Re: [PATCH 2/6] typesafe: kthread_create and kthread_run

2008-01-20 Thread Jan Engelhardt
On Jan 20 2008 20:48, Rusty Russell wrote: + */ +#define kthread_create(threadfn, data, namefmt...) ({ \ + int (*_threadfn)(typeof(data)) = (threadfn);\ + __kthread_create((void *)_threadfn, (data), namefmt); \ +}) If you have namefmt... you need that varagrs cpp

Re: [PATCH 2/6] typesafe: kthread_create and kthread_run

2008-01-20 Thread Bert Wesarg
On Jan 20, 2008 12:25 PM, Jan Engelhardt [EMAIL PROTECTED] wrote: On Jan 20 2008 20:48, Rusty Russell wrote: + */ +#define kthread_create(threadfn, data, namefmt...) ({ \ + int (*_threadfn)(typeof(data)) = (threadfn);\ + __kthread_create((void *)_threadfn,

Re: [PATCH 2/6] typesafe: kthread_create and kthread_run

2008-01-20 Thread Johannes Weiner
Hi, Bert Wesarg [EMAIL PROTECTED] writes: On Jan 20, 2008 12:25 PM, Jan Engelhardt [EMAIL PROTECTED] wrote: On Jan 20 2008 20:48, Rusty Russell wrote: + */ +#define kthread_create(threadfn, data, namefmt...) ({ \ + int (*_threadfn)(typeof(data)) = (threadfn);\ +

Re: [PATCH 2/6] typesafe: kthread_create and kthread_run

2008-01-20 Thread Bert Wesarg
On Jan 20, 2008 5:24 PM, Johannes Weiner [EMAIL PROTECTED] wrote: Hi, Bert Wesarg [EMAIL PROTECTED] writes: On Jan 20, 2008 12:25 PM, Jan Engelhardt [EMAIL PROTECTED] wrote: On Jan 20 2008 20:48, Rusty Russell wrote: + */ +#define kthread_create(threadfn, data, namefmt...) ({

Re: [PATCH 2/6] typesafe: kthread_create and kthread_run

2008-01-20 Thread Bert Wesarg
On Jan 20, 2008 11:04 PM, Rusty Russell [EMAIL PROTECTED] wrote: On Monday 21 January 2008 03:43:40 Bert Wesarg wrote: No, it is a matter of conforming to C99 or to GNU extensions. Hi Bert! Not sure I see the point of your message. The original use the ... varargs GNU extension, your two