diff options
| -rw-r--r-- | gcc/ChangeLog | 19 | ||||
| -rw-r--r-- | gcc/c-common.def | 6 | ||||
| -rw-r--r-- | gcc/c-common.h | 9 | ||||
| -rw-r--r-- | gcc/c-decl.c | 2 | ||||
| -rw-r--r-- | gcc/c-dump.c | 23 | ||||
| -rw-r--r-- | gcc/c-gimplify.c | 16 | ||||
| -rw-r--r-- | gcc/c-parse.in | 4 | ||||
| -rw-r--r-- | gcc/c-pretty-print.c | 17 | ||||
| -rw-r--r-- | gcc/c-semantics.c | 8 | ||||
| -rw-r--r-- | gcc/c-tree.h | 1 | ||||
| -rw-r--r-- | gcc/c-typeck.c | 19 | ||||
| -rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
| -rw-r--r-- | gcc/cp/cp-gimplify.c | 2 | ||||
| -rw-r--r-- | gcc/cp/dump.c | 7 | ||||
| -rw-r--r-- | gcc/cp/parser.c | 2 | ||||
| -rw-r--r-- | gcc/cp/pt.c | 4 | ||||
| -rw-r--r-- | gcc/cp/semantics.c | 12 | ||||
| -rw-r--r-- | gcc/cp/typeck.c | 6 | ||||
| -rw-r--r-- | gcc/cp/typeck2.c | 6 | ||||
| -rw-r--r-- | gcc/tree-dump.h | 1 | 
20 files changed, 55 insertions, 118 deletions
| diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1a103fef78c..161dba3f8b0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2004-06-21  Richard Henderson  <rth@redhat.com> + +	* c-common.def (RETURN_STMT): Remove. +	* c-common.h (RETURN_STMT_EXPR): Remove. +	(c_expand_return, build_return_stmt): Remove. +	(c_common_stmt_codes): Remove RETURN_STMT. +	* c-dump.c (dump_next_stmt): Remove. +	(c_dump_tree): Remove RETURN_STMT. +	* c-decl.c (finish_function): Use c_finish_return. +	* c-parse.in (stmt): Likewise. +	* c-gimplify.c (gimplify_return_stmt): Remove. +	(c_gimplify_expr): Remove RETURN_STMT. +	* c-pretty-print.c (pp_c_statement): Likewise. +	* c-semantics.c (build_return_stmt): Remove. +	* c-tree.h (c_finish_return): Declare. +	* c-typeck.c (c_finish_return): Rename from c_expand_return. +	Return void.  Build RETURN_EXPR directly. +	* tree-dump.h (dump_next_stmt): Remove. +  2004-06-21  Zack Weinberg  <zack@codesourcery.com>  	* c-decl.c (start_function): Don't call make_decl_rtl.  Don't diff --git a/gcc/c-common.def b/gcc/c-common.def index 62dd05703cf..5d8c237831d 100644 --- a/gcc/c-common.def +++ b/gcc/c-common.def @@ -2,7 +2,7 @@     additional tree codes used in the GNU C++ compiler (see tree.def     for the standard codes).     Copyright (C) 1987, 1988, 1990, 1993, 1997, 1998, -   1999, 2000, 2001 Free Software Foundation, Inc. +   1999, 2000, 2001, 2004 Free Software Foundation, Inc.     Written by Benjamin Chelf <chelf@codesourcery.com>  This file is part of GCC. @@ -49,10 +49,6 @@ DEFTREECODE (WHILE_STMT, "while_stmt", 'e', 2)     DO_COND, respectively.  */  DEFTREECODE (DO_STMT, "do_stmt", 'e', 2) -/* Used to represent a 'return' statement. The operand is -   RETURN_STMT_EXPR.  */ -DEFTREECODE (RETURN_STMT, "return_stmt", 'e', 1) -  /* Used to represent a 'break' statement.  */  DEFTREECODE (BREAK_STMT, "break_stmt", 'e', 0) diff --git a/gcc/c-common.h b/gcc/c-common.h index 27733aa7c5c..bd0a5b36a0e 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -930,11 +930,6 @@ extern void finish_file	(void);  #define DO_COND(NODE)           TREE_OPERAND (DO_STMT_CHECK (NODE), 0)  #define DO_BODY(NODE)           TREE_OPERAND (DO_STMT_CHECK (NODE), 1) -/* RETURN_STMT accessors. These give the expression associated with a -   return statement, and whether it should be ignored when expanding -   (as opposed to inlining).  */ -#define RETURN_STMT_EXPR(NODE)  TREE_OPERAND (RETURN_STMT_CHECK (NODE), 0) -  /* EXPR_STMT accessor. This gives the expression associated with an     expression statement.  */  #define EXPR_STMT_EXPR(NODE)    TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0) @@ -978,7 +973,7 @@ enum c_tree_code {  #define c_common_stmt_codes				\     EXPR_STMT,		DECL_STMT,	FOR_STMT,	\ -   WHILE_STMT,		DO_STMT,	RETURN_STMT,	\ +   WHILE_STMT,		DO_STMT,			\     BREAK_STMT,		CONTINUE_STMT,	SWITCH_STMT  /* TRUE if a code represents a statement.  The front end init @@ -1012,13 +1007,11 @@ extern int anon_aggr_type_p (tree);  extern void emit_local_var (tree);  extern void make_rtl_for_local_static (tree); -extern tree c_expand_return (tree);  extern tree do_case (tree, tree);  extern tree build_stmt (enum tree_code, ...);  extern tree build_case_label (tree, tree, tree);  extern tree build_continue_stmt (void);  extern tree build_break_stmt (void); -extern tree build_return_stmt (tree);  extern void c_expand_asm_operands (tree, tree, tree, tree, int, location_t); diff --git a/gcc/c-decl.c b/gcc/c-decl.c index d9d4368c705..ec1778bc35c 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6242,7 +6242,7 @@ finish_function (void)  	  DEFAULT_MAIN_RETURN;  #else  	  if (flag_isoc99) -	    c_expand_return (integer_zero_node); +	    c_finish_return (integer_zero_node);  #endif  	}      } diff --git a/gcc/c-dump.c b/gcc/c-dump.c index 18a8887295f..91acac844c7 100644 --- a/gcc/c-dump.c +++ b/gcc/c-dump.c @@ -1,5 +1,5 @@  /* Tree-dumping functionality for C-family languages. -   Copyright (C) 2002 Free Software Foundation, Inc. +   Copyright (C) 2002, 2004 Free Software Foundation, Inc.     Written by Mark Mitchell <mark@codesourcery.com>  This file is part of GCC. @@ -37,14 +37,6 @@ dump_stmt (dump_info_p di, tree t)      dump_int (di, "line", locus->line);  } -/* Dump the next statement after STMT.  */ - -void -dump_next_stmt (dump_info_p di, tree t) -{ -  dump_child ("next", TREE_CHAIN (t)); -} -  /* Dump any C-specific tree codes and attributes of common codes.  */  bool @@ -66,26 +58,22 @@ c_dump_tree (void *dump_info, tree t)      case BREAK_STMT:      case CONTINUE_STMT:        dump_stmt (di, t); -      dump_next_stmt (di, t);        break;      case DECL_STMT:        dump_stmt (di, t);        dump_child ("decl", DECL_STMT_DECL (t)); -      dump_next_stmt (di, t);        break;      case DO_STMT:        dump_stmt (di, t);        dump_child ("body", DO_BODY (t));        dump_child ("cond", DO_COND (t)); -      dump_next_stmt (di, t);        break;      case EXPR_STMT:        dump_stmt (di, t);        dump_child ("expr", EXPR_STMT_EXPR (t)); -      dump_next_stmt (di, t);        break;      case FOR_STMT: @@ -94,27 +82,18 @@ c_dump_tree (void *dump_info, tree t)        dump_child ("cond", FOR_COND (t));        dump_child ("expr", FOR_EXPR (t));        dump_child ("body", FOR_BODY (t)); -      dump_next_stmt (di, t); -      break; - -    case RETURN_STMT: -      dump_stmt (di, t); -      dump_child ("expr", RETURN_STMT_EXPR (t)); -      dump_next_stmt (di, t);        break;      case SWITCH_STMT:        dump_stmt (di, t);        dump_child ("cond", SWITCH_COND (t));        dump_child ("body", SWITCH_BODY (t)); -      dump_next_stmt (di, t);        break;      case WHILE_STMT:        dump_stmt (di, t);        dump_child ("cond", WHILE_COND (t));        dump_child ("body", WHILE_BODY (t)); -      dump_next_stmt (di, t);        break;      case STMT_EXPR: diff --git a/gcc/c-gimplify.c b/gcc/c-gimplify.c index 9259923794f..359733116c4 100644 --- a/gcc/c-gimplify.c +++ b/gcc/c-gimplify.c @@ -2,7 +2,7 @@     by the C-based front ends.  The structure of gimplified, or     language-independent, trees is dictated by the grammar described in this     file. -   Copyright (C) 2002, 2003 Free Software Foundation, Inc. +   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.     Lowering of expressions contributed by Sebastian Pop <s.pop@laposte.net>     Re-written to support lowering of whole function trees, documentation     and miscellaneous cleanups by Diego Novillo <dnovillo@redhat.com> @@ -467,17 +467,6 @@ gimplify_switch_stmt (tree *stmt_p)    return GS_ALL_DONE;  } -/* Genericize a RETURN_STMT by turning it into a RETURN_EXPR.  */ - -static enum gimplify_status -gimplify_return_stmt (tree *stmt_p) -{ -  tree expr = RETURN_STMT_EXPR (*stmt_p); -  expr = build1 (RETURN_EXPR, void_type_node, expr); -  *stmt_p = expr; -  return GS_OK; -} -  /* Gimplifies a DECL_STMT node *STMT_P by making any necessary allocation     and initialization explicit.  */ @@ -614,9 +603,6 @@ c_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p ATTRIBUTE_UNUSED)      case EXPR_STMT:        return gimplify_expr_stmt (expr_p); -    case RETURN_STMT: -      return gimplify_return_stmt (expr_p); -      case DECL_STMT:        return gimplify_decl_stmt (expr_p); diff --git a/gcc/c-parse.in b/gcc/c-parse.in index ce8829a0321..b7acb711718 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -2242,9 +2242,9 @@ stmt:  		  else  		    add_stmt (build_continue_stmt ()); }  	| RETURN ';' -                { stmt_count++; c_expand_return (NULL_TREE); } +                { stmt_count++; c_finish_return (NULL_TREE); }  	| RETURN expr ';' -                { stmt_count++; c_expand_return ($2); } +                { stmt_count++; c_finish_return ($2); }  	| asm_stmt  	| GOTO identifier ';'  		{ tree decl; diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c index 7ecbe6b08da..4d0b06d5de9 100644 --- a/gcc/c-pretty-print.c +++ b/gcc/c-pretty-print.c @@ -1982,23 +1982,6 @@ pp_c_statement (c_pretty_printer *pp, tree stmt)        pp_needs_newline (pp) = true;        break; -    case RETURN_STMT: -      { -	tree e = RETURN_STMT_EXPR (stmt); -	pp_c_identifier (pp, "return"); -        pp_c_whitespace (pp); -	if (e) -          { -            if (TREE_CODE (e) == INIT_EXPR -                && TREE_CODE (TREE_OPERAND (e, 0)) == RESULT_DECL) -              e = TREE_OPERAND (e, 1); -            pp_expression (pp, e); -          } -	pp_c_semicolon (pp); -	pp_needs_newline (pp) = true; -      } -      break; -      case DECL_STMT:        pp_declaration (pp, DECL_STMT_DECL (stmt));        pp_needs_newline (pp) = true; diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c index bda5161bbe4..ee04417ad08 100644 --- a/gcc/c-semantics.c +++ b/gcc/c-semantics.c @@ -247,14 +247,6 @@ emit_local_var (tree decl)      }  } -/* Build the node for a return statement and return it.  */ - -tree -build_return_stmt (tree expr) -{ -  return (build_stmt (RETURN_STMT, expr)); -} -  /* Build a break statement node and return it.  */  tree diff --git a/gcc/c-tree.h b/gcc/c-tree.h index 03d84dd6672..052275ab96f 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -272,6 +272,7 @@ extern void c_finish_for_stmt (tree, tree);  extern tree c_begin_stmt_expr (void);  extern tree c_finish_stmt_expr (tree);  extern void c_finish_expr_stmt (tree); +extern void c_finish_return (tree);  extern tree build_offsetof (tree, tree);  /* Set to 0 at beginning of a function definition, set to 1 if diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 91423dda0c7..e619fa13ea5 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -23,11 +23,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA  /* This file is part of the C front end.     It contains routines to build C expressions given their operands,     including computing the types of the result, C-specific error checks, -   and some optimization. - -   There are also routines to build RETURN_STMT nodes and CASE_STMT nodes, -   and to process initializations in declarations (since they work -   like a strange sort of assignment).  */ +   and some optimization.  */  #include "config.h"  #include "system.h" @@ -6248,12 +6244,11 @@ c_expand_asm_operands (tree string, tree outputs, tree inputs,    emit_queue ();  } -/* Expand a C `return' statement. -   RETVAL is the expression for what to return, -   or a null pointer for `return;' with no value.  */ +/* Generate a C `return' statement.  RETVAL is the expression for what +   to return, or a null pointer for `return;' with no value.  */ -tree -c_expand_return (tree retval) +void +c_finish_return (tree retval)  {    tree valtype = TREE_TYPE (TREE_TYPE (current_function_decl)); @@ -6282,7 +6277,7 @@ c_expand_return (tree retval)        current_function_returns_value = 1;        if (t == error_mark_node) -	return NULL_TREE; +	return;        inner = t = convert (TREE_TYPE (res), t); @@ -6340,7 +6335,7 @@ c_expand_return (tree retval)        retval = build (MODIFY_EXPR, TREE_TYPE (res), res, t);      } - return add_stmt (build_return_stmt (retval)); +  add_stmt (build_stmt (RETURN_EXPR, retval));  }  struct c_switch { diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 679289af873..029105711b4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,14 @@  2004-06-21  Richard Henderson  <rth@redhat.com> +	* dump.c (cp_dump_tree): Don't use dump_next_stmt. +	* parser.c (cp_parser_jump_statement): Update commentary. +	* pt.c (tsubst_expr): Use RETURN_EXPR. +	* semantics.c (finish_return_stmt): Likewise. +	(finalize_nrv_r): Likewise. +	* typeck.c, typeck2.c: Update file start commentary. + +2004-06-21  Richard Henderson  <rth@redhat.com> +  	* semantics.c (finish_expr_stmt): Call verify_sequence_points.  2004-06-20  Richard Henderson  <rth@redhat.com> diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 8bdf5f4fcc5..f9b236472a8 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -1,6 +1,6 @@  /* C++-specific tree lowering bits; see also c-gimplify.c and tree-gimple.c. -   Copyright (C) 2002, 2003 Free Software Foundation, Inc. +   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.     Contributed by Jason Merrill <jason@redhat.com>  This file is part of GCC. diff --git a/gcc/cp/dump.c b/gcc/cp/dump.c index fd0a847a409..f765c32a6fb 100644 --- a/gcc/cp/dump.c +++ b/gcc/cp/dump.c @@ -366,14 +366,12 @@ cp_dump_tree (void* dump_info, tree t)  	dump_string (di, "cleanup");        dump_child ("body", TRY_STMTS (t));        dump_child ("hdlr", TRY_HANDLERS (t)); -      dump_next_stmt (di, t);        break;      case EH_SPEC_BLOCK:        dump_stmt (di, t);        dump_child ("body", EH_SPEC_STMTS (t));        dump_child ("raises", EH_SPEC_RAISES (t)); -      dump_next_stmt (di, t);        break;      case PTRMEM_CST: @@ -397,19 +395,16 @@ cp_dump_tree (void* dump_info, tree t)        dump_stmt (di, t);        dump_child ("parm", HANDLER_PARMS (t));        dump_child ("body", HANDLER_BODY (t)); -      dump_next_stmt (di, t);        break;      case MUST_NOT_THROW_EXPR:        dump_stmt (di, t);        dump_child ("body", TREE_OPERAND (t, 0)); -      dump_next_stmt (di, t);        break;      case USING_STMT:        dump_stmt (di, t);        dump_child ("nmsp", USING_STMT_NAMESPACE (t)); -      dump_next_stmt (di, t);        break;      case CLEANUP_STMT: @@ -417,7 +412,6 @@ cp_dump_tree (void* dump_info, tree t)        dump_child ("decl", CLEANUP_DECL (t));        dump_child ("expr", CLEANUP_EXPR (t));        dump_child ("body", CLEANUP_BODY (t)); -      dump_next_stmt (di, t);        break;      case IF_STMT: @@ -425,7 +419,6 @@ cp_dump_tree (void* dump_info, tree t)        dump_child ("cond", IF_COND (t));        dump_child ("then", THEN_CLAUSE (t));        dump_child ("else", ELSE_CLAUSE (t)); -      dump_next_stmt (di, t);        break;      default: diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 91512dee5d7..bd6abe8393d 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -6241,7 +6241,7 @@ cp_parser_for_init_statement (cp_parser* parser)     jump-statement:       goto * expression ; -   Returns the new BREAK_STMT, CONTINUE_STMT, RETURN_STMT, or GOTO_EXPR.  */ +   Returns the new BREAK_STMT, CONTINUE_STMT, RETURN_EXPR, or GOTO_EXPR.  */  static tree  cp_parser_jump_statement (cp_parser* parser) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index de4ab281b25..f8e259c6fbc 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7773,8 +7773,8 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)  			       (TREE_OPERAND (t, 0), args));        break; -    case RETURN_STMT: -      finish_return_stmt (tsubst_expr (RETURN_STMT_EXPR (t), +    case RETURN_EXPR: +      finish_return_stmt (tsubst_expr (TREE_OPERAND (t, 0),  				       args, complain, in_decl));        break; diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 826ac688a76..0da94942c2e 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -3,8 +3,8 @@     building RTL.  These routines are used both during actual parsing     and during the instantiation of template functions.  -   Copyright (C) 1998, 1999, 2000, 2001, 2002, -   2003, 2004 Free Software Foundation, Inc. +   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 +   Free Software Foundation, Inc.     Written by Mark Mitchell (mmitchell@usa.net) based on code found     formerly in parse.y and pt.c.   @@ -667,7 +667,7 @@ finish_return_stmt (tree expr)  	}      } -  r = build_stmt (RETURN_STMT, expr); +  r = build_stmt (RETURN_EXPR, expr);    r = maybe_cleanup_point_expr (r);    r = add_stmt (r);    finish_stmt (); @@ -3009,8 +3009,8 @@ finalize_nrv_r (tree* tp, int* walk_subtrees, void* data)    /* Change all returns to just refer to the RESULT_DECL; this is a nop,       but differs from using NULL_TREE in that it indicates that we care       about the value of the RESULT_DECL.  */ -  else if (TREE_CODE (*tp) == RETURN_STMT) -    RETURN_STMT_EXPR (*tp) = dp->result; +  else if (TREE_CODE (*tp) == RETURN_EXPR) +    TREE_OPERAND (*tp, 0) = dp->result;    /* Change all cleanups for the NRV to only run when an exception is       thrown.  */    else if (TREE_CODE (*tp) == CLEANUP_STMT @@ -3052,7 +3052,7 @@ finalize_nrv_r (tree* tp, int* walk_subtrees, void* data)  }  /* Called from finish_function to implement the named return value -   optimization by overriding all the RETURN_STMTs and pertinent +   optimization by overriding all the RETURN_EXPRs and pertinent     CLEANUP_STMTs and replacing all occurrences of VAR with RESULT, the     RESULT_DECL for the function.  */ diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 95040834cc8..bdf7377d0e0 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -24,11 +24,7 @@ Boston, MA 02111-1307, USA.  */  /* This file is part of the C++ front end.     It contains routines to build C++ expressions given their operands,     including computing the types of the result, C and C++ specific error -   checks, and some optimization. - -   There are also routines to build RETURN_STMT nodes and CASE_STMT nodes, -   and to process initializations in declarations (since they work -   like a strange sort of assignment).  */ +   checks, and some optimization.  */  #include "config.h"  #include "system.h" diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 9b998ea47b0..9ea4f55d5fb 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -26,11 +26,7 @@ Boston, MA 02111-1307, USA.  */  /* This file is part of the C++ front end.     It contains routines to build C++ expressions given their operands,     including computing the types of the result, C and C++ specific error -   checks, and some optimization. - -   There are also routines to build RETURN_STMT nodes and CASE_STMT nodes, -   and to process initializations in declarations (since they work -   like a strange sort of assignment).  */ +   checks, and some optimization.  */  #include "config.h"  #include "system.h" diff --git a/gcc/tree-dump.h b/gcc/tree-dump.h index 974362b6225..8a0dcabe47d 100644 --- a/gcc/tree-dump.h +++ b/gcc/tree-dump.h @@ -83,7 +83,6 @@ extern void dump_pointer (dump_info_p, const char *, void *);  extern void dump_int (dump_info_p, const char *, int);  extern void dump_string (dump_info_p, const char *);  extern void dump_stmt (dump_info_p, tree); -extern void dump_next_stmt (dump_info_p, tree);  extern void queue_and_dump_index (dump_info_p, const char *, tree, int);  extern void queue_and_dump_type (dump_info_p, tree);  extern void dump_function (enum tree_dump_index, tree); | 

