Remove COMPOUND_STMT

Richard Henderson rth@redhat.com
Thu Jun 17 03:57:00 GMT 2004


It has been replaced with the generic BIND_EXPR.  This had already been
done for everything except for template processing, this just completes
the job.

Also updates c-tree.texi a bit, though I fear a complete rewrite wouldn't
be out of order.

Tested on i686-linux.


r~


        * c-common.def (COMPOUND_STMT): Remove.
        * c-common.c (finish_fname_decls): Don't look through it.
        * c-typeck.c (c_tree_expr_nonnegative_p): Likewise.
        * c-common.h (COMPOUND_BODY): Remove.
        (c_common_stmt_codes): Remove COMPOUND_STMT.
        * c-dump.c (c_dump_tree): Likewise.
        * c-gimplify.c (c_gimplify_stmt): Likewise.
        * c-pretty-print.c (pp_c_statement): Likewise.
        * tree.h (DECL_SAVED_TREE): Update commentary.
        * doc/c-tree.texi (ASM_EXPR): Rename from ASM_STMT.
        (CASE_LABEL_EXPR): Rename from CASE_LABEL.
        (GOTO_EXPR): Rename from GOTO_STMT.
        (GOTO_FAKE_P): Remove.
        (COMPOUND_STMT): Remove.
        (HANDLER): Update wrt COMPOUND_STMT.
        (STMT_EXPR): Likewise.
        (LABEL_EXPR): Rename from LABEL_STMT.
        (SCOPE_STMT): Remove.
        * objc/objc-act.c (objc_build_try_catch_finally_stmt): Don't look
        through COMPOUND_STMT.
cp/
        * cp-tree.h (COMPOUND_STMT_TRY_BLOCK, COMPOUND_STMT_BODY_BLOCK): Kill.
        (BIND_EXPR_TRY_BLOCK, BIND_EXPR_BODY_BLOCK): New.
        * cxx-pretty-print.c (pp_cxx_function_definition): Move handling
        of CTOR_INITIALIZER ...
        (pp_cxx_statement): ... here.
        * decl.c (begin_function_body): Don't set COMPOUND_STMT_BODY_BLOCK.
        (finish_function): Use alloc_stmt_list to zap entire function.
        * parser.c (cp_parser_compound_statement): Update commentary.
        * pt.c (tsubst_expr): Use BIND_EXPR instead of COMPOUND_STMT.
        * semantics.c (begin_compound_stmt, finish_compound_stmt): Likewise.
        (finish_stmt_expr): Don't look through COMPOUND_STMT.

