aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorSteven Bosscher <steven@gcc.gnu.org>2003-04-10 08:07:13 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2003-04-10 08:07:13 +0000
commit009ed91036a508ccaa07c95f246adc3d763cc93c (patch)
tree1dde01740299a69072dd80110dc8eeb2a9b2789c /gcc/c-common.c
parent23cac8856600b027fe0397d99dbacb939675c11f (diff)
downloadgcc-009ed91036a508ccaa07c95f246adc3d763cc93c.zip
gcc-009ed91036a508ccaa07c95f246adc3d763cc93c.tar.gz
gcc-009ed91036a508ccaa07c95f246adc3d763cc93c.tar.bz2
c-common.h (lang_statement_code_p): Remove declaration.
2003-04-09 Steven Bosscher <steven@gcc.gnu.org> * c-common.h (lang_statement_code_p): Remove declaration. (statement_code_p): Ditto. (c_common_stmt_codes): Define; list of c-common statement codes. (statement_code_p): New extern declaration. (STATEMENT_CODE_P): Define. (INIT_STATEMENT_CODES): Define. * c-common.c (statement_code_p): Kill the function, declare as an array of bools instead. (lang_statement_code_p): Remove. (walk_stmt_tree): Use STATEMENT_CODE_P not statement_code_p. (c_safe_from_p): Ditto. * c-objc-common.c (c_objc_common_init): Use INIT_STATEMENT_CODES to initialize the statement_code_p array. * tree-inline.c (walk_tree): Use STATEMENT_CODE_P instead of statement_code_p. (copy_tree_r): Ditto. * cp/cp-tree.h (cp_stmt_codes): Define; list of C++ specific statement tree codes. * cp/lex.c (cxx_init): Add missing print line break. Use INIT_STATEMENT_CODES to initialize the statement_code_p array. * cp/parser.c (cp_parser_statement): Use STATEMENT_CODE_P instead of statement_code_p. * cp/pt.c (tsubst_expr): Ditto. * cp/tree.c (verify_stmt_tree_r): Ditto. (cp_statement_code_p): Remove. (init_tree): Don't set lang_statement_code_p, it's gone. From-SVN: r65422
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c50
1 files changed, 8 insertions, 42 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 65322df..7048d9a 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -187,6 +187,11 @@ enum c_language_kind c_language;
tree c_global_trees[CTI_MAX];
+/* TRUE if a code represents a statement. The front end init
+ langhook should take care of initialization of this array. */
+
+bool statement_code_p[MAX_TREE_CODES];
+
/* Nonzero if we can read a PCH file now. */
int allow_pch = 1;
@@ -682,10 +687,6 @@ tree *ridpointers;
tree (*make_fname_decl) PARAMS ((tree, int));
-/* If non-NULL, the address of a language-specific function that
- returns 1 for language-specific statement codes. */
-int (*lang_statement_code_p) PARAMS ((enum tree_code));
-
/* If non-NULL, the address of a language-specific function that takes
any action required right before expand_function_end is called. */
void (*lang_expand_function_end) PARAMS ((void));
@@ -3927,41 +3928,6 @@ expand_tree_builtin (function, params, coerced_params)
return NULL_TREE;
}
-/* Returns nonzero if CODE is the code for a statement. */
-
-int
-statement_code_p (code)
- enum tree_code code;
-{
- switch (code)
- {
- case CLEANUP_STMT:
- case EXPR_STMT:
- case COMPOUND_STMT:
- case DECL_STMT:
- case IF_STMT:
- case FOR_STMT:
- case WHILE_STMT:
- case DO_STMT:
- case RETURN_STMT:
- case BREAK_STMT:
- case CONTINUE_STMT:
- case SCOPE_STMT:
- case SWITCH_STMT:
- case GOTO_STMT:
- case LABEL_STMT:
- case ASM_STMT:
- case FILE_STMT:
- case CASE_LABEL:
- return 1;
-
- default:
- if (lang_statement_code_p)
- return (*lang_statement_code_p) (code);
- return 0;
- }
-}
-
/* Walk the statement tree, rooted at *tp. Apply FUNC to all the
sub-trees of *TP in a pre-order traversal. FUNC is called with the
DATA and the address of each sub-tree. If FUNC returns a non-NULL
@@ -3997,7 +3963,7 @@ walk_stmt_tree (tp, func, data)
return NULL_TREE;
/* Skip subtrees below non-statement nodes. */
- if (!statement_code_p (TREE_CODE (*tp)))
+ if (!STATEMENT_CODE_P (TREE_CODE (*tp)))
return NULL_TREE;
/* Call the function. */
@@ -4011,7 +3977,7 @@ walk_stmt_tree (tp, func, data)
/* FUNC may have modified the tree, recheck that we're looking at a
statement node. */
code = TREE_CODE (*tp);
- if (!statement_code_p (code))
+ if (!STATEMENT_CODE_P (code))
return NULL_TREE;
/* Visit the subtrees unless FUNC decided that there was nothing
@@ -4386,7 +4352,7 @@ c_safe_from_p (target, exp)
}
/* For any statement, we must follow the statement-chain. */
- if (statement_code_p (TREE_CODE (exp)) && TREE_CHAIN (exp))
+ if (STATEMENT_CODE_P (TREE_CODE (exp)) && TREE_CHAIN (exp))
return safe_from_p (target, TREE_CHAIN (exp), /*top_p=*/0);
/* Assume everything else is safe. */