diff options
author | Steven Bosscher <steven@gcc.gnu.org> | 2005-01-27 07:32:26 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2005-01-27 07:32:26 +0000 |
commit | ebaae5827a4c70e7d8866c3aceeae6888e29d9fe (patch) | |
tree | f9b695c3f67dfcff98a1d75be3d18fdbb7cd6b9e /gcc | |
parent | 7a7067386511a18792d556ed3e174f0245a5a36a (diff) | |
download | gcc-ebaae5827a4c70e7d8866c3aceeae6888e29d9fe.zip gcc-ebaae5827a4c70e7d8866c3aceeae6888e29d9fe.tar.gz gcc-ebaae5827a4c70e7d8866c3aceeae6888e29d9fe.tar.bz2 |
tree.h (SWITCH_COND, [...]): Add tree checks.
* 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.
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.
From-SVN: r94315
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 23 | ||||
-rw-r--r-- | gcc/c-common.c | 4 | ||||
-rw-r--r-- | gcc/c-common.def | 2 | ||||
-rw-r--r-- | gcc/c-common.h | 4 | ||||
-rw-r--r-- | gcc/c-dump.c | 4 | ||||
-rw-r--r-- | gcc/c-gimplify.c | 6 | ||||
-rw-r--r-- | gcc/c-typeck.c | 7 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/decl.c | 2 | ||||
-rw-r--r-- | gcc/cp/pt.c | 4 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 11 | ||||
-rw-r--r-- | gcc/doc/c-tree.texi | 8 | ||||
-rw-r--r-- | gcc/tree.h | 20 |
13 files changed, 65 insertions, 38 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b7786bc..03ef4e7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +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 @@ -97,9 +114,9 @@ 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> diff --git a/gcc/c-common.c b/gcc/c-common.c index af1d828..1df71ad 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -3676,7 +3676,7 @@ c_do_switch_warnings (splay_tree cases, tree switch_stmt) 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) @@ -3688,7 +3688,7 @@ c_do_switch_warnings (splay_tree cases, tree switch_stmt) 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; diff --git a/gcc/c-common.def b/gcc/c-common.def index adca88f..a211807 100644 --- a/gcc/c-common.def +++ b/gcc/c-common.def @@ -52,7 +52,7 @@ DEFTREECODE (BREAK_STMT, "break_stmt", tcc_expression, 0) 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 diff --git a/gcc/c-common.h b/gcc/c-common.h index d9fcfbb..13377f1 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -733,7 +733,9 @@ extern void finish_file (void); #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) diff --git a/gcc/c-dump.c b/gcc/c-dump.c index 006759f..ac7c580 100644 --- a/gcc/c-dump.c +++ b/gcc/c-dump.c @@ -80,8 +80,8 @@ c_dump_tree (void *dump_info, tree t) 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: diff --git a/gcc/c-gimplify.c b/gcc/c-gimplify.c index db6cd88..0584874 100644 --- a/gcc/c-gimplify.c +++ b/gcc/c-gimplify.c @@ -454,12 +454,12 @@ gimplify_switch_stmt (tree *stmt_p) 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); diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 237afad..cb657df 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -6563,8 +6563,7 @@ c_start_case (tree exp) /* 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; @@ -6583,7 +6582,7 @@ do_case (tree low_value, tree high_value) 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) @@ -6604,7 +6603,7 @@ c_finish_case (tree body) { 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); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2989f44..bb1ac4e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +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 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index a9ab7b0..f65427a 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2383,7 +2383,7 @@ finish_case_label (tree low_value, tree high_value) } /* 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); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 8233da9..dc781b4 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8192,9 +8192,9 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl) 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; diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index ce7233f..466587e 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -858,7 +858,7 @@ begin_switch_stmt (void) scope = do_pushlevel (sk_block); TREE_CHAIN (r) = scope; - begin_cond (&SWITCH_COND (r)); + begin_cond (&SWITCH_STMT_COND (r)); return r; } @@ -902,11 +902,11 @@ finish_switch_cond (tree cond, tree switch_stmt) 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 @@ -917,7 +917,8 @@ finish_switch_stmt (tree switch_stmt) { 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 (); diff --git a/gcc/doc/c-tree.texi b/gcc/doc/c-tree.texi index 9f4e649..fd1a070 100644 --- a/gcc/doc/c-tree.texi +++ b/gcc/doc/c-tree.texi @@ -1573,11 +1573,11 @@ cleanups must be executed in the reverse order in which they appear. @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 @@ -1227,15 +1227,15 @@ struct tree_vec GTY(()) /* 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)) @@ -1250,10 +1250,10 @@ struct tree_vec GTY(()) 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)) |