On Thu, Feb 5, 2009 at 9:36 PM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > On Thu, Feb 05, 2009 at 09:19:21PM +0000, Al Viro wrote: >> IOW, direct_declarator() (which doubles for direct-abstract-declarator) should >> have more than one-bit indication of which case we've got. Right now it's >> done by "have we passed a non-NULL ident ** to store the identifier being >> declared"; that's not enough. What we need is explicit 'is that a part of >> parameter declaration' flag; then the rule turns into >> if (p && *p) >> fn = 1; /* we'd seen identifier already, can't be nested */ >> else if match_op(next, ')') >> fn = 1; /* empty list can't be direct-declarator or >> * direct-abstract-declarator */ >> else >> fn = (in_parameter && lookup_type(next)); > > Umm... It's a bit more subtle (p goes NULL after the nested one is > handled), so we need to keep track of "don't allow nested declarator from > that point on" explicitly. Patch follows: > > Subject: [PATCH] Handle nested declarators vs. parameter lists correctly > > Seeing a typedef name after ( means that we have a parameter-type-list > only if we are parsing a parameter declaration or a typename; otherwise > it might very well be a redeclaration (e.g. int (T); when T had been a > typedef in outer scope). The patch looks great. Applied. Chris -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html