Subject: Re: [PATCH -next] ia64/sn: fix percpu warnings

From: "Jan Beulich" <[email-masked]>
Date: Fri, 30 Oct 2009 16:05:24 +0000

>>> Tejun Heo <[email-masked]> 29.10.09 16:43 >>>
>So, the problem is that genksyms can't understand the following.
>
>  __typeof__(int [10]) my_ar;
>  EXPORT_SYMBOL(my_ar);

In fact almost no use of typeof() works with genksyms: Out of

#include <linux/module.h>

extern int x;

#define export(t, n) typeof(t) export_##n; EXPORT_SYMBOL(export_##n)

export(x, a);
export(&x, b);
export(int, c);
export(int*, d);
export(int**, e);
export(int[4], f);
export(typeof(x), g);
export(typeof(&x), h);
export(typeof(x)*, i);

only c and d get a non-zero CRC. This is clearly due to the naive parsing
scripts/genksyms/parse.y does:

type_specifier:
	simple_type_specifier
	| cvar_qualifier
	| TYPEOF_KEYW '(' decl_specifier_seq '*' ')'
	| TYPEOF_KEYW '(' decl_specifier_seq ')'
	...

>Would it be difficult to teach it how to parse it?

For someone familiar with bison/yacc this would seem not very difficult
a job, but as far as I'm concerned this is not something I would feel
comfortable trying to fix. Of course one could go the simplistic route
and just add the array case here, but imo this wouldn't be the right
way to deal with it.

Jan