diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2010-12-17 21:23:36 +0000 |
---|---|---|
committer | Paolo Bonzini <bonzini@gcc.gnu.org> | 2010-12-17 21:23:36 +0000 |
commit | 29ce73cb955296716da85268e4b8faf91e6c5fcf (patch) | |
tree | c4cfe728320526019a5d30a613a686238e9911e5 /gcc/function.c | |
parent | 7f2605707f4089459163f7d767f0ba5e1c9361e6 (diff) | |
download | gcc-29ce73cb955296716da85268e4b8faf91e6c5fcf.zip gcc-29ce73cb955296716da85268e4b8faf91e6c5fcf.tar.gz gcc-29ce73cb955296716da85268e4b8faf91e6c5fcf.tar.bz2 |
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
Diffstat (limited to 'gcc/function.c')
-rw-r--r-- | gcc/function.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/function.c b/gcc/function.c index c69a5c5..7fa3b0c 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -5712,6 +5712,8 @@ used_types_insert (tree t) break; else t = TREE_TYPE (t); + if (TREE_CODE (t) == ERROR_MARK) + return; if (TYPE_NAME (t) == NULL_TREE || TYPE_NAME (t) == TYPE_NAME (TYPE_MAIN_VARIANT (t))) t = TYPE_MAIN_VARIANT (t); |