FreeBSD/contrib/gcc/cp/parser.c
/* Some dependent statements (like `if (cond) statement'), are
   implicitly in their own scope.  In other words, if the statement is
   a single statement (as opposed to a compound-statement), it is
   none-the-less treated as if it were enclosed in braces.  Any
   declarations appearing in the dependent statement are out of scope
   after control passes that point.  This function parses a statement,
   but ensures that is in its own scope, even if it is not a
   compound-statement.

   If IF_P is not NULL, *IF_P is set to indicate whether the statement
   is a (possibly labeled) if statement which is not enclosed in
   braces and has an else clause.  This is used to implement
   -Wparentheses.

   Returns the new statement.  */
Some dependent statements (like `if (cond) statement'), are
implicitly in their own scope.  In other words, if the statement is
a single statement (as opposed to a compound-statement), it is
none-the-less treated as if it were enclosed in braces.  Any
declarations appearing in the dependent statement are out of scope
after control passes that point.  This function parses a statement,
but ensures that is in its own scope, even if it is not a
compound-statement.

If IF_P is not NULL, *IF_P is set to indicate whether the statement
is a (possibly labeled) if statement which is not enclosed in
braces and has an else clause.  This is used to implement
Wparentheses.

Returns the new statement.
Some dependent statements ( like ` if ( cond ) statement ' ) are implicitly in their own scope . In other words if the statement is a single statement ( as opposed to a compound - statement ) it is none - the - less treated as if it were enclosed in braces . Any declarations appearing in the dependent statement are out of scope after control passes that point . This function parses a statement but ensures that is in its own scope even if it is not a compound - statement . If IF_P is not NULL * IF_P is set to indicate whether the statement is a ( possibly labeled ) if statement which is not enclosed in braces and has an else clause . This is used to implement Wparentheses . Returns the new statement .
static tree
cp_parser_implicitly_scoped_statement (cp_parser* parser, bool *if_p)
{
  tree statement;
  if (if_p != NULL)
    *if_p = false;
  if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
    {
      cp_lexer_consume_token (parser->lexer);
      statement = add_stmt (build_empty_stmt ());
    }
  else if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
    statement = cp_parser_compound_statement (parser, NULL, false, false);
  else
    {
      statement = begin_compound_stmt (0);
      cp_parser_statement (parser, NULL_TREE, false, if_p);
      finish_compound_stmt (statement);
    }
  return statement;
}
static tree cp_parser_implicitly_scoped_statement ( cp_parser * parser , bool * if_p ) { tree statement ; if ( if_p != NULL ) * if_p = false ; if ( cp_lexer_next_token_is ( parser -> lexer , CPP_SEMICOLON ) ) { cp_lexer_consume_token ( parser -> lexer ) ; statement = add_stmt ( build_empty_stmt ( ) ) ; } else if ( cp_lexer_next_token_is ( parser -> lexer , CPP_OPEN_BRACE ) ) statement = cp_parser_compound_statement ( parser , NULL , false , false ) ; else { statement = begin_compound_stmt ( 0 ) ; cp_parser_statement ( parser , NULL_TREE , false , if_p ) ; finish_compound_stmt ( statement ) ; } return statement ; }
Some dependent statements (like `if (cond) statement'), are
implicitly in their own scope.
Some dependent statements ( like ` if ( cond ) statement ' ) are implicitly in their own scope .
/* Mark if () ; with a special NOP_EXPR.  */ /* if a compound is opened, we simply parse the statement directly.  */ /* APPLE LOCAL radar 5982990 */ /* If the token is not a `{', then we must take special action.  */ /* Create a compound-statement.  */ /* Parse the dependent-statement.  */ /* Finish the dummy compound-statement.  */ /* Return the statement.  */