Index: gcc/c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.514
diff -c -p -d -r1.514 c-common.c
*** gcc/c-common.c	16 Jun 2004 20:51:36 -0000	1.514
--- gcc/c-common.c	17 Jun 2004 01:13:44 -0000
*************** finish_fname_decls (void)
*** 899,906 ****
      {
        tree *bodyp = &DECL_SAVED_TREE (current_function_decl);
  
-       if (TREE_CODE (*bodyp) == COMPOUND_STMT)
- 	bodyp = &COMPOUND_BODY (*bodyp);
        if (TREE_CODE (*bodyp) == BIND_EXPR)
  	bodyp = &BIND_EXPR_BODY (*bodyp);
  
--- 899,904 ----
Index: gcc/c-common.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.def,v
retrieving revision 1.19
diff -c -p -d -r1.19 c-common.def
*** gcc/c-common.def	16 Jun 2004 20:51:37 -0000	1.19
--- gcc/c-common.def	17 Jun 2004 01:13:44 -0000
*************** DEFTREECODE (ALIGNOF_EXPR, "alignof_expr
*** 33,42 ****
     obtain the expression.  */
  DEFTREECODE (EXPR_STMT, "expr_stmt", 'e', 1)
  
- /* Used to represent a brace-enclosed block.  The operand is
-    COMPOUND_BODY.  */
- DEFTREECODE (COMPOUND_STMT, "compound_stmt", 'e', 1)
- 
  /* Used to represent a local declaration. The operand is
     DECL_STMT_DECL.  */
  DEFTREECODE (DECL_STMT, "decl_stmt", 'e', 1)
--- 33,38 ----
Index: gcc/c-common.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.h,v
retrieving revision 1.235
diff -c -p -d -r1.235 c-common.h
*** gcc/c-common.h	17 Jun 2004 01:06:03 -0000	1.235
--- gcc/c-common.h	17 Jun 2004 01:13:44 -0000
*************** extern void finish_file	(void);
*** 956,967 ****
  
  #define SWITCH_TYPE(NODE)	TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2)
  
- /* COMPOUND_STMT accessor. This gives access to the TREE_LIST of
-    statements associated with a compound statement. The result is the
-    first statement in the list. Succeeding nodes can be accessed by
-    calling TREE_CHAIN on a node in the list.  */
- #define COMPOUND_BODY(NODE)     TREE_OPERAND (COMPOUND_STMT_CHECK (NODE), 0)
- 
  /* DECL_STMT accessor. This gives access to the DECL associated with
     the given declaration statement.  */
  #define DECL_STMT_DECL(NODE)    TREE_OPERAND (DECL_STMT_CHECK (NODE), 0)
--- 956,961 ----
*************** enum c_tree_code {
*** 1000,1006 ****
  #undef DEFTREECODE
  
  #define c_common_stmt_codes				\
!    CLEANUP_STMT,	EXPR_STMT,	COMPOUND_STMT,	\
     DECL_STMT,		IF_STMT,	FOR_STMT,	\
     WHILE_STMT,		DO_STMT,	RETURN_STMT,	\
     BREAK_STMT,		CONTINUE_STMT,	SWITCH_STMT
--- 994,1000 ----
  #undef DEFTREECODE
  
  #define c_common_stmt_codes				\
!    CLEANUP_STMT,	EXPR_STMT,			\
     DECL_STMT,		IF_STMT,	FOR_STMT,	\
     WHILE_STMT,		DO_STMT,	RETURN_STMT,	\
     BREAK_STMT,		CONTINUE_STMT,	SWITCH_STMT
Index: gcc/c-dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-dump.c,v
retrieving revision 1.22
diff -c -p -d -r1.22 c-dump.c
*** gcc/c-dump.c	16 Jun 2004 20:51:37 -0000	1.22
--- gcc/c-dump.c	17 Jun 2004 01:13:44 -0000
*************** c_dump_tree (void *dump_info, tree t)
*** 76,87 ****
        dump_next_stmt (di, t);
        break;
  
-     case COMPOUND_STMT:
-       dump_stmt (di, t);
-       dump_child ("body", COMPOUND_BODY (t));
-       dump_next_stmt (di, t);
-       break;
- 
      case DECL_STMT:
        dump_stmt (di, t);
        dump_child ("decl", DECL_STMT_DECL (t));
--- 76,81 ----
Index: gcc/c-gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-gimplify.c,v
retrieving revision 2.8
diff -c -p -d -r2.8 c-gimplify.c
*** gcc/c-gimplify.c	16 Jun 2004 20:51:37 -0000	2.8
--- gcc/c-gimplify.c	17 Jun 2004 01:13:44 -0000
*************** c_gimplify_stmt (tree *stmt_p)
*** 227,237 ****
  
    switch (TREE_CODE (stmt))
      {
-     case COMPOUND_STMT:
-       stmt = COMPOUND_BODY (stmt);
-       ret = GS_OK;
-       break;
- 
      case FOR_STMT:
        ret = gimplify_for_stmt (&stmt, &pre);
        break;
--- 227,232 ----
Index: gcc/c-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-pretty-print.c,v
retrieving revision 1.46
diff -c -p -d -r1.46 c-pretty-print.c
*** gcc/c-pretty-print.c	16 Jun 2004 20:51:37 -0000	1.46
--- gcc/c-pretty-print.c	17 Jun 2004 01:13:44 -0000
*************** pp_c_statement (c_pretty_printer *pp, tr
*** 1909,1935 ****
        }
        break;
  
-       /* compound-statement:
-             {  block-item-list(opt) }
- 
-          block-item-list:
-             block-item
-             block-item-list block-item
- 
-          block-item:
-             declaration
-             statement   */
-     case COMPOUND_STMT:
-       if (pp_needs_newline (pp))
-         pp_newline_and_indent (pp, 0);
-       pp_c_left_brace (pp);
-       pp_newline_and_indent (pp, 3);
-       pp_statement (pp, COMPOUND_BODY (stmt));
-       pp_newline_and_indent (pp, -3);
-       pp_c_right_brace (pp);
-       pp_needs_newline (pp) = true;
-       break;
- 
        /* expression-statement:
              expression(opt) ;  */
      case EXPR_STMT:
--- 1909,1914 ----
Index: gcc/c-typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-typeck.c,v
retrieving revision 1.318
diff -c -p -d -r1.318 c-typeck.c
*** gcc/c-typeck.c	17 Jun 2004 01:06:03 -0000	1.318
--- gcc/c-typeck.c	17 Jun 2004 01:13:44 -0000
*************** int
*** 2208,2214 ****
  c_tree_expr_nonnegative_p (tree t)
  {
    if (TREE_CODE (t) == STMT_EXPR)
!     t = expr_last (COMPOUND_BODY (STMT_EXPR_STMT (t)));
    return tree_expr_nonnegative_p (t);
  }
  
--- 2208,2214 ----
  c_tree_expr_nonnegative_p (tree t)
  {
    if (TREE_CODE (t) == STMT_EXPR)
!     t = expr_last (STMT_EXPR_STMT (t));
    return tree_expr_nonnegative_p (t);
  }
  
Index: gcc/tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.518
diff -c -p -d -r1.518 tree.h
*** gcc/tree.h	16 Jun 2004 23:03:34 -0000	1.518
--- gcc/tree.h	17 Jun 2004 01:13:45 -0000
*************** struct tree_type GTY(())
*** 1934,1941 ****
  #define DECL_THREAD_LOCAL(NODE) (VAR_DECL_CHECK (NODE)->decl.thread_local_flag)
  
  /* In a FUNCTION_DECL, the saved representation of the body of the
!    entire function.  Usually a COMPOUND_STMT, but in C++ this may also
!    be a RETURN_INIT, CTOR_INITIALIZER, or TRY_BLOCK.  */
  #define DECL_SAVED_TREE(NODE) (FUNCTION_DECL_CHECK (NODE)->decl.saved_tree)
  
  /* List of FUNCTION_DECLs inlined into this function's body.  */
--- 1934,1940 ----
  #define DECL_THREAD_LOCAL(NODE) (VAR_DECL_CHECK (NODE)->decl.thread_local_flag)
  
  /* In a FUNCTION_DECL, the saved representation of the body of the
!    entire function.  */
  #define DECL_SAVED_TREE(NODE) (FUNCTION_DECL_CHECK (NODE)->decl.saved_tree)
  
  /* List of FUNCTION_DECLs inlined into this function's body.  */
Index: gcc/cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.977
diff -c -p -d -r1.977 cp-tree.h
*** gcc/cp/cp-tree.h	16 Jun 2004 01:21:29 -0000	1.977
--- gcc/cp/cp-tree.h	17 Jun 2004 01:13:45 -0000
*************** struct diagnostic_context;
*** 50,56 ****
        KOENIG_LOOKUP_P (in CALL_EXPR)
        STATEMENT_LIST_NO_SCOPE (in STATEMENT_LIST).
        EXPR_STMT_STMT_EXPR_RESULT (in EXPR_STMT)
!       COMPOUND_STMT_TRY_BLOCK (in COMPOUND_STMT)
     1: IDENTIFIER_VIRTUAL_P.
        TI_PENDING_TEMPLATE_FLAG.
        TEMPLATE_PARMS_FOR_INLINE.
--- 50,56 ----
        KOENIG_LOOKUP_P (in CALL_EXPR)
        STATEMENT_LIST_NO_SCOPE (in STATEMENT_LIST).
        EXPR_STMT_STMT_EXPR_RESULT (in EXPR_STMT)
!       BIND_EXPR_TRY_BLOCK (in BIND_EXPR)
     1: IDENTIFIER_VIRTUAL_P.
        TI_PENDING_TEMPLATE_FLAG.
        TEMPLATE_PARMS_FOR_INLINE.
*************** struct diagnostic_context;
*** 74,80 ****
        ICS_BAD_FLAG (in _CONV)
        FN_TRY_BLOCK_P (in TRY_BLOCK)
        IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE)
!       COMPOUND_STMT_BODY_BLOCK (in COMPOUND_STMT)
     4: BINFO_NEW_VTABLE_MARKED.
        TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
            or FIELD_DECL).
--- 74,80 ----
        ICS_BAD_FLAG (in _CONV)
        FN_TRY_BLOCK_P (in TRY_BLOCK)
        IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE)
!       BIND_EXPR_BODY_BLOCK (in BIND_EXPR)
     4: BINFO_NEW_VTABLE_MARKED.
        TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
            or FIELD_DECL).
