summaryrefslogtreecommitdiff
path: root/gcc/tree.h
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-16 18:27:15 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-16 18:27:15 +0000
commit5e674ace8e2448bbbe1ad61a7501cc48e1d9f2aa (patch)
treeb7e01c5cdf80a99add474ec689fefdd890594672 /gcc/tree.h
parent909ea6886c0e5489da98ce1adda6a87d37dae079 (diff)
downloadgcc-5e674ace8e2448bbbe1ad61a7501cc48e1d9f2aa.tar.gz
* tree.h (STMT_CHECK): New macro.
Also upper-case argument names on all checking macros and fix some whitespace problems; assume CODE argument does not have side-effects. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68028 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.h')
-rw-r--r--gcc/tree.h91
1 files changed, 44 insertions, 47 deletions
diff --git a/gcc/tree.h b/gcc/tree.h
index 178380b7a22..42b64b1011a 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -274,31 +274,31 @@ struct tree_common GTY(())
is accessed incorrectly. The macros abort with a fatal error. */
#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
-#define TREE_CHECK(t, code) __extension__ \
-({ const tree __t = (t); \
- if (TREE_CODE(__t) != (code)) \
- tree_check_failed (__t, code, __FILE__, __LINE__, __FUNCTION__); \
+#define TREE_CHECK(T, CODE) __extension__ \
+({ const tree __t = (T); \
+ if (TREE_CODE (__t) != (CODE)) \
+ tree_check_failed (__t, (CODE), __FILE__, __LINE__, __FUNCTION__); \
__t; })
-#define TREE_CLASS_CHECK(t, class) __extension__ \
-({ const tree __t = (t); \
- if (TREE_CODE_CLASS(TREE_CODE(__t)) != (class)) \
- tree_class_check_failed (__t, class, __FILE__, __LINE__, \
+
+#define TREE_CLASS_CHECK(T, CLASS) __extension__ \
+({ const tree __t = (T); \
+ if (TREE_CODE_CLASS (TREE_CODE(__t)) != (CLASS)) \
+ tree_class_check_failed (__t, (CLASS), __FILE__, __LINE__, \
__FUNCTION__); \
__t; })
/* These checks have to be special cased. */
-#define EXPR_CHECK(t) __extension__ \
-({ const tree __t = (t); \
- char const __c = TREE_CODE_CLASS(TREE_CODE(__t)); \
- if (__c != 'r' && __c != 's' && __c != '<' \
- && __c != '1' && __c != '2' && __c != 'e') \
+#define EXPR_CHECK(T) __extension__ \
+({ const tree __t = (T); \
+ char const __c = TREE_CODE_CLASS (TREE_CODE (__t)); \
+ if (!IS_EXPR_CODE_CLASS (__c) && __c != 'r' && __c != 's') \
tree_class_check_failed (__t, 'e', __FILE__, __LINE__, \
__FUNCTION__); \
__t; })
-#define TREE_VEC_ELT_CHECK(t, i) __extension__ \
-(*({const tree __t = t; \
- const int __i = (i); \
+#define TREE_VEC_ELT_CHECK(T, I) __extension__ \
+(*({const tree __t = (T); \
+ const int __i = (I); \
if (TREE_CODE (__t) != TREE_VEC) \
tree_check_failed (__t, TREE_VEC, \
__FILE__, __LINE__, __FUNCTION__); \
@@ -308,36 +308,32 @@ struct tree_common GTY(())
&__t->vec.a[__i]; }))
/* Special checks for TREE_OPERANDs. */
-#define TREE_OPERAND_CHECK(t, i) __extension__ \
-(*({const tree __t = EXPR_CHECK(t); \
- const int __i = (i); \
+#define TREE_OPERAND_CHECK(T, I) __extension__ \
+(*({const tree __t = EXPR_CHECK(T); \
+ const int __i = (I); \
if (__i < 0 || __i >= TREE_CODE_LENGTH (TREE_CODE (__t))) \
tree_operand_check_failed (__i, TREE_CODE (__t), \
__FILE__, __LINE__, __FUNCTION__); \
&__t->exp.operands[__i]; }))
-#define TREE_OPERAND_CHECK_CODE(t, code, i) __extension__ \
-(*({const tree __t = t; \
- const int __i = (i); \
- const enum tree_code __code = code; \
- if (TREE_CODE (__t) != __code) \
- tree_check_failed (__t, __code, \
- __FILE__, __LINE__, __FUNCTION__); \
- if (__i < 0 || __i >= TREE_CODE_LENGTH (__code)) \
- tree_operand_check_failed (__i, __code, \
+#define TREE_OPERAND_CHECK_CODE(T, CODE, I) __extension__ \
+(*({const tree __t = (T); \
+ const int __i = (I); \
+ if (TREE_CODE (__t) != CODE) \
+ tree_check_failed (__t, CODE, __FILE__, __LINE__, __FUNCTION__); \
+ if (__i < 0 || __i >= TREE_CODE_LENGTH (CODE)) \
+ tree_operand_check_failed (__i, (CODE), \
__FILE__, __LINE__, __FUNCTION__); \
&__t->exp.operands[__i]; }))
-#define TREE_RTL_OPERAND_CHECK(t, code, i) __extension__ \
+#define TREE_RTL_OPERAND_CHECK(T, CODE, I) __extension__ \
(*(rtx *) \
- ({const tree __t = t; \
- const int __i = (i); \
- const enum tree_code __code = code; \
- if (TREE_CODE (__t) != __code) \
- tree_check_failed (__t, __code, \
- __FILE__, __LINE__, __FUNCTION__); \
- if (__i < 0 || __i >= TREE_CODE_LENGTH (__code)) \
- tree_operand_check_failed (__i, __code, \
+ ({const tree __t = (T); \
+ const int __i = (I); \
+ if (TREE_CODE (__t) != (CODE)) \
+ tree_check_failed (__t, (CODE), __FILE__, __LINE__, __FUNCTION__); \
+ if (__i < 0 || __i >= TREE_CODE_LENGTH ((CODE))) \
+ tree_operand_check_failed (__i, (CODE), \
__FILE__, __LINE__, __FUNCTION__); \
&__t->exp.operands[__i]; }))
@@ -357,21 +353,22 @@ extern void tree_operand_check_failed PARAMS ((int, enum tree_code,
#else /* not ENABLE_TREE_CHECKING, or not gcc */
-#define TREE_CHECK(t, code) (t)
-#define TREE_CLASS_CHECK(t, code) (t)
-#define EXPR_CHECK(t) (t)
-#define TREE_VEC_ELT_CHECK(t, i) ((t)->vec.a[i])
-#define TREE_OPERAND_CHECK(t, i) ((t)->exp.operands[i])
-#define TREE_OPERAND_CHECK_CODE(t, code, i) ((t)->exp.operands[i])
-#define TREE_RTL_OPERAND_CHECK(t, code, i) (*(rtx *) &((t)->exp.operands[i]))
+#define TREE_CHECK(T, CODE) (T)
+#define TREE_CLASS_CHECK(T, CODE) (T)
+#define EXPR_CHECK(T) (T)
+#define TREE_VEC_ELT_CHECK(T, I) ((T)->vec.a[I])
+#define TREE_OPERAND_CHECK(T, I) ((T)->exp.operands[I])
+#define TREE_OPERAND_CHECK_CODE(T, CODE, I) ((T)->exp.operands[I])
+#define TREE_RTL_OPERAND_CHECK(T, CODE, I) (*(rtx *) &((T)->exp.operands[I]))
#endif
#include "tree-check.h"
-#define TYPE_CHECK(tree) TREE_CLASS_CHECK (tree, 't')
-#define DECL_CHECK(tree) TREE_CLASS_CHECK (tree, 'd')
-#define CST_CHECK(tree) TREE_CLASS_CHECK (tree, 'c')
+#define TYPE_CHECK(T) TREE_CLASS_CHECK (T, 't')
+#define DECL_CHECK(T) TREE_CLASS_CHECK (T, 'd')
+#define CST_CHECK(T) TREE_CLASS_CHECK (T, 'c')
+#define STMT_CHECK(T) TREE_CLASS_CHECK (T, 's')
/* In all nodes that are expressions, this is the data type of the expression.
In POINTER_TYPE nodes, this is the type that the pointer points to.