aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Sanitize direct_declarator logicsAl Viro2009-07-171-7/+9
| | | | | | | | a) handling of nested declarator does not belong in the loop, for fsck sake b) functions and arrays don't mix (and functions don't mix with functions) Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Christopher Li <sparse@chrisli.org>
* More nested declarator fixesAl Viro2009-07-171-0/+16
| | | | | | | no nested declarators after [...] or (parameters) Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Christopher Li <sparse@chrisli.org>
* fun with declarations and definitionsAl Viro2009-07-171-0/+11
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). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Christopher Li <sparse@chrisli.org>