re PR c/20385 (Lame parse error message for undefined type)
commit29ce73cb955296716da85268e4b8faf91e6c5fcf
authorPaolo Bonzini <bonzini@gnu.org>
Fri, 17 Dec 2010 21:23:36 +0000 (17 21:23 +0000)
committerPaolo Bonzini <bonzini@gcc.gnu.org>
Fri, 17 Dec 2010 21:23:36 +0000 (17 21:23 +0000)
treec4cfe728320526019a5d30a613a686238e9911e5
parent7f2605707f4089459163f7d767f0ba5e1c9361e6
re PR c/20385 (Lame parse error message for undefined type)

gcc:
2010-12-17  Paolo Bonzini  <bonzini@gnu.org>

PR c/20385
* function.c (used_types_insert): Handle ERROR_MARK.
* c-decl.c (grokdeclarator): Handle ERROR_MARK.
(declspecs_add_type): Leave error_mark_node in specs->type.
(finish_declspecs): Change it to integer_type_node here.
* c-parser.c (c_parser_peek_2nd_token): Move earlier.
(enum c_lookahead_kind): New.
(c_parser_next_token_starts_typename): New name of
c_parser_next_tokens_start_typename.  Accept lookahead enum
and handle it here instead of...
(c_parser_next_tokens_start_declaration): ... here.  Call it.
(c_parser_declspecs): Accept another argument.  Do not exit
on C_ID_ID if it is guessed to be an unknown typename.
(c_parser_parms_declarator): Use 2nd token to distinguish a K&R
declaration from an ANSI declaration starting with an unknown
typename.
(c_parser_struct_declaration, c_parser_objc_type_name,
c_parser_typeof_specifier, c_parser_declarator,
c_parser_direct_declarator_inner): Adjust calls.
(c_parser_parameter_declaration): Likewise.
(c_parser_type_name): Pass back an error_mark_node to the caller.
(c_parser_postfix_expression): Do error recovery when
c_parser_type_name returns NULL.

testsuite:
2010-12-17  Paolo Bonzini  <bonzini@gnu.org>

PR c/20385
* objc.dg/tls/init-2.m: Adjust.
* gcc.dg/noncompile/920923-1.c: Adjust.
* gcc.dg/noncompile/pr44517.c: Adjust.
* gcc.dg/declspec-18.c: New test.

From-SVN: r167999
gcc/ChangeLog
gcc/c-decl.c
gcc/c-parser.c
gcc/function.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/declspec-18.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/noncompile/920923-1.c
gcc/testsuite/gcc.dg/noncompile/pr44517.c
gcc/testsuite/objc.dg/tls/init-2.m