2017-02-09 Jakub Jelinek <jakub@redhat.com>
+ PR c++/79429
+ * parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt
+ non-pragma_compound context here.
+ (cp_parser_omp_target): Likewise.
+ (cp_parser_pragma): Don't call push_omp_privatization_clauses and
+ parsing for ordered and target omp pragmas in non-pragma_stmt
+ non-pragma_compound contexts.
+
PR c/79431
* parser.c (cp_parser_oacc_declare): Formatting fix.
(cp_parser_omp_declare_target): Don't invoke symtab_node::get on
{
location_t loc = pragma_tok->location;
- if (context != pragma_stmt && context != pragma_compound)
- {
- cp_parser_error (parser, "expected declaration specifiers");
- cp_parser_skip_to_pragma_eol (parser, pragma_tok);
- return false;
- }
-
if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
{
tree id = cp_lexer_peek_token (parser->lexer)->u.value;
{
tree *pc = NULL, stmt;
- if (context != pragma_stmt && context != pragma_compound)
- {
- cp_parser_error (parser, "expected declaration specifiers");
- cp_parser_skip_to_pragma_eol (parser, pragma_tok);
- return false;
- }
-
if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
{
tree id = cp_lexer_peek_token (parser->lexer)->u.value;
return true;
case PRAGMA_OMP_ORDERED:
+ if (context != pragma_stmt && context != pragma_compound)
+ goto bad_stmt;
stmt = push_omp_privatization_clauses (false);
ret = cp_parser_omp_ordered (parser, pragma_tok, context, if_p);
pop_omp_privatization_clauses (stmt);
return ret;
case PRAGMA_OMP_TARGET:
+ if (context != pragma_stmt && context != pragma_compound)
+ goto bad_stmt;
stmt = push_omp_privatization_clauses (false);
ret = cp_parser_omp_target (parser, pragma_tok, context, if_p);
pop_omp_privatization_clauses (stmt);