aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/expr.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2000-09-10 21:34:41 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2000-09-10 21:34:41 +0000
commit56cb97339bc91ec1b4df74a8bb4a31d4c363aee2 (patch)
treee6b472ea3504de9f1d42acce2241fe0cbaf55dcf /gcc/cp/expr.c
parent2c9f4db73acfb821ad776df950e908daac642530 (diff)
downloadgcc-56cb97339bc91ec1b4df74a8bb4a31d4c363aee2.zip
gcc-56cb97339bc91ec1b4df74a8bb4a31d4c363aee2.tar.gz
gcc-56cb97339bc91ec1b4df74a8bb4a31d4c363aee2.tar.bz2
c-common.h (add_stmt): Change prototype.
* 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. From-SVN: r36305
Diffstat (limited to 'gcc/cp/expr.c')
-rw-r--r--gcc/cp/expr.c79
1 files changed, 0 insertions, 79 deletions
diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c
index 42a5390..39095ec 100644
--- a/gcc/cp/expr.c
+++ b/gcc/cp/expr.c
@@ -205,82 +205,3 @@ extract_init (decl, init)
return 0;
}
-void
-do_case (start, end)
- tree start, end;
-{
- tree value1 = NULL_TREE, value2 = NULL_TREE, label;
-
- if (start != NULL_TREE && TREE_TYPE (start) != NULL_TREE
- && POINTER_TYPE_P (TREE_TYPE (start)))
- error ("pointers are not permitted as case values");
-
- if (end && pedantic)
- pedwarn ("ISO C++ forbids range expressions in switch statement");
-
- if (start)
- value1 = check_cp_case_value (start);
- if (end)
- value2 = check_cp_case_value (end);
-
- label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
-
- if (value1 != error_mark_node
- && value2 != error_mark_node)
- {
- tree duplicate;
- int success;
-
- if (end)
- success = pushcase_range (value1, value2, convert_and_check,
- label, &duplicate);
- else if (start)
- success = pushcase (value1, convert_and_check, label, &duplicate);
- else
- success = pushcase (NULL_TREE, 0, label, &duplicate);
-
- if (success == 1)
- {
- if (end)
- error ("case label not within a switch statement");
- else if (start)
- cp_error ("case label `%E' not within a switch statement", start);
- else
- error ("default label not within a switch statement");
- }
- else if (success == 2)
- {
- if (end)
- {
- error ("duplicate (or overlapping) case value");
- cp_error_at ("this is the first entry overlapping that value",
- duplicate);
- }
- else if (start)
- {
- cp_error ("duplicate case value `%E'", start);
- cp_error_at ("previously used here", duplicate);
- }
- else
- {
- error ("multiple default labels in one switch");
- cp_error_at ("this is the first default label", duplicate);
- }
- }
- else if (success == 3)
- warning ("case value out of range");
- else if (success == 4)
- warning ("empty range specified");
- else if (success == 5)
- {
- if (end)
- error ("case label within scope of cleanup or variable array");
- else if (! start)
- error ("`default' label within scope of cleanup or variable array");
- else
- cp_error ("case label `%E' within scope of cleanup or variable array", start);
- }
- }
-
- current_function_return_value = NULL_TREE;
-}