aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2005-04-09 03:18:18 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2005-04-09 03:18:18 +0000
commitfbc315db4a79aee216b2e56e1653e22d86436fea (patch)
tree54b12532b3129c3528d3e2a058b89210eef0f85b /gcc/c-common.c
parent0bca51f080dfff5e943b1f1775d874a73bbc441a (diff)
downloadgcc-fbc315db4a79aee216b2e56e1653e22d86436fea.zip
gcc-fbc315db4a79aee216b2e56e1653e22d86436fea.tar.gz
gcc-fbc315db4a79aee216b2e56e1653e22d86436fea.tar.bz2
c-common.def: Move FOR_STMT...
./ * c-common.def: Move FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT to cp/cp-tree.def. * c-common.h (WHILE_COND, WHILE_BODY): Move to cp/cp-tree.h. (DO_COND, DO_BODY): Likewise. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Likewise. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Likewise. (c_common_stmt_codes): Remove FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT. (build_continue_stmt, build_break_stmt): Don't declare. (c_do_switch_warnings): Update declaration. * c-gimplify.c (enum bc_t): Remove. (struct c_gimplify_ctx, ctxp): Remove. (push_context, pop_context): Remove static functions. (c_genericize): Don't call push_context or pop_context. (begin_bc_block, finish_bc_block): Remove static functions. (build_bc_goto): Likewise. (gimplify_c_loop): Likewise. (gimplify_for_stmt, gimplify_while_stmt): Likewise. (gimplify_do_stmt, gimplify_switch_stmt): Likewise. (c_gimplify_expr): Remove handling of FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. * c-common.c (c_do_switch_warnings): Rename from c_do_switch_warnings_1. (c_do_switch_warnings) [old version]: Remove. (c_do_switch_expr_warnings): Remove. * c-typeck.c (c_finish_case): Call new c_do_switch_warnings function instead of c_do_switch_expr_warnings. * c-dump.c (c_dump_tree): Remove handling of BREAK_STMT, CONTINUE_STMT, DO_STMT, FOR_STMT, SWITCH_STMT, and WHILE_STMT. * c-pretty-print.c (pp_c_statement): Likewise. * c-semantics.c (build_break_stmt, build_continue_stmt): Remove. cp/ * cp-tree.def: Define FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. * cp-tree.h (cp_stmt_codes): Add FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. (WHILE_COND, WHILE_BODY): Define. (DO_COND, DO_BODY): Define. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Define. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Define. * cp-gimplify.c (enum bc_t): Define. (struct cp_gimplify_ctx, ctxp): Define. (push_context, pop_context): New static functions. (begin_bc_block, finish_bc_block): New static functions. (build_bc_goto): New static function. (gimplify_cp_loop, gimplify_for_stmt): New static functions. (gimplify_while_stmt, gimplify_do_stmt): Likewise. (gimplify_switch_stmt): Likewise. (cp_gimplify_expr): Handle FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. (cp_genericize): Call push_context and pop_context. * semantics.c (finish_break_stmt): Just call build_stmt (BREAK_STMT) rather than build_break_stmt. (finish_continue_stmt): Corresponding change. * decl.c (pop_switch): Update call to c_do_switch_warnings for new parameters. * cxx-pretty-print.c (pp_cxx_statement): Handle SWITCH_STMT, WHILE_STMT, DO_STMT, FOR_STMT, BREAK_STMT, CONTINUE_STMT. * dump.c (cp_dump_tree): Likewise. From-SVN: r97885
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c52
1 files changed, 9 insertions, 43 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index f68c853..050a1eb 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -3708,11 +3708,16 @@ match_case_to_enum (splay_tree_node node, void *data)
return 0;
}
-/* Common code for -Wswitch*. */
+/* Handle -Wswitch*. Called from the front end after parsing the
+ switch construct. */
+/* ??? Should probably be somewhere generic, since other languages
+ besides C and C++ would want this. At the moment, however, C/C++
+ are the only tree-ssa languages that support enumerations at all,
+ so the point is moot. */
-static void
-c_do_switch_warnings_1 (splay_tree cases, location_t switch_location,
- tree type, tree cond)
+void
+c_do_switch_warnings (splay_tree cases, location_t switch_location,
+ tree type, tree cond)
{
splay_tree_node default_node;
@@ -3773,45 +3778,6 @@ c_do_switch_warnings_1 (splay_tree cases, location_t switch_location,
}
}
-/* Handle -Wswitch* for a SWITCH_STMT. Called from the front end
- after parsing the switch construct. */
-/* ??? Should probably be somewhere generic, since other languages besides
- C and C++ would want this. We'd want to agree on the data structure,
- however, which is a problem. Alternately, we operate on gimplified
- switch_exprs, which I don't especially like. At the moment, however,
- C/C++ are the only tree-ssa languages that support enumerations at all,
- so the point is moot. */
-
-void
-c_do_switch_warnings (splay_tree cases, tree switch_stmt)
-{
- location_t switch_location;
-
- if (EXPR_HAS_LOCATION (switch_stmt))
- switch_location = EXPR_LOCATION (switch_stmt);
- else
- switch_location = input_location;
- c_do_switch_warnings_1 (cases, switch_location,
- SWITCH_STMT_TYPE (switch_stmt),
- SWITCH_STMT_COND (switch_stmt));
-}
-
-/* Like c_do_switch_warnings, but takes a SWITCH_EXPR rather than a
- SWITCH_STMT. */
-
-void
-c_do_switch_expr_warnings (splay_tree cases, tree switch_expr)
-{
- location_t switch_location;
-
- if (EXPR_HAS_LOCATION (switch_expr))
- switch_location = EXPR_LOCATION (switch_expr);
- else
- switch_location = input_location;
- c_do_switch_warnings_1 (cases, switch_location, TREE_TYPE (switch_expr),
- SWITCH_COND (switch_expr));
-}
-
/* Finish an expression taking the address of LABEL (an
IDENTIFIER_NODE). Returns an expression for the address. */