*************** typedef struct ptrmem_cst * ptrmem_cst_t
*** 271,282 ****
  
  #define CLEANUP_P(NODE)         TREE_LANG_FLAG_0 (TRY_BLOCK_CHECK (NODE))
  
! #define COMPOUND_STMT_TRY_BLOCK(NODE) \
!   TREE_LANG_FLAG_0 (COMPOUND_STMT_CHECK (NODE))
  
  /* Used to mark the block around the member initializers and cleanups.  */
! #define COMPOUND_STMT_BODY_BLOCK(NODE) \
!   TREE_LANG_FLAG_3 (COMPOUND_STMT_CHECK (NODE))
  
  #define STATEMENT_LIST_NO_SCOPE(NODE) \
    TREE_LANG_FLAG_0 (STATEMENT_LIST_CHECK (NODE))
--- 271,282 ----
  
  #define CLEANUP_P(NODE)         TREE_LANG_FLAG_0 (TRY_BLOCK_CHECK (NODE))
  
! #define BIND_EXPR_TRY_BLOCK(NODE) \
!   TREE_LANG_FLAG_0 (BIND_EXPR_CHECK (NODE))
  
  /* Used to mark the block around the member initializers and cleanups.  */
! #define BIND_EXPR_BODY_BLOCK(NODE) \
!   TREE_LANG_FLAG_3 (BIND_EXPR_CHECK (NODE))
  
  #define STATEMENT_LIST_NO_SCOPE(NODE) \
    TREE_LANG_FLAG_0 (STATEMENT_LIST_CHECK (NODE))
