This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR c/23722 bad error recovery with if blocks and else (try 3)
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Manuel López-Ibáñez <lopezibanez at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 26 Nov 2007 16:42:40 +0000 (UTC)
- Subject: Re: PR c/23722 bad error recovery with if blocks and else (try 3)
- References: <6c33472e0711231052y75116754ia1109ab37eb5f79f@mail.gmail.com>
On Fri, 23 Nov 2007, Manuel López-Ibáñez wrote:
> 2007-11-23 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
>
> PR c/23722
> * c-parser.c (struct c_parser): New bit in_if_block.
> (c_parser_compound_statement_nostart): Handle unexpected 'else' keyword.
> (c_parser_statement_after_labels): Set in_if_block to false while parsing.
> (c_parser_if_body): Don't call c_parser_statement_after_labels if a
> semicolon is found, just consume it. Don't call
> c_parser_statement_after_labels if an open brace is found, call
> c_parser_compound_statement instead.
> (c_parser_else_body): New.
> (c_parser_if_statement): Set in_if_block to true when parsing the
> body of the 'if' statement. Use c_parser_else_body.
>
> testsuite/
> * gcc.dg/cpp/19990413-1.c: Update.
> * gcc.dg/parse-else-error.c: New.
> * gcc.dg/parse-else-error-2.c: New.
> * gcc.dg/parse-else-error-3.c: New.
> * gcc.dg/parse-else-error-4.c: New.
OK.
--
Joseph S. Myers
joseph@codesourcery.com