Introduce new typedefs: const_tree, const_rtx, etc.

Kaveh R. Ghazi ghazi@caipclassic.rutgers.edu
Sat Aug 12 07:32:00 GMT 2006


As discussed here:
http://gcc.gnu.org/ml/gcc/2006-06/msg00929.html

I'd like to introduce auxiliary const typedefs that parallel existing
core types in GCC.  This will allow us to constify various things,
mainly function parameters that currently take a plain tree, rtx, etc.

The first step is to add the new types to coretypes.h.  We must also
update the "checking" macros to use __typeof() to preserve the
constness of the supplied expression.  Thanks to Dave and Ian for the
suggestion.
http://gcc.gnu.org/ml/gcc/2006-07/msg00303.html

Bootstrapped on sparc-sun-solaris2.10, I used --enable-checking=yes,rtl
to ensure we exercise the modified RTL checking macros.  There were no
regressions.

Okay for mainline stage1 ?

Also, there's a lot of monotonous work propagating these types through
the sources.  Anyone want to preapprove constification patches?
They're all "obvious" changes anyway, except that in aggregate they're
pretty big.

		Thanks,
		--Kaveh



2006-07-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* coretypes.h (const_bitmap, const_rtx, const_rtvec, const_tree):
	New.
	
	* rtl.h (RTL_CHECK1, RTL_CHECK2, RTL_CHECKC1, RTL_CHECKC2,
	RTVEC_ELT, XWINT, XCWINT, XCMWINT, XCNMPRV, BLOCK_SYMBOL_CHECK,
	RTL_FLAG_CHECK1, RTL_FLAG_CHECK2, RTL_FLAG_CHECK3,
	RTL_FLAG_CHECK4, RTL_FLAG_CHECK5, RTL_FLAG_CHECK6,
	RTL_FLAG_CHECK7, RTL_FLAG_CHECK8, LABEL_KIND, SET_LABEL_KIND):
	Preserve const-ness of parameters through use of __typeof(),
	also constify and tidy.
	
	* tree.h (TREE_CHECK, TREE_NOT_CHECK, TREE_CHECK2,
	TREE_NOT_CHECK2, TREE_CHECK3, TREE_NOT_CHECK3, TREE_CHECK4,
	NON_TREE_CHECK4, TREE_CHECK5, TREE_NOT_CHECK5,
	CONTAINS_STRUCT_CHECK, TREE_CLASS_CHECK, TREE_RANGE_CHECK,
	OMP_CLAUSE_SUBCODE_CHECK, OMP_CLAUSE_RANGE_CHECK, EXPR_CHECK,
	NON_TYPE_CHECK, TREE_VEC_ELT_CHECK, PHI_NODE_ELT_CHECK,
	OMP_CLAUSE_ELT_CHECK, TREE_OPERAND_CHECK, TREE_OPERAND_CHECK_CODE,
	TREE_RTL_OPERAND_CHECK): Likewise.

diff -rup orig/egcc-SVN20060725/gcc/coretypes.h egcc-SVN20060725/gcc/coretypes.h
--- orig/egcc-SVN20060725/gcc/coretypes.h	2006-01-27 20:01:42.000000000 -0500
+++ egcc-SVN20060725/gcc/coretypes.h	2006-07-26 02:01:49.310388128 -0400
@@ -39,12 +39,16 @@ Software Foundation, 51 Franklin Street,
 
 struct bitmap_head_def;
 typedef struct bitmap_head_def *bitmap;
+typedef const struct bitmap_head_def *const_bitmap;
 struct rtx_def;
 typedef struct rtx_def *rtx;
+typedef const struct rtx_def *const_rtx;
 struct rtvec_def;
 typedef struct rtvec_def *rtvec;
+typedef const struct rtvec_def *const_rtvec;
 union tree_node;
 typedef union tree_node *tree;
+typedef const union tree_node *const_tree;
 union section;
 typedef union section section;
 
@@ -71,8 +75,11 @@ struct _dont_use_rtx_here_;
 struct _dont_use_rtvec_here_;
 union _dont_use_tree_here_;
 #define rtx struct _dont_use_rtx_here_ *