Index: gcc/cp/cxx-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cxx-pretty-print.c,v
retrieving revision 1.21
diff -c -p -d -r1.21 cxx-pretty-print.c
*** gcc/cp/cxx-pretty-print.c	10 Jun 2004 18:28:52 -0000	1.21
--- gcc/cp/cxx-pretty-print.c	17 Jun 2004 01:13:45 -0000
*************** pp_cxx_function_definition (cxx_pretty_p
*** 1304,1320 ****
    pp_needs_newline (pp) = true;
    pp->enclosing_scope = DECL_CONTEXT (t);
    if (DECL_SAVED_TREE (t))
!     {
!       tree body = DECL_SAVED_TREE (t);
!       if (TREE_CODE (body) == COMPOUND_STMT
!           && TREE_CODE (COMPOUND_BODY (body)) == CTOR_INITIALIZER)
!         {
!           body = COMPOUND_BODY (body);
!           pp_cxx_ctor_initializer (pp, body);
!           body = TREE_CHAIN (body);
!         }
!       pp_cxx_statement (pp, body);
!     }
    else
      {
        pp_cxx_semicolon (pp);
--- 1304,1310 ----
    pp_needs_newline (pp) = true;
    pp->enclosing_scope = DECL_CONTEXT (t);
    if (DECL_SAVED_TREE (t))
!     pp_cxx_statement (pp, DECL_SAVED_TREE (t));
    else
      {
        pp_cxx_semicolon (pp);
*************** pp_cxx_statement (cxx_pretty_printer *pp
*** 1471,1476 ****
--- 1461,1470 ----
  {
    switch (TREE_CODE (t))
      {
+     case CTOR_INITIALIZER:
+       pp_cxx_ctor_initializer (pp, t);
+       break;
+ 
      case USING_STMT:
        pp_cxx_identifier (pp, "using");
        pp_cxx_identifier (pp, "namespace");
Index: gcc/cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1219
diff -c -p -d -r1.1219 decl.c
*** gcc/cp/decl.c	16 Jun 2004 18:21:13 -0000	1.1219
--- gcc/cp/decl.c	17 Jun 2004 01:13:45 -0000
*************** begin_function_body (void)
*** 10618,10624 ****
      keep_next_level (true);
  
    stmt = begin_compound_stmt (BCS_FN_BODY);
-   COMPOUND_STMT_BODY_BLOCK (stmt) = 1;
  
    if (processing_template_decl)
      /* Do nothing now.  */;
--- 10618,10623 ----
*************** finish_function (int flags)
*** 10743,10749 ****
  
        /* Throw away the broken statement tree and extra binding
           levels.  */
!       DECL_SAVED_TREE (fndecl) = build_stmt (COMPOUND_STMT, NULL_TREE);
  
        while (current_binding_level->kind != sk_function_parms)
  	{
--- 10742,10748 ----
  
        /* Throw away the broken statement tree and extra binding
           levels.  */
!       DECL_SAVED_TREE (fndecl) = alloc_stmt_list ();
  
        while (current_binding_level->kind != sk_function_parms)
  	{
Index: gcc/cp/parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.210
diff -c -p -d -r1.210 parser.c
*** gcc/cp/parser.c	16 Jun 2004 20:51:44 -0000	1.210
--- gcc/cp/parser.c	17 Jun 2004 01:13:46 -0000
*************** cp_parser_expression_statement (cp_parse
*** 5841,5847 ****
     compound-statement:
       { statement-seq [opt] }
  
!    Returns a COMPOUND_STMT representing the statement.  */
  
  static tree
  cp_parser_compound_statement (cp_parser *parser, tree in_statement_expr,
--- 5841,5847 ----
     compound-statement:
       { statement-seq [opt] }
  
!    Returns a tree representing the statement.  */
  
  static tree
  cp_parser_compound_statement (cp_parser *parser, tree in_statement_expr,
Index: gcc/cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.867
diff -c -p -d -r1.867 pt.c
*** gcc/cp/pt.c	16 Jun 2004 22:07:03 -0000	1.867
--- gcc/cp/pt.c	17 Jun 2004 01:13:47 -0000
*************** tsubst_expr (tree t, tree args, tsubst_f
*** 7931,7948 ****
        }
        break;
  
!     case COMPOUND_STMT:
        {
  	prep_stmt (t);
! 	if (COMPOUND_STMT_BODY_BLOCK (t))
  	  stmt = begin_function_body ();
  	else
! 	  stmt = begin_compound_stmt (COMPOUND_STMT_TRY_BLOCK (t)
  				      ? BCS_TRY_BLOCK : 0);
  
! 	tsubst_expr (COMPOUND_BODY (t), args, complain, in_decl);
  
! 	if (COMPOUND_STMT_BODY_BLOCK (t))
  	  finish_function_body (stmt);
  	else
  	  finish_compound_stmt (stmt);
--- 7931,7948 ----
        }
        break;
  
!     case BIND_EXPR:
        {
  	prep_stmt (t);
! 	if (BIND_EXPR_BODY_BLOCK (t))
  	  stmt = begin_function_body ();
  	else
! 	  stmt = begin_compound_stmt (BIND_EXPR_TRY_BLOCK (t)
  				      ? BCS_TRY_BLOCK : 0);
  
! 	tsubst_expr (BIND_EXPR_BODY (t), args, complain, in_decl);
  
! 	if (BIND_EXPR_BODY_BLOCK (t))
  	  finish_function_body (stmt);
  	else
  	  finish_compound_stmt (stmt);
Index: gcc/cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.400
diff -c -p -d -r1.400 semantics.c
*** gcc/cp/semantics.c	16 Jun 2004 20:23:02 -0000	1.400
--- gcc/cp/semantics.c	17 Jun 2004 01:13:47 -0000
*************** finish_handler (tree handler)
*** 950,958 ****
    HANDLER_BODY (handler) = do_poplevel (HANDLER_BODY (handler));
  }
  
! /* Begin a compound-statement.  If HAS_NO_SCOPE is true, the
!    compound-statement does not define a scope.  Returns a new
!    COMPOUND_STMT.  */
  
  tree
  begin_compound_stmt (unsigned int flags)
--- 950,961 ----
    HANDLER_BODY (handler) = do_poplevel (HANDLER_BODY (handler));
  }
  
! /* Begin a compound statement.  FLAGS contains some bits that control the
!    behaviour and context.  If BCS_NO_SCOPE is set, the compound statement
!    does not define a scope.  If BCS_FN_BODY is set, this is the outermost
!    block of a function.  If BCS_TRY_BLOCK is set, this is the block 
!    created on behalf of a TRY statement.  Returns a token to be passed to
!    finish_compound_stmt.  */
  
  tree
  begin_compound_stmt (unsigned int flags)
*************** begin_compound_stmt (unsigned int flags)
*** 973,996 ****
    else
      r = do_pushlevel (flags & BCS_TRY_BLOCK ? sk_try : sk_block);
  
!   if (flags & BCS_FN_BODY || processing_template_decl)
      {
!       r = build (COMPOUND_STMT, NULL_TREE, r);
!       COMPOUND_STMT_TRY_BLOCK (r) = (flags & BCS_TRY_BLOCK) != 0;
!       COMPOUND_STMT_BODY_BLOCK (r) = (flags & BCS_FN_BODY) != 0;
        TREE_SIDE_EFFECTS (r) = 1;
      }
  
    return r;
  }
  
! /* Finish a compound-statement, which is given by COMPOUND_STMT.  */
  
  void
  finish_compound_stmt (tree stmt)
  {
!   if (TREE_CODE (stmt) == COMPOUND_STMT)
!     COMPOUND_BODY (stmt) = do_poplevel (COMPOUND_BODY (stmt));
    else if (STATEMENT_LIST_NO_SCOPE (stmt))
      stmt = pop_stmt_list (stmt);
    else
--- 976,1005 ----
    else
      r = do_pushlevel (flags & BCS_TRY_BLOCK ? sk_try : sk_block);
  
!   /* When processing a template, we need to remember where the braces were,
!      so that we can set up identical scopes when instantiating the template
!      later.  BIND_EXPR is a handy candidate for this.
!      Note that do_poplevel won't create a BIND_EXPR itself here (and thus
!      result in nested BIND_EXPRs), since we don't build BLOCK nodes when
!      processing templates.  */
!   if (processing_template_decl)
      {
!       r = build (BIND_EXPR, NULL, NULL, r, NULL);
!       BIND_EXPR_TRY_BLOCK (r) = (flags & BCS_TRY_BLOCK) != 0;
!       BIND_EXPR_BODY_BLOCK (r) = (flags & BCS_FN_BODY) != 0;
        TREE_SIDE_EFFECTS (r) = 1;
      }
  
    return r;
  }
  
! /* Finish a compound-statement, which is given by STMT.  */
  
  void
  finish_compound_stmt (tree stmt)
  {
!   if (TREE_CODE (stmt) == BIND_EXPR)
!     BIND_EXPR_BODY (stmt) = do_poplevel (BIND_EXPR_BODY (stmt));
    else if (STATEMENT_LIST_NO_SCOPE (stmt))
      stmt = pop_stmt_list (stmt);
    else
*************** finish_stmt_expr (tree stmt_expr, bool h
*** 1456,1464 ****
  	    case BIND_EXPR:
  	      result_stmt_p = &BIND_EXPR_BODY (t);
  	      break;
- 	    case COMPOUND_STMT:
- 	      result_stmt_p = &COMPOUND_BODY (t);
- 	      break;
  	    case TRY_FINALLY_EXPR:
  	    case TRY_CATCH_EXPR:
  	    case CLEANUP_STMT:
--- 1465,1470 ----
Index: gcc/doc/c-tree.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/c-tree.texi,v
retrieving revision 1.56
diff -c -p -d -r1.56 c-tree.texi
*** gcc/doc/c-tree.texi	30 May 2004 22:20:07 -0000	1.56
--- gcc/doc/c-tree.texi	17 Jun 2004 01:13:47 -0000
*************** This predicate holds if the function an 
*** 1272,1289 ****
  @subsection Function Bodies
  @cindex function body
  @cindex statements
- @tindex ASM_STMT
- @findex ASM_STRING
- @findex ASM_CV_QUAL
- @findex ASM_INPUTS
- @findex ASM_OUTPUTS
- @findex ASM_CLOBBERS
  @tindex BREAK_STMT
  @tindex CLEANUP_STMT
  @findex CLEANUP_DECL
  @findex CLEANUP_EXPR
- @tindex COMPOUND_STMT
- @findex COMPOUND_BODY
  @tindex CONTINUE_STMT
  @tindex DECL_STMT
  @findex DECL_STMT_DECL
--- 1272,1281 ----
*************** This predicate holds if the function an 
*** 1298,1320 ****
  @findex FOR_COND
  @findex FOR_EXPR
  @findex FOR_BODY
- @tindex GOTO_STMT
- @findex GOTO_DESTINATION
- @findex GOTO_FAKE_P
  @tindex HANDLER
  @tindex IF_STMT
  @findex IF_COND
  @findex THEN_CLAUSE
  @findex ELSE_CLAUSE
- @tindex LABEL_STMT
- @tindex LABEL_STMT_LABEL
  @tindex RETURN_INIT
  @tindex RETURN_STMT
  @findex RETURN_EXPR
- @tindex SCOPE_STMT
- @findex SCOPE_BEGIN_P
- @findex SCOPE_END_P
- @findex SCOPE_NULLIFIED_P
  @tindex SUBOBJECT
  @findex SUBOBJECT_CLEANUP
  @tindex SWITCH_STMT
--- 1290,1303 ----
*************** have a non-@code{NULL} @code{DECL_INITIA
*** 1335,1343 ****
  use of the particular value given by @code{DECL_INITIAL}.
  
  The @code{DECL_SAVED_TREE} macro will give the complete body of the
! function.  This node will usually be a @code{COMPOUND_STMT} representing
! the outermost block of the function, but it may also be a
! @code{TRY_BLOCK}, a @code{RETURN_INIT}, or any other valid statement.
  
  @subsubsection Statements
  
--- 1318,1324 ----
  use of the particular value given by @code{DECL_INITIAL}.
  
  The @code{DECL_SAVED_TREE} macro will give the complete body of the
! function.
  
  @subsubsection Statements
  
*************** compound statement), the intermediate re
*** 1398,1404 ****
  several statements chained together.
  
  @table @code
! @item ASM_STMT
  
  Used to represent an inline assembly statement.  For an inline assembly
  statement like:
--- 1379,1385 ----
  several statements chained together.
  
  @table @code
! @item ASM_EXPR
  
  Used to represent an inline assembly statement.  For an inline assembly
  statement like:
*************** embedded @code{NUL}-characters.
*** 1425,1438 ****
  If the assembly statement is declared @code{volatile}, or if the
  statement was not an extended assembly statement, and is therefore
  implicitly volatile, then the predicate @code{ASM_VOLATILE_P} will hold
! of the @code{ASM_STMT}.
  
  @item BREAK_STMT
  
  Used to represent a @code{break} statement.  There are no additional
  fields.
  
! @item CASE_LABEL
  
  Use to represent a @code{case} label, range of @code{case} labels, or a
  @code{default} label.  If @code{CASE_LOW} is @code{NULL_TREE}, then this is a
--- 1406,1419 ----
  If the assembly statement is declared @code{volatile}, or if the
  statement was not an extended assembly statement, and is therefore
  implicitly volatile, then the predicate @code{ASM_VOLATILE_P} will hold
! of the @code{ASM_EXPR}.
  
  @item BREAK_STMT
  
  Used to represent a @code{break} statement.  There are no additional
  fields.
  
! @item CASE_LABEL_EXPR
  
  Use to represent a @code{case} label, range of @code{case} labels, or a
  @code{default} label.  If @code{CASE_LOW} is @code{NULL_TREE}, then this is a
*************** expression to execute.  The cleanups exe
*** 1463,1476 ****
  should be run in the reverse order of the order in which the associated
  @code{CLEANUP_STMT}s were encountered.
  
- @item COMPOUND_STMT
- 
- Used to represent a brace-enclosed block.  The first substatement is
- given by @code{COMPOUND_BODY}.  Subsequent substatements are found by
- following the @code{TREE_CHAIN} link from one substatement to the next.
- The @code{COMPOUND_BODY} will be @code{NULL_TREE} if there are no
- substatements.
- 
  @item CONTINUE_STMT
  
  Used to represent a @code{continue} statement.  There are no additional
--- 1444,1449 ----
*************** expression increments a counter.  The bo
*** 1521,1535 ****
  return statements, while @code{FOR_COND} and @code{FOR_EXPR} return
  expressions.
  
! @item GOTO_STMT
  
  Used to represent a @code{goto} statement.  The @code{GOTO_DESTINATION} will
  usually be a @code{LABEL_DECL}.  However, if the ``computed goto'' extension
  has been used, the @code{GOTO_DESTINATION} will be an arbitrary expression
  indicating the destination.  This expression will always have pointer type.
- Additionally the @code{GOTO_FAKE_P} flag is set whenever the goto statement
- does not come from source code, but it is generated implicitly by the compiler.
- This is used for branch prediction.
  
  @item HANDLER
  
--- 1494,1505 ----
  return statements, while @code{FOR_COND} and @code{FOR_EXPR} return
  expressions.
  
! @item GOTO_EXPR
  
  Used to represent a @code{goto} statement.  The @code{GOTO_DESTINATION} will
  usually be a @code{LABEL_DECL}.  However, if the ``computed goto'' extension
  has been used, the @code{GOTO_DESTINATION} will be an arbitrary expression
  indicating the destination.  This expression will always have pointer type.
  
  @item HANDLER
  
*************** Used to represent a C++ @code{catch} blo
*** 1537,1544 ****
  is the type of exception that will be caught by this handler; it is
  equal (by pointer equality) to @code{NULL} if this handler is for all
  types.  @code{HANDLER_PARMS} is the @code{DECL_STMT} for the catch
! parameter, and @code{HANDLER_BODY} is the @code{COMPOUND_STMT} for the
! block itself.
  
  @item IF_STMT
  
--- 1507,1513 ----
  is the type of exception that will be caught by this handler; it is
  equal (by pointer equality) to @code{NULL} if this handler is for all
  types.  @code{HANDLER_PARMS} is the @code{DECL_STMT} for the catch
! parameter, and @code{HANDLER_BODY} is the code for the block itself.
  
  @item IF_STMT
  
*************** The @code{THEN_CLAUSE} represents the st
*** 1562,1571 ****
  condition, while the @code{ELSE_CLAUSE} represents the statement given
  by the @code{else} condition.
  
! @item LABEL_STMT
  
  Used to represent a label.  The @code{LABEL_DECL} declared by this
! statement can be obtained with the @code{LABEL_STMT_LABEL} macro.  The
  @code{IDENTIFIER_NODE} giving the name of the label can be obtained from
  the @code{LABEL_DECL} with @code{DECL_NAME}.
  
--- 1531,1540 ----
  condition, while the @code{ELSE_CLAUSE} represents the statement given
  by the @code{else} condition.
  
! @item LABEL_EXPR
  
  Used to represent a label.  The @code{LABEL_DECL} declared by this
! statement can be obtained with the @code{LABEL_EXPR_LABEL} macro.  The
  @code{IDENTIFIER_NODE} giving the name of the label can be obtained from
  the @code{LABEL_DECL} with @code{DECL_NAME}.
  
*************** was just
*** 1594,1610 ****
  return;
  @end smallexample
  
- @item SCOPE_STMT
- 
- A scope-statement represents the beginning or end of a scope.  If
- @code{SCOPE_BEGIN_P} holds, this statement represents the beginning of a
- scope; if @code{SCOPE_END_P} holds this statement represents the end of
- a scope.  On exit from a scope, all cleanups from @code{CLEANUP_STMT}s
- occurring in the scope must be run, in reverse order to the order in
- which they were encountered.  If @code{SCOPE_NULLIFIED_P} or
- @code{SCOPE_NO_CLEANUPS_P} holds of the scope, back ends should behave
- as if the @code{SCOPE_STMT} were not present at all.
- 
  @item SUBOBJECT
  
  In a constructor, these nodes are used to mark the point at which a
--- 1563,1568 ----
*************** int f() @{ return (@{ int j; j = 3; j + 
*** 2259,2269 ****
  In other words, an sequence of statements may occur where a single
  expression would normally appear.  The @code{STMT_EXPR} node represents
  such an expression.  The @code{STMT_EXPR_STMT} gives the statement
! contained in the expression; this is always a @code{COMPOUND_STMT}.  The
! value of the expression is the value of the last sub-statement in the
! @code{COMPOUND_STMT}.  More precisely, the value is the value computed
! by the last @code{EXPR_STMT} in the outermost scope of the
! @code{COMPOUND_STMT}.  For example, in:
  @smallexample
  (@{ 3; @})
  @end smallexample
--- 2217,2226 ----
  In other words, an sequence of statements may occur where a single
  expression would normally appear.  The @code{STMT_EXPR} node represents
  such an expression.  The @code{STMT_EXPR_STMT} gives the statement
! contained in the expression.  The value of the expression is the value
! of the last sub-statement in the body.  More precisely, the value is the
! value computed by the last statement nested inside @code{BIND_EXPR},
! @code{TRY_FINALLY_EXPR}, or @code{TRY_CATCH_EXPR}.  For example, in:
  @smallexample
  (@{ 3; @})
  @end smallexample
*************** the value is @code{3} while in:
*** 2271,2279 ****
  @smallexample
  (@{ if (x) @{ 3; @} @})
  @end smallexample
! (represented by a nested @code{COMPOUND_STMT}), there is no value.  If
! the @code{STMT_EXPR} does not yield a value, it's type will be
! @code{void}.
  
  @item BIND_EXPR
  These nodes represent local blocks.  The first operand is a list of
--- 2228,2235 ----
  @smallexample
  (@{ if (x) @{ 3; @} @})
  @end smallexample
! there is no value.  If the @code{STMT_EXPR} does not yield a value,
! it's type will be @code{void}.
  
  @item BIND_EXPR
  These nodes represent local blocks.  The first operand is a list of
Index: gcc/objc/objc-act.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/objc/objc-act.c,v
retrieving revision 1.220
diff -c -p -d -r1.220 objc-act.c
*** gcc/objc/objc-act.c	17 Jun 2004 01:06:04 -0000	1.220
--- gcc/objc/objc-act.c	17 Jun 2004 01:13:47 -0000
*************** objc_build_try_catch_finally_stmt (int h
*** 3144,3151 ****
    /* NB: The operative assumption here is that TRY_FINALLY_EXPR will
       deal with all exits from 'try_catch_blk' and route them through
       'finally_blk'.  */
    tree outer_blk = objc_build_finally_epilogue ();
!   tree prec_stmt = TREE_CHAIN (TREE_CHAIN (COMPOUND_BODY (outer_blk)));
    tree try_catch_blk = TREE_CHAIN (prec_stmt), try_catch_expr;
    tree finally_blk = TREE_CHAIN (try_catch_blk), finally_expr;
    tree succ_stmt = TREE_CHAIN (finally_blk);
--- 3144,3152 ----
    /* NB: The operative assumption here is that TRY_FINALLY_EXPR will
       deal with all exits from 'try_catch_blk' and route them through
       'finally_blk'.  */
+   /* ??? This is all crock.  What the hell is this trying to do?  */
    tree outer_blk = objc_build_finally_epilogue ();
!   tree prec_stmt = TREE_CHAIN (TREE_CHAIN (outer_blk));
    tree try_catch_blk = TREE_CHAIN (prec_stmt), try_catch_expr;
    tree finally_blk = TREE_CHAIN (try_catch_blk), finally_expr;
    tree succ_stmt = TREE_CHAIN (finally_blk);



More information about the Gcc-patches mailing list