CASE_HIGH, CASE_LABEL, ASM_STRING, ASM_OUTPUTS, ASM_INPUTS,
ASM_CLOBBERS): Add tree checks.
* c-common.h (SWITCH_TYPE): Rename to SWITCH_STMT_TYPE.
(SWITCH_STMT_COND, SWITCH_STMT_BODY): New.
* c-common.def (SWITCH_STMT): Update to match.
* c-common.c (c_do_switch_warnings): Use SWITCH_STMT accessor
macros instead of SWITCH_EXPR ones.
* c-dump.c (c_dump_tree): Likewise.
* c-gimplify.c (gimplify_switch_stmt): Likewise.
* c-typeck.c (c_start_case, do_case, c_finish_case): Likewise.
cp/
* decl.c (finish_case_label): Use SWITCH_STMT accessor macros
instead of SWITCH_EXPR ones.
* pt.c (tsubst_expr): Likewise.
* semantics.c (begin_switch_stmt, finish_switch_cond,
finish_switch_stmt): Likewise.
doc/
* c-tree.texi (SWITCH_STMT): Update accessor macro names.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94315
138bc75d-0d04-0410-961f-
82ee72b054a4
+2005-01-27 Steven Bosscher <stevenb@suse.de>
+
+ * tree.h (SWITCH_COND, SWITCH_BODY, SWITCH_LABELS, CASE_LOW,
+ CASE_HIGH, CASE_LABEL, ASM_STRING, ASM_OUTPUTS, ASM_INPUTS,
+ ASM_CLOBBERS): Add tree checks.
+
+ * c-common.h (SWITCH_TYPE): Rename to SWITCH_STMT_TYPE.
+ (SWITCH_STMT_COND, SWITCH_STMT_BODY): New.
+ * c-common.def (SWITCH_STMT): Update to match.
+ * c-common.c (c_do_switch_warnings): Use SWITCH_STMT accessor
+ macros instead of SWITCH_EXPR ones.
+ * c-dump.c (c_dump_tree): Likewise.
+ * c-gimplify.c (gimplify_switch_stmt): Likewise.
+ * c-typeck.c (c_start_case, do_case, c_finish_case): Likewise.
+
+ * doc/c-tree.texi (SWITCH_STMT): Update accessor macro names.
+
2005-01-27 Alan Modra <amodra@bigpond.net.au>
* unwind-dw2.c (execute_stack_op): Add missing cases for
2004-11-11 Eric Christopher <echristo@redhat.com>
- * config/frv/frv.md: Add fr400_integer automaton. Don't
- allow TYPE_MUL, TYPE_MACC, or TYPE_CUT to issue in parallel
- to TYPE_MACC.
+ * config/frv/frv.md: Add fr400_integer automaton. Don't
+ allow TYPE_MUL, TYPE_MACC, or TYPE_CUT to issue in parallel
+ to TYPE_MACC.
2005-01-26 Steven Bosscher <stevenb@suse.de>
else
switch_location = input_location;
- type = SWITCH_TYPE (switch_stmt);
+ type = SWITCH_STMT_TYPE (switch_stmt);
default_node = splay_tree_lookup (cases, (splay_tree_key) NULL);
if (warn_switch_default && !default_node)
default case, or when -Wswitch-enum was specified. */
if (((warn_switch && !default_node) || warn_switch_enum)
&& type && TREE_CODE (type) == ENUMERAL_TYPE
- && TREE_CODE (SWITCH_COND (switch_stmt)) != INTEGER_CST)
+ && TREE_CODE (SWITCH_STMT_COND (switch_stmt)) != INTEGER_CST)
{
tree chain;
DEFTREECODE (CONTINUE_STMT, "continue_stmt", tcc_expression, 0)
/* Used to represent a 'switch' statement. The operands are
- SWITCH_COND, SWITCH_BODY and SWITCH_TYPE, respectively. */
+ SWITCH_STMT_COND, SWITCH_STMT_BODY and SWITCH_STMT_TYPE, respectively. */
DEFTREECODE (SWITCH_STMT, "switch_stmt", tcc_expression, 3)
/* A STMT_EXPR represents a statement-expression. The
#define FOR_EXPR(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 2)
#define FOR_BODY(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 3)
-#define SWITCH_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2)
+#define SWITCH_STMT_COND(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0)
+#define SWITCH_STMT_BODY(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1)
+#define SWITCH_STMT_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2)
/* STMT_EXPR accessor. */
#define STMT_EXPR_STMT(NODE) TREE_OPERAND (STMT_EXPR_CHECK (NODE), 0)
case SWITCH_STMT:
dump_stmt (di, t);
- dump_child ("cond", SWITCH_COND (t));
- dump_child ("body", SWITCH_BODY (t));
+ dump_child ("cond", SWITCH_STMT_COND (t));
+ dump_child ("body", SWITCH_STMT_BODY (t));
break;
case WHILE_STMT:
break_block = begin_bc_block (bc_break);
- body = SWITCH_BODY (stmt);
+ body = SWITCH_STMT_BODY (stmt);
if (!body)
body = build_empty_stmt ();
- *stmt_p = build3 (SWITCH_EXPR, SWITCH_TYPE (stmt), SWITCH_COND (stmt),
- body, NULL_TREE);
+ *stmt_p = build3 (SWITCH_EXPR, SWITCH_STMT_TYPE (stmt),
+ SWITCH_STMT_COND (stmt), body, NULL_TREE);
SET_EXPR_LOCATION (*stmt_p, stmt_locus);
gimplify_stmt (stmt_p);
/* Add this new SWITCH_STMT to the stack. */
cs = XNEW (struct c_switch);
- cs->switch_stmt = build_stmt ((enum tree_code) SWITCH_STMT, exp, NULL_TREE,
- orig_type);
+ cs->switch_stmt = build_stmt (SWITCH_STMT, exp, NULL_TREE, orig_type);
cs->orig_type = orig_type;
cs->cases = splay_tree_new (case_compare, NULL, NULL);
cs->next = c_switch_stack;
if (c_switch_stack)
{
label = c_add_case_label (c_switch_stack->cases,
- SWITCH_COND (c_switch_stack->switch_stmt),
+ SWITCH_STMT_COND (c_switch_stack->switch_stmt),
c_switch_stack->orig_type,
low_value, high_value);
if (label == error_mark_node)
{
struct c_switch *cs = c_switch_stack;
- SWITCH_BODY (cs->switch_stmt) = body;
+ SWITCH_STMT_BODY (cs->switch_stmt) = body;
/* Emit warnings as needed. */
c_do_switch_warnings (cs->cases, cs->switch_stmt);
+2005-01-27 Steven Bosscher <stevenb@suse.de>
+
+ * decl.c (finish_case_label): Use SWITCH_STMT accessor macros
+ instead of SWITCH_EXPR ones.
+ * pt.c (tsubst_expr): Likewise.
+ * semantics.c (begin_switch_stmt, finish_switch_cond,
+ finish_switch_stmt): Likewise.
+
2005-01-26 J"orn Rennecke <joern.rennecke@st.com>
PR c++/18370
}
/* Find the condition on which this switch statement depends. */
- cond = SWITCH_COND (switch_stack->switch_stmt);
+ cond = SWITCH_STMT_COND (switch_stack->switch_stmt);
if (cond && TREE_CODE (cond) == TREE_LIST)
cond = TREE_VALUE (cond);
case SWITCH_STMT:
stmt = begin_switch_stmt ();
- tmp = tsubst_expr (SWITCH_COND (t), args, complain, in_decl);
+ tmp = tsubst_expr (SWITCH_STMT_COND (t), args, complain, in_decl);
finish_switch_cond (tmp, stmt);
- tsubst_expr (SWITCH_BODY (t), args, complain, in_decl);
+ tsubst_expr (SWITCH_STMT_BODY (t), args, complain, in_decl);
finish_switch_stmt (stmt);
break;
scope = do_pushlevel (sk_block);
TREE_CHAIN (r) = scope;
- begin_cond (&SWITCH_COND (r));
+ begin_cond (&SWITCH_STMT_COND (r));
return r;
}
cond = index;
}
}
- finish_cond (&SWITCH_COND (switch_stmt), cond);
- SWITCH_TYPE (switch_stmt) = orig_type;
+ finish_cond (&SWITCH_STMT_COND (switch_stmt), cond);
+ SWITCH_STMT_TYPE (switch_stmt) = orig_type;
add_stmt (switch_stmt);
push_switch (switch_stmt);
- SWITCH_BODY (switch_stmt) = push_stmt_list ();
+ SWITCH_STMT_BODY (switch_stmt) = push_stmt_list ();
}
/* Finish the body of a switch-statement, which may be given by
{
tree scope;
- SWITCH_BODY (switch_stmt) = pop_stmt_list (SWITCH_BODY (switch_stmt));
+ SWITCH_STMT_BODY (switch_stmt) =
+ pop_stmt_list (SWITCH_STMT_BODY (switch_stmt));
pop_switch ();
finish_stmt ();
@item SWITCH_STMT
-Used to represent a @code{switch} statement. The @code{SWITCH_COND} is
-the expression on which the switch is occurring. See the documentation
+Used to represent a @code{switch} statement. The @code{SWITCH_STMT_COND}
+is the expression on which the switch is occurring. See the documentation
for an @code{IF_STMT} for more information on the representation used
-for the condition. The @code{SWITCH_BODY} is the body of the switch
-statement. The @code{SWITCH_TYPE} is the original type of switch
+for the condition. The @code{SWITCH_STMT_BODY} is the body of the switch
+statement. The @code{SWITCH_STMT_TYPE} is the original type of switch
expression as given in the source, before any compiler conversions.
@item TRY_BLOCK
/* SWITCH_EXPR accessors. These give access to the condition, body and
original condition type (before any compiler conversions)
of the switch statement, respectively. */
-#define SWITCH_COND(NODE) TREE_OPERAND ((NODE), 0)
-#define SWITCH_BODY(NODE) TREE_OPERAND ((NODE), 1)
-#define SWITCH_LABELS(NODE) TREE_OPERAND ((NODE), 2)
+#define SWITCH_COND(NODE) TREE_OPERAND (SWITCH_EXPR_CHECK (NODE), 0)
+#define SWITCH_BODY(NODE) TREE_OPERAND (SWITCH_EXPR_CHECK (NODE), 1)
+#define SWITCH_LABELS(NODE) TREE_OPERAND (SWITCH_EXPR_CHECK (NODE), 2)
/* CASE_LABEL_EXPR accessors. These give access to the high and low values
of a case label, respectively. */
-#define CASE_LOW(NODE) TREE_OPERAND ((NODE), 0)
-#define CASE_HIGH(NODE) TREE_OPERAND ((NODE), 1)
-#define CASE_LABEL(NODE) TREE_OPERAND ((NODE), 2)
+#define CASE_LOW(NODE) TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 0)
+#define CASE_HIGH(NODE) TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 1)
+#define CASE_LABEL(NODE) TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 2)
/* The operands of a BIND_EXPR. */
#define BIND_EXPR_VARS(NODE) (TREE_OPERAND (BIND_EXPR_CHECK (NODE), 0))
instruction (e.g., "mov x, y"). ASM_OUTPUTS, ASM_INPUTS, and
ASM_CLOBBERS represent the outputs, inputs, and clobbers for the
statement. */
-#define ASM_STRING(NODE) TREE_OPERAND ((NODE), 0)
-#define ASM_OUTPUTS(NODE) TREE_OPERAND ((NODE), 1)
-#define ASM_INPUTS(NODE) TREE_OPERAND ((NODE), 2)
-#define ASM_CLOBBERS(NODE) TREE_OPERAND ((NODE), 3)
+#define ASM_STRING(NODE) TREE_OPERAND (ASM_EXPR_CHECK (NODE), 0)
+#define ASM_OUTPUTS(NODE) TREE_OPERAND (ASM_EXPR_CHECK (NODE), 1)
+#define ASM_INPUTS(NODE) TREE_OPERAND (ASM_EXPR_CHECK (NODE), 2)
+#define ASM_CLOBBERS(NODE) TREE_OPERAND (ASM_EXPR_CHECK (NODE), 3)
/* Nonzero if we want to create an ASM_INPUT instead of an
ASM_OPERAND with no operands. */
#define ASM_INPUT_P(NODE) (TREE_STATIC (NODE))