summaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-21 19:09:38 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-21 19:09:38 +0000
commitc63e27d8308a92ef01fefc139e574d9d2c3e1108 (patch)
tree7b19327f6425471460eda074c9f38f18c4323d1a /gcc/c-common.c
parenta3e81daf1b7df5e43e052733fb91fd90b4b10042 (diff)
downloadgcc-c63e27d8308a92ef01fefc139e574d9d2c3e1108.tar.gz
* c-common.c (c_unsafe_for_reeval): New function.
(add_c_tree_codes): Register it. * c-common.h: Declare it. * tree.c (lang_unsafe_for_reeval): New hook. (unsafe_for_reeval): Call it. * tree.h: Declare it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37623 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 05b7b8a5df0..59bc43e0f20 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -5924,6 +5924,20 @@ c_safe_from_p (target, exp)
return 1;
}
+/* Hook used by unsafe_for_reeval to handle language-specific tree codes. */
+
+int
+c_unsafe_for_reeval (exp)
+ tree exp;
+{
+ /* Statement expressions may not be reevaluated. */
+ if (TREE_CODE (exp) == STMT_EXPR)
+ return 2;
+
+ /* Walk all other expressions. */
+ return -1;
+}
+
/* Tree code classes. */
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
@@ -5971,6 +5985,7 @@ add_c_tree_codes ()
memcpy (tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE,
c_tree_code_name,
(LAST_C_TREE_CODE - (int)LAST_AND_UNUSED_TREE_CODE) * sizeof (char *));
+ lang_unsafe_for_reeval = c_unsafe_for_reeval;
}
#define CALLED_AS_BUILT_IN(NODE) \