+2016-12-20 Richard Biener <rguenther@suse.de>
+
+ * gimple-parser.c (c_parser_gimple_compound_statement): Improve
+ error recovery.
+ (c_parser_gimple_statement): Only build assigns for non-error
+ stmts.
+ (c_parser_gimple_postfix_expression_after): Improve error recovery.
+
2016-12-14 Martin Jambor <mjambor@suse.cz>
* c-parser.c: Include omp-general.h and omp-offload.h instead of
expr_stmt:
c_parser_gimple_statement (parser, seq);
if (! c_parser_require (parser, CPP_SEMICOLON, "expected %<;%>"))
- return return_p;
+ c_parser_skip_until_found (parser, CPP_SEMICOLON, NULL);
}
}
c_parser_consume_token (parser);
case CPP_NOT:
case CPP_MULT: /* pointer deref */
rhs = c_parser_gimple_unary_expression (parser);
- assign = gimple_build_assign (lhs.value, rhs.value);
- gimple_set_location (assign, loc);
- gimple_seq_add_stmt (seq, assign);
+ if (rhs.value != error_mark_node)
+ {
+ assign = gimple_build_assign (lhs.value, rhs.value);
+ gimple_set_location (assign, loc);
+ gimple_seq_add_stmt (seq, assign);
+ }
return;
default:;
&& lookup_name (c_parser_peek_token (parser)->value))
{
rhs = c_parser_gimple_unary_expression (parser);
- gimple *call = gimple_build_call_from_tree (rhs.value);
- gimple_call_set_lhs (call, lhs.value);
- gimple_seq_add_stmt (seq, call);
- gimple_set_location (call, loc);
+ if (rhs.value != error_mark_node)
+ {
+ gimple *call = gimple_build_call_from_tree (rhs.value);
+ gimple_call_set_lhs (call, lhs.value);
+ gimple_seq_add_stmt (seq, call);
+ gimple_set_location (call, loc);
+ }
return;
}
tree idx = c_parser_gimple_unary_expression (parser).value;
if (! c_parser_require (parser, CPP_CLOSE_SQUARE, "expected %<]%>"))
- break;
+ {
+ c_parser_skip_until_found (parser, CPP_CLOSE_SQUARE, NULL);
+ break;
+ }
start = expr.get_start ();
finish = c_parser_tokens_buf (parser, 0)->location;