summaryrefslogtreecommitdiff
path: root/gcc/c-common.h
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-10 21:34:41 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-10 21:34:41 +0000
commit225ec6aae7502e0b287baca4fd3d4f6d89ad7400 (patch)
treee6b472ea3504de9f1d42acce2241fe0cbaf55dcf /gcc/c-common.h
parent508f18c8cfcf812f41173c35b744d20f6a4fd1e6 (diff)
downloadgcc-225ec6aae7502e0b287baca4fd3d4f6d89ad7400.tar.gz
* c-common.h (add_stmt): Change prototype.
(RECHAIN_STMTS): New macro. (CASE_LABEL_DECL): Likewise. (genrtl_case_label): Change prototype. (c_expand_start_case): Remove prototype. (build_case_label): Change prototype. (decl_constant_value): Declare. * c-common.c (check_case_value): Handle C++'s extensions to C semantics. * c-commnon.def (CASE_LABEL): Add room for the CASE_LABEL_DECL field. * c-parse.in (stmt): Adjust handling of return statements and case laels. * c-semantics.c (add_stmt): Return the new statement. (genrtl_return_stmt): Take the RETURN_STMT as input, not the returned expression. Directly generate RTL, rather than calling c_expand_return. (genrtl_switch_stmt): Don't call c_expand_start_case. (build_case_label): Take the LABEL_DECL as input, too. (genrtl_case_label): Just call add_case_node. (expand_stmt): Adjust calls to genrtl_return_stmt and genrtl_case_label. * c-tree.h (c_expand_start_case): Declare. * c-typeck.c (decl_constant_value): Give it external linkage. (c_expand_return): Don't call expand_return or expand_null_return; use genrtl_return_stmt instead. * stmt.c (struct nesting): Remove num_ranges field. (add_case_node): Give it external linkage. (expand_start_case): Don't set num_ranges. (expand_start_case_dummy): Don't clear it. (pushcase): Rely on add_case_node to handle `default' labels. (add_case_node): Handle `default' labels. * tree.c (tree_int_cst_compare): New function. * tree.h (tree_int_cst_compare): Declare. (add_case_node): Likewise. * cp-tree.h (push_switch): Change prototype. (check_cp_case_value): Remove declaration. (decl_constant_value): Likewise. * decl.c (struct cp_switch): Add switch_stmt and cases. (case_compare): New function. (push_switch): Set switch_stmt. Initialize cases. (pop_switch): Clean up cases. (define_case_label): Rename to ... (finish_case_label): ... this. Do semantic analysis for case labels here. (start_function): Correct comment. * decl2.c (check_cp_case_value): Remove. * expr.c (do_case): Remove. * pt.c (tsubst_expr): Adjust call to finish_case_label. * semantics.c (genrtl_do_poplevel): Remove declaration. (RECHAIN_STMTS): Remove. (finish_break_stmt): Use build_break_stmt. (finish_continue_stmt): Use build_continue_stmt. (finish_switch_cond): Adjust condition here, rater than in c_expand_start_case. (finish_case_label): Remove. * typeck.c (c_expand_return): Remove. (c_expand_start_case): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36305 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.h')
-rw-r--r--gcc/c-common.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/gcc/c-common.h b/gcc/c-common.h
index e995b9978e0..4fb65608b7e 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -256,7 +256,7 @@ typedef tree (*walk_tree_fn) PARAMS ((tree *,
extern stmt_tree current_stmt_tree PARAMS ((void));
extern void begin_stmt_tree PARAMS ((tree *));
-extern void add_stmt PARAMS ((tree));
+extern tree add_stmt PARAMS ((tree));
extern void finish_stmt_tree PARAMS ((tree *));
extern int statement_code_p PARAMS ((enum tree_code));
@@ -268,6 +268,18 @@ extern void prep_stmt PARAMS ((tree));
extern void (*lang_expand_stmt) PARAMS ((tree));
extern void expand_stmt PARAMS ((tree));
+/* LAST_TREE contains the last statement parsed. These are chained
+ together through the TREE_CHAIN field, but often need to be
+ re-organized since the parse is performed bottom-up. This macro
+ makes LAST_TREE the indicated SUBSTMT of STMT. */
+
+#define RECHAIN_STMTS(stmt, substmt) \
+ do { \
+ substmt = TREE_CHAIN (stmt); \
+ TREE_CHAIN (stmt) = NULL_TREE; \
+ last_tree = stmt; \
+ } while (0)
+
/* The variant of the C language being processed. Each C language
front-end defines this variable. */
@@ -457,6 +469,7 @@ extern tree simple_type_promotes_to PARAMS ((tree));
of a case label, respectively. */
#define CASE_LOW(NODE) TREE_OPERAND (CASE_LABEL_CHECK (NODE), 0)
#define CASE_HIGH(NODE) TREE_OPERAND (CASE_LABEL_CHECK (NODE), 1)
+#define CASE_LABEL_DECL(NODE) TREE_OPERAND (CASE_LABEL_CHECK (NODE), 2)
/* GOTO_STMT accessor. This gives access to the label associated with
a goto statement. */
@@ -570,7 +583,7 @@ extern void genrtl_break_stmt PARAMS ((void));
extern void genrtl_continue_stmt PARAMS ((void));
extern void genrtl_scope_stmt PARAMS ((tree));
extern void genrtl_switch_stmt PARAMS ((tree));
-extern void genrtl_case_label PARAMS ((tree, tree));
+extern void genrtl_case_label PARAMS ((tree));
extern void genrtl_compound_stmt PARAMS ((tree));
extern void genrtl_asm_stmt PARAMS ((tree, tree,
tree, tree,
@@ -589,10 +602,9 @@ extern void emit_local_var PARAMS ((tree));
extern void make_rtl_for_local_static PARAMS ((tree));
extern tree expand_cond PARAMS ((tree));
extern void c_expand_return PARAMS ((tree));
-extern tree c_expand_start_case PARAMS ((tree));
extern void do_case PARAMS ((tree, tree));
extern tree build_stmt PARAMS ((enum tree_code, ...));
-extern tree build_case_label PARAMS ((tree, tree));
+extern tree build_case_label PARAMS ((tree, tree, tree));
extern tree build_continue_stmt PARAMS ((void));
extern tree build_break_stmt PARAMS ((void));
extern tree build_return_stmt PARAMS ((tree));
@@ -620,6 +632,8 @@ extern tree common_type PARAMS ((tree, tree));
extern tree expand_tree_builtin PARAMS ((tree, tree, tree));
+extern tree decl_constant_value PARAMS ((tree));
+
/* Hook currently used only by the C++ front end to reset internal state
after entering or leaving a header file. */
extern void extract_interface_info PARAMS ((void));