FreeBSD/contrib/gcc/cp/parser.c
/* Parse the restricted form of the for statment allowed by OpenMP.  */
Parse the restricted form of the for statment allowed by OpenMP.
Parse the restricted form of the for statment allowed by OpenMP .
static tree
cp_parser_omp_for_loop (cp_parser *parser)
{
  tree init, cond, incr, body, decl, pre_body;
  location_t loc;
  if (!cp_lexer_next_token_is_keyword (parser->lexer, RID_FOR))
    {
      cp_parser_error (parser, "for statement expected");
      return NULL;
    }
  loc = cp_lexer_consume_token (parser->lexer)->location;
  if (!cp_parser_require (parser, CPP_OPEN_PAREN, "`('"))
    return NULL;
  init = decl = NULL;
  pre_body = push_stmt_list ();
  if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON))
    {
      cp_decl_specifier_seq type_specifiers;
      cp_parser_parse_tentatively (parser);
      cp_parser_type_specifier_seq (parser, false,
				    &type_specifiers);
      if (!cp_parser_error_occurred (parser))
	{
	  tree asm_specification, attributes;
	  cp_declarator *declarator;
	  declarator = cp_parser_declarator (parser,
					     CP_PARSER_DECLARATOR_NAMED,
					     NULL,
					     NULL,
					     false);
	  attributes = cp_parser_attributes_opt (parser);
	  asm_specification = cp_parser_asm_specification_opt (parser);
	  cp_parser_require (parser, CPP_EQ, "`='");
	  if (cp_parser_parse_definitely (parser))
	    {
	      tree pushed_scope;
	      decl = start_decl (declarator, &type_specifiers,
				 false, attributes,
				 NULL_TREE,
				 &pushed_scope);
	      init = cp_parser_assignment_expression (parser, false);
	      cp_finish_decl (decl, NULL_TREE, false,
			      asm_specification, LOOKUP_ONLYCONVERTING);
	      if (pushed_scope)
		pop_scope (pushed_scope);
	    }
	}
      else
	cp_parser_abort_tentative_parse (parser);
      if (decl == NULL)
	init = cp_parser_expression (parser, false);
    }
  cp_parser_require (parser, CPP_SEMICOLON, "`;'");
  pre_body = pop_stmt_list (pre_body);
  cond = NULL;
  if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON))
    cond = cp_parser_condition (parser);
  cp_parser_require (parser, CPP_SEMICOLON, "`;'");
  incr = NULL;
  if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_PAREN))
    incr = cp_parser_expression (parser, false);
  if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"))
    cp_parser_skip_to_closing_parenthesis (parser, true,
					   false,
					   true);
  parser->in_statement = IN_OMP_FOR;
  body = push_stmt_list ();
  cp_parser_statement (parser, NULL_TREE, false, NULL);
  body = pop_stmt_list (body);
  return finish_omp_for (loc, decl, init, cond, incr, body, pre_body);
}
static tree cp_parser_omp_for_loop ( cp_parser * parser ) { tree init , cond , incr , body , decl , pre_body ; location_t loc ; if ( ! cp_lexer_next_token_is_keyword ( parser -> lexer , RID_FOR ) ) { cp_parser_error ( parser , " " ) ; return NULL ; } loc = cp_lexer_consume_token ( parser -> lexer ) -> location ; if ( ! cp_parser_require ( parser , CPP_OPEN_PAREN , " " ) ) return NULL ; init = decl = NULL ; pre_body = push_stmt_list ( ) ; if ( cp_lexer_next_token_is_not ( parser -> lexer , CPP_SEMICOLON ) ) { cp_decl_specifier_seq type_specifiers ; cp_parser_parse_tentatively ( parser ) ; cp_parser_type_specifier_seq ( parser , false , & type_specifiers ) ; if ( ! cp_parser_error_occurred ( parser ) ) { tree asm_specification , attributes ; cp_declarator * declarator ; declarator = cp_parser_declarator ( parser , CP_PARSER_DECLARATOR_NAMED , NULL , NULL , false ) ; attributes = cp_parser_attributes_opt ( parser ) ; asm_specification = cp_parser_asm_specification_opt ( parser ) ; cp_parser_require ( parser , CPP_EQ , " " ) ; if ( cp_parser_parse_definitely ( parser ) ) { tree pushed_scope ; decl = start_decl ( declarator , & type_specifiers , false , attributes , NULL_TREE , & pushed_scope ) ; init = cp_parser_assignment_expression ( parser , false ) ; cp_finish_decl ( decl , NULL_TREE , false , asm_specification , LOOKUP_ONLYCONVERTING ) ; if ( pushed_scope ) pop_scope ( pushed_scope ) ; } } else cp_parser_abort_tentative_parse ( parser ) ; if ( decl == NULL ) init = cp_parser_expression ( parser , false ) ; } cp_parser_require ( parser , CPP_SEMICOLON , " " ) ; pre_body = pop_stmt_list ( pre_body ) ; cond = NULL ; if ( cp_lexer_next_token_is_not ( parser -> lexer , CPP_SEMICOLON ) ) cond = cp_parser_condition ( parser ) ; cp_parser_require ( parser , CPP_SEMICOLON , " " ) ; incr = NULL ; if ( cp_lexer_next_token_is_not ( parser -> lexer , CPP_CLOSE_PAREN ) ) incr = cp_parser_expression ( parser , false ) ; if ( ! cp_parser_require ( parser , CPP_CLOSE_PAREN , " " ) ) cp_parser_skip_to_closing_parenthesis ( parser , true , false , true ) ; parser -> in_statement = IN_OMP_FOR ; body = push_stmt_list ( ) ; cp_parser_statement ( parser , NULL_TREE , false , NULL ) ; body = pop_stmt_list ( body ) ; return finish_omp_for ( loc , decl , init , cond , incr , body , pre_body ) ; }
Parse the restricted form of the for statment allowed by OpenMP.
Parse the restricted form of the for statment allowed by OpenMP .
/* First, try to parse as an initialized declaration.  See
	 cp_parser_condition, from whence the bulk of this is copied.  */ /*is_condition=*/ /*ctor_dtor_or_conv_p=*/ /*parenthesized_p=*/ /*member_p=*/ /*initialized_p=*/ /*prefix_attributes=*/ /*init_const_expr_p=*/ /* If parsing as an initialized declaration failed, try again as
	 a simple expression.  */ /*recovering=*/ /*or_comma=*/ /*consume_paren=*/ /* Note that we saved the original contents of this flag when we entered
     the structured block, and so we don't need to re-save it here.  */ /* Note that the grammar doesn't call for a structured block here,
     though the loop as a whole is a structured block.  */