+#define const_rtx struct _dont_use_rtx_here_ *
 #define rtvec struct _dont_use_rtvec_here *
+#define const_rtvec struct _dont_use_rtvec_here *
 #define tree union _dont_use_tree_here_ *
+#define const_tree union _dont_use_tree_here_ *
 
 #endif
 
diff -rup orig/egcc-SVN20060725/gcc/rtl.h egcc-SVN20060725/gcc/rtl.h
--- orig/egcc-SVN20060725/gcc/rtl.h	2006-05-30 20:00:53.000000000 -0400
+++ egcc-SVN20060725/gcc/rtl.h	2006-07-26 02:08:16.646263995 -0400
@@ -453,7 +453,7 @@ struct rtvec_def GTY(()) {
 /* The bit with a star outside the statement expr and an & inside is
    so that N can be evaluated only once.  */
 #define RTL_CHECK1(RTX, N, C1) __extension__				\
-(*({ rtx const _rtx = (RTX); const int _n = (N);			\
+(*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N);		\
      const enum rtx_code _code = GET_CODE (_rtx);			\
      if (_n < 0 || _n >= GET_RTX_LENGTH (_code))			\
        rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__,		\
@@ -464,7 +464,7 @@ struct rtvec_def GTY(()) {
      &_rtx->u.fld[_n]; }))
 
 #define RTL_CHECK2(RTX, N, C1, C2) __extension__			\
-(*({ rtx const _rtx = (RTX); const int _n = (N);			\
+(*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N);		\
      const enum rtx_code _code = GET_CODE (_rtx);			\
      if (_n < 0 || _n >= GET_RTX_LENGTH (_code))			\
        rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__,		\
@@ -476,14 +476,14 @@ struct rtvec_def GTY(()) {
      &_rtx->u.fld[_n]; }))
 
 #define RTL_CHECKC1(RTX, N, C) __extension__				\
-(*({ rtx const _rtx = (RTX); const int _n = (N);			\
+(*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N);		\
      if (GET_CODE (_rtx) != (C))					\
        rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__,		\
 			       __FUNCTION__);				\
      &_rtx->u.fld[_n]; }))
 
 #define RTL_CHECKC2(RTX, N, C1, C2) __extension__			\
-(*({ rtx const _rtx = (RTX); const int _n = (N);			\
+(*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N);		\
      const enum rtx_code _code = GET_CODE (_rtx);			\
      if (_code != (C1) && _code != (C2))				\
        rtl_check_failed_code2 (_rtx, (C1), (C2), __FILE__, __LINE__,	\
@@ -491,14 +491,14 @@ struct rtvec_def GTY(()) {
      &_rtx->u.fld[_n]; }))
 
 #define RTVEC_ELT(RTVEC, I) __extension__				\
-(*({ rtvec const _rtvec = (RTVEC); const int _i = (I);			\
+(*({ __typeof (RTVEC) const _rtvec = (RTVEC); const int _i = (I);	\
      if (_i < 0 || _i >= GET_NUM_ELEM (_rtvec))				\
        rtvec_check_failed_bounds (_rtvec, _i, __FILE__, __LINE__,	\
 				  __FUNCTION__);			\
      &_rtvec->elem[_i]; }))
 
 #define XWINT(RTX, N) __extension__					\
-(*({ rtx const _rtx = (RTX); const int _n = (N);			\
+(*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N);		\
      const enum rtx_code _code = GET_CODE (_rtx);			\
      if (_n < 0 || _n >= GET_RTX_LENGTH (_code))			\
        rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__,		\
@@ -509,29 +509,29 @@ struct rtvec_def GTY(()) {
      &_rtx->u.hwint[_n]; }))
 
 #define XCWINT(RTX, N, C) __extension__					\
-(*({ rtx const _rtx = (RTX);						\
+(*({ __typeof (RTX) const _rtx = (RTX);					\
      if (GET_CODE (_rtx) != (C))					\
        rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__,		\
 			       __FUNCTION__);				\
      &_rtx->u.hwint[N]; }))
 
 #define XCMWINT(RTX, N, C, M) __extension__				\
-(*({ rtx const _rtx = (RTX);						\
+(*({ __typeof (RTX) const _rtx = (RTX);					\
      if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) != (M))		\
        rtl_check_failed_code_mode (_rtx, (C), (M), false, __FILE__,	\
 				   __LINE__, __FUNCTION__);		\
      &_rtx->u.hwint[N]; }))
 
 #define XCNMPRV(RTX, C, M) __extension__				\
-({ rtx const _rtx = (RTX);						\
+({ __typeof (RTX) const _rtx = (RTX);					\
    if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M))		\
      rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__,	\
 				 __LINE__, __FUNCTION__);		\
    &_rtx->u.rv; })
 
 #define BLOCK_SYMBOL_CHECK(RTX) __extension__				\
-({ rtx const _symbol = (RTX);						\
-   unsigned int flags = RTL_CHECKC1 (_symbol, 1, SYMBOL_REF).rt_int;	\
+({ __typeof (RTX) const _symbol = (RTX);				\
+   const unsigned int flags = RTL_CHECKC1 (_symbol, 1, SYMBOL_REF).rt_int; \
    if ((flags & SYMBOL_FLAG_HAS_BLOCK_INFO) == 0)			\
      rtl_check_failed_block_symbol (__FILE__, __LINE__,			\
 				    __FUNCTION__);			\
@@ -584,21 +584,21 @@ extern void rtvec_check_failed_bounds (r
 
 #if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION >= 2007)
 #define RTL_FLAG_CHECK1(NAME, RTX, C1) __extension__			\
-({ rtx const _rtx = (RTX);						\
+({ __typeof (RTX) const _rtx = (RTX);					\
    if (GET_CODE(_rtx) != C1)						\
      rtl_check_failed_flag  (NAME, _rtx, __FILE__, __LINE__,		\
 			     __FUNCTION__);				\
    _rtx; })
 
 #define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) __extension__		\
-({ rtx const _rtx = (RTX);						\
+({ __typeof (RTX) const _rtx = (RTX);					\
    if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2)			\
      rtl_check_failed_flag  (NAME,_rtx, __FILE__, __LINE__,		\
 			      __FUNCTION__);				\
    _rtx; })
 
 #define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) __extension__		\
-({ rtx const _rtx = (RTX);						\
+({ __typeof (RTX) const _rtx = (RTX);					\
    if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2			\
        && GET_CODE(_rtx) != C3)						\
      rtl_check_failed_flag  (NAME, _rtx, __FILE__, __LINE__,		\
@@ -606,7 +606,7 @@ extern void rtvec_check_failed_bounds (r
    _rtx; })
 
 #define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) __extension__	\
-({ rtx const _rtx = (RTX);						\
+({ __typeof (RTX) const _rtx = (RTX);					\
    if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2			\
        && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4)			\
      rtl_check_failed_flag  (NAME, _rtx, __FILE__, __LINE__,		\
@@ -614,7 +614,7 @@ extern void rtvec_check_failed_bounds (r
    _rtx; })
 
 #define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) __extension__	\
-({ rtx const _rtx = (RTX);						\
+({ __typeof (RTX) const _rtx = (RTX);					\
    if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2			\
        && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4			\
        && GET_CODE(_rtx) != C5)						\
@@ -624,7 +624,7 @@ extern void rtvec_check_failed_bounds (r
 
 #define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6)		\
   __extension__								\
-({ rtx const _rtx = (RTX);						\
+({ __typeof (RTX) const _rtx = (RTX);					\
    if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2			\
        && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4			\
        && GET_CODE(_rtx) != C5 && GET_CODE(_rtx) != C6)			\
@@ -634,7 +634,7 @@ extern void rtvec_check_failed_bounds (r
 
 #define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7)		\
   __extension__								\
-({ rtx const _rtx = (RTX);						\
+({ __typeof (RTX) const _rtx = (RTX);					\
    if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2			\
        && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4			\
        && GET_CODE(_rtx) != C5 && GET_CODE(_rtx) != C6			\
@@ -645,7 +645,7 @@ extern void rtvec_check_failed_bounds (r
 
 #define RTL_FLAG_CHECK8(NAME, RTX, C1, C2, C3, C4, C5, C6, C7, C8)	\
   __extension__								\
-({ rtx const _rtx = (RTX);						\
+({ __typeof (RTX) const _rtx = (RTX);					\
    if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2			\
        && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4			\
        && GET_CODE(_rtx) != C5 && GET_CODE(_rtx) != C6			\
@@ -918,7 +918,7 @@ enum label_kind
 
 /* Retrieve the kind of LABEL.  */
 #define LABEL_KIND(LABEL) __extension__					\
-({ rtx const _label = (LABEL);						\
+({ __typeof (LABEL) const _label = (LABEL);					\
    if (GET_CODE (_label) != CODE_LABEL)					\
      rtl_check_failed_flag ("LABEL_KIND", _label, __FILE__, __LINE__,	\
 			    __FUNCTION__);				\
@@ -926,8 +926,8 @@ enum label_kind
 
 /* Set the kind of LABEL.  */
 #define SET_LABEL_KIND(LABEL, KIND) do {				\
-   rtx _label = (LABEL);						\
-   unsigned int _kind = (KIND);						\
+   rtx const _label = (LABEL);						\
+   const unsigned int _kind = (KIND);					\
    if (GET_CODE (_label) != CODE_LABEL)					\
      rtl_check_failed_flag ("SET_LABEL_KIND", _label, __FILE__, __LINE__, \
 			    __FUNCTION__);				\
@@ -943,8 +943,8 @@ enum label_kind
 
 /* Set the kind of LABEL.  */
 #define SET_LABEL_KIND(LABEL, KIND) do {				\
-   rtx _label = (LABEL);						\
-   unsigned int _kind = (KIND);						\
+   rtx const _label = (LABEL);						\
+   const unsigned int _kind = (KIND);					\
    _label->jump = ((_kind >> 1) & 1);					\
    _label->call = (_kind & 1);						\
 } while (0)
diff -rup orig/egcc-SVN20060725/gcc/tree.h egcc-SVN20060725/gcc/tree.h
--- orig/egcc-SVN20060725/gcc/tree.h	2006-07-20 20:01:05.000000000 -0400
+++ egcc-SVN20060725/gcc/tree.h	2006-07-26 02:01:49.325334037 -0400
@@ -561,21 +561,21 @@ enum tree_node_structure_enum {
 #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
 
 #define TREE_CHECK(T, CODE) __extension__				\
-({  const tree __t = (T);						\
+({  __typeof (T) const __t = (T);					\
     if (TREE_CODE (__t) != (CODE))					\
       tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 	\
 			 (CODE), 0);					\
     __t; })
 
 #define TREE_NOT_CHECK(T, CODE) __extension__				\
-({  const tree __t = (T);						\
+({  __typeof (T) const __t = (T);					\
     if (TREE_CODE (__t) == (CODE))					\
       tree_not_check_failed (__t, __FILE__, __LINE__, __FUNCTION__,	\
 			     (CODE), 0);				\
     __t; })
 
 #define TREE_CHECK2(T, CODE1, CODE2) __extension__			\
-({  const tree __t = (T);						\
+({  __typeof (T) const __t = (T);					\
     if (TREE_CODE (__t) != (CODE1)					\
 	&& TREE_CODE (__t) != (CODE2))					\
       tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__,		\
@@ -583,7 +583,7 @@ enum tree_node_structure_enum {
     __t; })
 
 #define TREE_NOT_CHECK2(T, CODE1, CODE2) __extension__			\
-({  const tree __t = (T);						\
+({  __typeof (T) const __t = (T);					\
     if (TREE_CODE (__t) == (CODE1)					\
 	|| TREE_CODE (__t) == (CODE2))					\
       tree_not_check_failed (__t, __FILE__, __LINE__, __FUNCTION__,	\
@@ -591,7 +591,7 @@ enum tree_node_structure_enum {
     __t; })
 
 #define TREE_CHECK3(T, CODE1, CODE2, CODE3) __extension__		\
-({  const tree __t = (T);						\
+({  __typeof (T) const __t = (T);					\
     if (TREE_CODE (__t) != (CODE1)					\
 	&& TREE_CODE (__t) != (CODE2)					\
 	&& TREE_CODE (__t) != (CODE3))					\
@@ -600,7 +600,7 @@ enum tree_node_structure_enum {
     __t; })
 
 #define TREE_NOT_CHECK3(T, CODE1, CODE2, CODE3) __extension__		\
-({  const tree __t = (T);						\
+({  __typeof (T) const __t = (T);					\
     if (TREE_CODE (__t) == (CODE1)					\
 	|| TREE_CODE (__t) == (CODE2)					\
 	|| TREE_CODE (__t) == (CODE3))					\
@@ -609,7 +609,7 @@ enum tree_node_structure_enum {
     __t; })
 
 #define TREE_CHECK4(T, CODE1, CODE2, CODE3, CODE4) __extension__	\
-({  const tree __t = (T);						\
+({  __typeof (T) const __t = (T);					\
     if (TREE_CODE (__t) != (CODE1)					\
 	&& TREE_CODE (__t) != (CODE2)					\
 	&& TREE_CODE (__t) != (CODE3)					\
@@ -619,7 +619,7 @@ enum tree_node_structure_enum {
     __t; })
 
 #define NON_TREE_CHECK4(T, CODE1, CODE2, CODE3, CODE4) __extension__	\
-({  const tree __t = (T);						\
+({  __typeof (T) const __t = (T);					\
     if (TREE_CODE (__t) == (CODE1)					\
 	|| TREE_CODE (__t) == (CODE2)					\
 	|| TREE_CODE (__t) == (CODE3)					\
@@ -629,7 +629,7 @@ enum tree_node_structure_enum {
     __t; })
 
 #define TREE_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) __extension__	\
-({  const tree __t = (T);						\
+({  __typeof (T) const __t = (T);					\
     if (TREE_CODE (__t) != (CODE1)					\
 	&& TREE_CODE (__t) != (CODE2)					\
 	&& TREE_CODE (__t) != (CODE3)					\
@@ -640,7 +640,7 @@ enum tree_node_structure_enum {
     __t; })
 
 #define TREE_NOT_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) __extension__ \
-({  const tree __t = (T);						\
+({  __typeof (T) const __t = (T);					\
     if (TREE_CODE (__t) == (CODE1)					\
 	|| TREE_CODE (__t) == (CODE2)					\
 	|| TREE_CODE (__t) == (CODE3)					\
@@ -651,28 +651,28 @@ enum tree_node_structure_enum {
     __t; })
 
 #define CONTAINS_STRUCT_CHECK(T, STRUCT) __extension__			\
-({  const tree __t = (T);						\
+({  __typeof (T) const __t = (T);					\
   if (tree_contains_struct[TREE_CODE(__t)][(STRUCT)] != 1)		\
       tree_contains_struct_check_failed (__t, (STRUCT), __FILE__, __LINE__,	\
 			       __FUNCTION__);				\
     __t; })
 
 #define TREE_CLASS_CHECK(T, CLASS) __extension__			\
-({  const tree __t = (T);						\
+({  __typeof (T) const __t = (T);					\
     if (TREE_CODE_CLASS (TREE_CODE(__t)) != (CLASS))			\
       tree_class_check_failed (__t, (CLASS), __FILE__, __LINE__,	\
 			       __FUNCTION__);				\
     __t; })
 
 #define TREE_RANGE_CHECK(T, CODE1, CODE2) __extension__			\
-({  const tree __t = (T);						\
+({  __typeof (T) const __t = (T);					\
     if (TREE_CODE (__t) < (CODE1) || TREE_CODE (__t) > (CODE2))		\
       tree_range_check_failed (__t, __FILE__, __LINE__, __FUNCTION__,	\
 			       (CODE1), (CODE2));			\
     __t; })
 
 #define OMP_CLAUSE_SUBCODE_CHECK(T, CODE) __extension__			\
-({  const tree __t = (T);						\
+({  __typeof (T) const __t = (T);					\
     if (TREE_CODE (__t) != OMP_CLAUSE)					\
       tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__,  	\
 			 OMP_CLAUSE, 0);				\
@@ -682,7 +682,7 @@ enum tree_node_structure_enum {
     __t; })
 
 #define OMP_CLAUSE_RANGE_CHECK(T, CODE1, CODE2) __extension__		\
-({  const tree __t = (T);						\
+({  __typeof (T) const __t = (T);					\
     if (TREE_CODE (__t) != OMP_CLAUSE)					\
       tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__,  	\
 			 OMP_CLAUSE, 0);				\
@@ -694,7 +694,7 @@ enum tree_node_structure_enum {
 
 /* These checks have to be special cased.  */
 #define EXPR_CHECK(T) __extension__					\
-({  const tree __t = (T);						\
+({  __typeof (T) const __t = (T);					\
     char const __c = TREE_CODE_CLASS (TREE_CODE (__t));			\
     if (!IS_EXPR_CODE_CLASS (__c))					\
       tree_class_check_failed (__t, tcc_expression, __FILE__, __LINE__,	\
@@ -703,14 +703,14 @@ enum tree_node_structure_enum {
 
 /* These checks have to be special cased.  */
 #define NON_TYPE_CHECK(T) __extension__					\
-({  const tree __t = (T);						\
+({  __typeof (T) const __t = (T);					\
     if (TYPE_P (__t))							\
       tree_not_class_check_failed (__t, tcc_type, __FILE__, __LINE__,	\
 				   __FUNCTION__);			\
     __t; })
 
 #define TREE_VEC_ELT_CHECK(T, I) __extension__				\
-(*({const tree __t = (T);						\
+(*({__typeof (T) const __t = (T);					\
     const int __i = (I);						\
     if (TREE_CODE (__t) != TREE_VEC)					\
       tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__,		\
@@ -720,9 +720,9 @@ enum tree_node_structure_enum {
 				 __FILE__, __LINE__, __FUNCTION__);	\
     &__t->vec.a[__i]; }))
 
-#define PHI_NODE_ELT_CHECK(t, i) __extension__				\
-(*({const tree __t = t;							\
-    const int __i = (i);						\
+#define PHI_NODE_ELT_CHECK(T, I) __extension__				\
+(*({__typeof (T) const __t = (T);					\
+    const int __i = (I);						\
     if (TREE_CODE (__t) != PHI_NODE)					\
       tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__,  	\
 			 PHI_NODE, 0);					\
@@ -731,9 +731,9 @@ enum tree_node_structure_enum {
 				 __FILE__, __LINE__, __FUNCTION__);	\
     &__t->phi.a[__i]; }))
 
-#define OMP_CLAUSE_ELT_CHECK(t, i) __extension__			\
-(*({const tree __t = t;							\
-    const int __i = (i);						\
+#define OMP_CLAUSE_ELT_CHECK(T, I) __extension__			\
+(*({__typeof (T) const __t = (T);						\
+    const int __i = (I);						\
     if (TREE_CODE (__t) != OMP_CLAUSE)					\
       tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__,  	\
 			 OMP_CLAUSE, 0);				\
@@ -744,7 +744,7 @@ enum tree_node_structure_enum {
 
 /* Special checks for TREE_OPERANDs.  */
 #define TREE_OPERAND_CHECK(T, I) __extension__				\
-(*({const tree __t = EXPR_CHECK (T);					\
+(*({__typeof (T) const __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),			\
@@ -752,7 +752,7 @@ enum tree_node_structure_enum {
     &__t->exp.operands[__i]; }))
 
 #define TREE_OPERAND_CHECK_CODE(T, CODE, I) __extension__		\
-(*({const tree __t = (T);						\
+(*({__typeof (T) const __t = (T);					\
     const int __i = (I);						\
     if (TREE_CODE (__t) != CODE)					\
       tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, (CODE), 0);\
@@ -763,7 +763,7 @@ enum tree_node_structure_enum {
 
 #define TREE_RTL_OPERAND_CHECK(T, CODE, I) __extension__		\
 (*(rtx *)								\
- ({const tree __t = (T);						\
+ ({__typeof (T) const __t = (T);					\
     const int __i = (I);						\
     if (TREE_CODE (__t) != (CODE))					\
       tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, (CODE), 0); \



More information about the Gcc-patches mailing list