diff options
author | chelf <chelf@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-07-10 10:56:23 +0000 |
---|---|---|
committer | chelf <chelf@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-07-10 10:56:23 +0000 |
commit | 389acd0a1c55fa82c7702b22cd1644d4450dfa63 (patch) | |
tree | 8641e231837656bb79d18970254d75daaf2bb9f9 /gcc/c-semantics.c | |
parent | e8bdce0654532d6f582d9d35730256861c44a514 (diff) | |
download | gcc-389acd0a1c55fa82c7702b22cd1644d4450dfa63.tar.gz |
2000-07-10 Benjamin Chelf <chelf@codesourcery.com>
* c-common.h (build_stmt): Declare.
(build_continue_stmt): Likewise.
(build_break_stmt): Likewise.
(build_return_stmt): Likewise.
* c-decl.c (do_case): Rewrite to do what previously done in
c-parse.in.
* c-semantics.c (build_stmt): Define.
(build_return_stmt): Likewise.
(build_break_stmt): Likewise.
(build_continue_stmt): Likewise.
(build_case_label): Likewise.
* c-parse.in (BREAK): Change to build tree, then generate RTL.
(CONTINUE): Likewise.
(RETURN): Likewise.
(CASE): Likewise.
(DEFAULT): Likewise.
* c-parse.y: Regenerate.
* c-pasre.c: Likewise.
* cp/semantics.c (finish_for_stmt): Remove call to emit_line_note.
(finish_continue_stmt): Likewise.
(begin_for_stmt): Remove call to note_level_for_for.
(finish_goto_stmt): Change call from build_min_nt
to build_stmt.
(finish_expr_stmt): Likewise.
(begin_if_stmt): Likewise.
(begin_while_stmt): Likewise.
(finish_while_stmt): Likewise.
(finish_return_stmt): Likewise.
(begin_for_stmt): Likewise.
(finish_for_stmt): Likewise.
(finish_break_stmt): Likewise.
(begin_switch_stmt): Likewise.
(finish_case_label): Likewise.
(genrtl_try_block): Likewise.
(begin_try_block): Likewise.
(begin_handler): Likewise.
(begin_compound_stmt): Likewise.
(finish_asm_stmt): Likewise.
(finish_label_stmt): Likewise.
(add_decl_stmt): Likewise.
(finish_subobject): Likewise.
(finish_decl_cleanup): Likewise.
(finish_named_return_value): Likewise.
(setup_vtbl_ptr): Likewise.
(add_scope_stmt): Likewise.
* cp/decl.c (finish_constructor_body): Likewise.
(finish_destructor_body): Likewise.
* cp/optimize.c (copy_body_r): Likewise.
(initialize_inlined_parameters): Likewise.
(declare_return_variable): Likewise.
(expand_call_inline): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34943 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-semantics.c')
-rw-r--r-- | gcc/c-semantics.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c index 4e5e3ffe8dc..fb669b33d4b 100644 --- a/gcc/c-semantics.c +++ b/gcc/c-semantics.c @@ -36,6 +36,38 @@ Boston, MA 02111-1307, USA. */ #include "output.h" #include "timevar.h" +/* Build a generic statement based on the given type of node and + arguments. Similar to `build_nt', except that we set + TREE_COMPLEXITY to be the current line number. */ + +tree +build_stmt VPARAMS ((enum tree_code code, ...)) +{ +#ifndef ANSI_PROTOTYPES + enum tree_code code; +#endif + va_list p; + register tree t; + register int length; + register int i; + + VA_START (p, code); + +#ifndef ANSI_PROTOTYPES + code = va_arg (p, enum tree_code); +#endif + + t = make_node (code); + length = TREE_CODE_LENGTH (code); + TREE_COMPLEXITY (t) = lineno; + + for (i = 0; i < length; i++) + TREE_OPERAND (t, i) = va_arg (p, tree); + + va_end (p); + return t; +} + /* Some statements, like for-statements or if-statements, require a condition. This condition can be a declaration. If T is such a declaration it is processed, and an expression appropriate to use @@ -276,6 +308,15 @@ genrtl_do_stmt (t) expand_end_loop (); } +/* Build the node for a return statement and return it. */ + +tree +build_return_stmt (expr) + tree expr; +{ + return (build_stmt (RETURN_STMT, expr)); +} + /* Generate the RTL for EXPR, which is a RETURN_STMT. */ void @@ -319,6 +360,14 @@ genrtl_for_stmt (t) expand_end_loop (); } +/* Build a break statement node and return it. */ + +tree +build_break_stmt () +{ + return (build_stmt (BREAK_STMT)); +} + /* Generate the RTL for a BREAK_STMT. */ void @@ -329,6 +378,14 @@ genrtl_break_stmt () error ("break statement not within loop or switch"); } +/* Build a continue statement node and return it. */ + +tree +build_continue_stmt () +{ + return (build_stmt (CONTINUE_STMT)); +} + /* Generate the RTL for a CONTINUE_STMT. */ void @@ -388,6 +445,17 @@ genrtl_switch_stmt (t) expand_end_case (cond); } +/* Create a CASE_LABEL tree node and return it. */ + +tree +build_case_label (low_value, high_value) + tree low_value; + tree high_value; +{ + return build_stmt (CASE_LABEL, low_value, high_value); +} + + /* Generate the RTL for a CASE_LABEL. */ void |