[PATCH] detect unknown type names in declaration

Paolo Bonzini bonzini@gnu.org
Sat Nov 13 16:51:00 GMT 2010


On 11/13/2010 03:15 PM, H.J. Lu wrote:
> On Sat, Oct 30, 2010 at 6:24 AM, Paolo Bonzini<bonzini@gnu.org>  wrote:
>> This patch improves GCC error detection so that some cases of
>> declarations with unknown type names are detected.  This also
>> allows GCC to do better on cascading errors, because the variables
>> that are declared enter the symbol table.
>>
>> Bootstrapped/regtested x86_64-pc-linux-gnu, ok?
>>
>> 2010-10-30  Paolo Bonzini<bonzini@gnu.org>
>>
>>         * c-parser.c (c_parser_next_token_starts_declaration): Rename to...
>>         (c_parser_next_tokens_start_declaration): ... this.  Handle 2nd
>>         token lookahead.
>>         (c_parser_compound_statement_nostart, c_parser_label,
>>         c_parser_for_statement, c_parser_omp_for_loop): Adjust calls.
>>         (c_parser_declaration_or_fndef): Detect the case now matched by
>>         c_parser_next_tokens_start_declaration, give error and correct it.
>>
>
> This caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46462

I'm committing the attached testsuite patch, which simply adjust the 
errors (they are now more precise).  I'll post shortly a small 
adjustment to the C parser to unbreak Objective-C foreach and improve 
error recovery further.

Paolo
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: tests-46462.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101113/aed8c2dc/attachment.ksh>


More information about the Gcc-patches mailing list