[PATCH] graceful handling of old-style array initializers
commit12dc7e4bb89a432d397206b0cf547c351173b97f
authorAlexander Viro <viro@parcelfarce.linux.theplanet.co.uk>
Tue, 5 Oct 2004 15:50:05 +0000 (5 08:50 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 8 Apr 2005 04:03:28 +0000 (7 21:03 -0700)
treebc058d3573a4df3d5041608fccf63e26b7bda54f
parente95028ed6a5b8c9a35e5ce2af136c5781799308a
[PATCH] graceful handling of old-style array initializers

The current gcc initializer code is too permissive, AFAICS - [0][0] 1
will be rejected by gcc too, so we shouldn't consider it "broken gcc syntax".

There was another bug in there -
                *ep = NULL;
                token = initializer(ep, token);
                if (!expr)
                        break;
                add_expression(list, expr);
would not catch the case when we have e.g. .foo = <bad expression> and we
end up with list polluted by EXPR_IDENTIFIER with NULL ->ident_expression.

Should be if (!*ep) instead.

This also cleans it up by splitting the list handling case up from the
loop, and making the single initializer parsing a function of its own.
parse.c