Nick Bowler [Sat, 25 Jun 2011 12:52:17 +0000 (08:52 -0400)]
Restrict the contexts in which typedef names can appear.
This should resolve a rather nasty ambiguity in the C grammar:
[declaration] -> [declaration-specifiers] ;
-> [type-specifier] [declaration-specifiers] ;
-> int [declaration-specifiers] ;
-> int [type-specifier] ;
-> int [typedef-name] ;
-> int [identifier] ;
-> int x ;
versus
[declaration] -> [declaration-specifiers] [init-declarator-list] ;
-> [type-specifier] [init-declarator-list] ;
-> int [init-declarator-list] ;
-> int [init-declarator] ;
-> int [declarator] ;
-> int [direct-declarator] ;
-> int [identifier] ;
-> int x ;
The standard resolves this ambiguity by having a constraint that is not
part of the context-free grammar. This ambiguity gets really nasty with
things like int f (x); -- is it a declaration of x with two type
specifiers or a declaration of f (a function with one parameter) with
with one type specifier?
A side-effect of this change is that the parser will now reject
declarations without any type specifiers at all, which probably makes
the error messages a bit less informative.
Nick Bowler [Sat, 25 Jun 2011 00:26:25 +0000 (20:26 -0400)]
Fix VPATH builds from git.
In such builds, C source files (that are normally distributed) get
generated, which means they end up in the build tree. Building them
subsequently fails because headers (in the source tree) are not found.
Nick Bowler [Thu, 23 Jun 2011 00:30:52 +0000 (20:30 -0400)]
Kill typemap_is_valid.
Just do the check when building the map in the first place. This
enables more useful error messages, too: the case where there are no
type specifiers at all is certainly worth diagnosing separately from
other kinds of nonsense.