diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-12-02 13:38:20 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-12-02 13:38:20 +0100 |
commit | faa867f5a8b74b5eaef3066debc015dc888237cb (patch) | |
tree | 79eaa6b0aa7be49f902ef6d7d64ca852b265a0d2 /gcc/cp/parser.c | |
parent | f4b6fc8c53afad76c98e9d8c7debfd092c4d9620 (diff) | |
download | gcc-faa867f5a8b74b5eaef3066debc015dc888237cb.zip gcc-faa867f5a8b74b5eaef3066debc015dc888237cb.tar.gz gcc-faa867f5a8b74b5eaef3066debc015dc888237cb.tar.bz2 |
re PR c++/88258 (Infinite loop emitting diagnostics in the C++ front-end)
PR c++/88258
* parser.c (cp_parser_skip_to_closing_parenthesis_1,
cp_parser_skip_to_end_of_statement,
cp_parser_skip_to_end_of_block_or_statement,
cp_parser_skip_to_closing_brace,
cp_parser_skip_to_closing_square_bracket,
cp_parser_skip_balanced_tokens): Don't treat CPP_PRAGMA_EOL specially
if in_pragma is false.
* g++.dg/gomp/pr88258.C: New test.
From-SVN: r266720
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index e271e87..ab6d237 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -3558,8 +3558,11 @@ cp_parser_skip_to_closing_parenthesis_1 (cp_parser *parser, switch (token->type) { - case CPP_EOF: case CPP_PRAGMA_EOL: + if (!parser->lexer->in_pragma) + break; + /* FALLTHRU */ + case CPP_EOF: /* If we've run out of tokens, then there is no closing `)'. */ return 0; @@ -3654,8 +3657,11 @@ cp_parser_skip_to_end_of_statement (cp_parser* parser) switch (token->type) { - case CPP_EOF: case CPP_PRAGMA_EOL: + if (!parser->lexer->in_pragma) + break; + /* FALLTHRU */ + case CPP_EOF: /* If we've run out of tokens, stop. */ return; @@ -3744,8 +3750,11 @@ cp_parser_skip_to_end_of_block_or_statement (cp_parser* parser) switch (token->type) { - case CPP_EOF: case CPP_PRAGMA_EOL: + if (!parser->lexer->in_pragma) + break; + /* FALLTHRU */ + case CPP_EOF: /* If we've run out of tokens, stop. */ return; @@ -3794,8 +3803,11 @@ cp_parser_skip_to_closing_brace (cp_parser *parser) switch (token->type) { - case CPP_EOF: case CPP_PRAGMA_EOL: + if (!parser->lexer->in_pragma) + break; + /* FALLTHRU */ + case CPP_EOF: /* If we've run out of tokens, stop. */ return false; @@ -22560,8 +22572,11 @@ cp_parser_skip_to_closing_square_bracket (cp_parser *parser) switch (token->type) { - case CPP_EOF: case CPP_PRAGMA_EOL: + if (!parser->lexer->in_pragma) + break; + /* FALLTHRU */ + case CPP_EOF: /* If we've run out of tokens, then there is no closing `]'. */ return false; @@ -26074,8 +26089,11 @@ cp_parser_skip_balanced_tokens (cp_parser *parser, size_t n) do switch (cp_lexer_peek_nth_token (parser->lexer, n++)->type) { - case CPP_EOF: case CPP_PRAGMA_EOL: + if (!parser->lexer->in_pragma) + break; + /* FALLTHRU */ + case CPP_EOF: /* Ran out of tokens. */ return orig_n; case CPP_OPEN_PAREN: |