This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Use "const_tree" in GCC sources
- From: "Kaveh R. Ghazi" <ghazi at caipclassic dot rutgers dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 12 Aug 2006 23:32:33 -0400 (EDT)
- Subject: Use "const_tree" in GCC sources
This patch makes use of the new typedef `const_tree' submitted here:
http://gcc.gnu.org/ml/gcc-patches/2006-08/msg00383.html
The rationale: some functions taking a tree clearly do not modify the
supplied parameter, e.g. the function integer_zerop(). In these cases
I constified a tree parameter using const_tree, or added a const
qualifier as necessary.
Tested on sparc-sun-solaris2.10, no regressions.
Okay for mainline stage1 ?
Thanks,
--Kaveh
2006-07-26 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* print-tree.c (dump_addr, print_node_brief): Constify.
* real.h (real_value_from_int_cst): Likewise.
* tree.c (attribute_hash_list, tree_size, int_cst_hash_hash,
int_cst_hash_eq, cst_and_fits_in_hwi, real_value_from_int_cst,
build_real_from_int_cst, integer_zerop, integer_onep,
integer_all_onesp, integer_pow2p, integer_nonzerop, tree_log2,
tree_floor_log2, real_zerop, real_onep, real_twop,
real_minus_onep, really_constant_p, chain_member, list_length,
fields_length, int_size_in_bytes, bit_position, int_bit_position,
expr_align, array_type_nelts, tree_node_structure,
contains_placeholder_p, type_contains_placeholder_1,
iterative_hash_pointer, is_attribute_with_length_p,
is_attribute_p, check_qualified_type, tree_map_marked_p,
tree_int_map_marked_p, type_hash_marked_p, attribute_hash_list,
type_list_equal, type_num_arguments, tree_int_cst_equal,
tree_int_cst_lt, tree_int_cst_compare, host_integerp,
tree_low_cst, tree_int_cst_msb, tree_int_cst_sgn,
simple_cst_list_equal, simple_cst_equal, compare_tree_int,
iterative_hash_expr, get_inner_array_type, get_containing_scope,
decl_function_context, decl_type_context, tree_check_failed,
tree_not_check_failed, tree_class_check_failed,
tree_range_check_failed, tree_not_class_check_failed,
omp_clause_check_failed, omp_clause_range_check_failed,
tree_contains_struct_check_failed,
omp_clause_operand_check_failed, initializer_zerop, is_global_var,
fields_compatible_p, int_cst_value, num_ending_zeros): Likewise.
* tree.h (tree_contains_struct_check_failed, tree_check_failed,
tree_not_check_failed, tree_class_check_failed,
tree_range_check_failed, tree_not_class_check_failed,
omp_clause_check_failed, omp_clause_operand_check_failed,
omp_clause_range_check_failed, tree_size, build_real_from_int_cst,
array_type_nelts, tree_int_cst_equal, tree_int_cst_lt,
tree_int_cst_compare, host_integerp, tree_low_cst,
tree_int_cst_msb, tree_int_cst_sgn, get_inner_array_type,
is_attribute_p, check_qualified_type, expr_align,
int_size_in_bytes, bit_position, int_bit_position, list_length,
fields_length, initializer_zerop, integer_zerop, integer_onep,
integer_all_onesp, integer_pow2p, integer_nonzerop,
cst_and_fits_in_hwi, num_ending_zeros, tree_node_structure,
contains_placeholder_p, get_containing_scope,
decl_function_context, decl_type_context, real_zerop,
type_num_arguments, really_constant_p, tree_log2, tree_floor_log2,
simple_cst_equal, iterative_hash_expr, compare_tree_int,
type_list_equal, chain_member, simple_cst_list_equal,
is_global_var, real_onep, real_twop, real_minus_onep,
int_cst_value, fields_compatible_p, dump_addr, print_node_brief):
Likewise.
diff -rup orig/egcc-SVN20060725/gcc/print-tree.c egcc-SVN20060725/gcc/print-tree.c
--- orig/egcc-SVN20060725/gcc/print-tree.c 2006-07-17 20:02:10.000000000 -0400
+++ egcc-SVN20060725/gcc/print-tree.c 2006-07-28 12:59:35.365015180 -0400
@@ -59,7 +59,7 @@ debug_tree (tree node)
/* Print PREFIX and ADDR to FILE. */
void
-dump_addr (FILE *file, const char *prefix, void *addr)
+dump_addr (FILE *file, const char *prefix, const void *addr)
{
if (flag_dump_noaddr || flag_dump_unnumbered)
fprintf (file, "%s#", prefix);
@@ -70,7 +70,7 @@ dump_addr (FILE *file, const char *prefi
/* Print a node in brief fashion, with just the code, address and name. */
void
-print_node_brief (FILE *file, const char *prefix, tree node, int indent)
+print_node_brief (FILE *file, const char *prefix, const_tree node, int indent)
{
enum tree_code_class class;
diff -rup orig/egcc-SVN20060725/gcc/real.h egcc-SVN20060725/gcc/real.h
--- orig/egcc-SVN20060725/gcc/real.h 2006-01-23 00:24:02.000000000 -0500
+++ egcc-SVN20060725/gcc/real.h 2006-07-28 12:59:35.366381121 -0400
@@ -387,7 +387,7 @@ extern REAL_VALUE_TYPE dconste;
/* Function to return a real value (not a tree node)
from a given integer constant. */
-REAL_VALUE_TYPE real_value_from_int_cst (tree, tree);
+REAL_VALUE_TYPE real_value_from_int_cst (const_tree, const_tree);
/* Given a CONST_DOUBLE in FROM, store into TO the value it represents. */
#define REAL_VALUE_FROM_CONST_DOUBLE(to, from) \
diff -rup orig/egcc-SVN20060725/gcc/tree.c egcc-SVN20060725/gcc/tree.c
--- orig/egcc-SVN20060725/gcc/tree.c 2006-07-20 20:01:05.000000000 -0400
+++ egcc-SVN20060725/gcc/tree.c 2006-07-28 12:59:35.386634470 -0400
@@ -168,7 +168,7 @@ static void print_value_expr_statistics
static tree make_vector_type (tree, int, enum machine_mode);
static int type_hash_marked_p (const void *);
static unsigned int type_hash_list (tree, hashval_t);
-static unsigned int attribute_hash_list (tree, hashval_t);
+static unsigned int attribute_hash_list (const_tree, hashval_t);
tree global_trees[TI_MAX];
tree integer_types[itk_none];
@@ -401,7 +401,7 @@ tree_code_size (enum tree_code code)
/* Compute the number of bytes occupied by NODE. This routine only
looks at TREE_CODE, except for PHI_NODE and TREE_VEC nodes. */
size_t
-tree_size (tree node)
+tree_size (const_tree node)
{
enum tree_code code = TREE_CODE (node);
switch (code)
@@ -772,7 +772,7 @@ build_int_cst_type (tree type, HOST_WIDE
static hashval_t
int_cst_hash_hash (const void *x)
{
- tree t = (tree) x;
+ const_tree t = (const_tree) x;
return (TREE_INT_CST_HIGH (t) ^ TREE_INT_CST_LOW (t)
^ htab_hash_pointer (TREE_TYPE (t)));
@@ -784,8 +784,8 @@ int_cst_hash_hash (const void *x)
static int
int_cst_hash_eq (const void *x, const void *y)
{
- tree xt = (tree) x;
- tree yt = (tree) y;
+ const_tree xt = (const_tree) x;
+ const_tree yt = (const_tree) y;
return (TREE_TYPE (xt) == TREE_TYPE (yt)
&& TREE_INT_CST_HIGH (xt) == TREE_INT_CST_HIGH (yt)
@@ -940,7 +940,7 @@ build_low_bits_mask (tree type, unsigned
HOST_WIDE_INT without loss of precision. */
bool
-cst_and_fits_in_hwi (tree x)
+cst_and_fits_in_hwi (const_tree x)
{
if (TREE_CODE (x) != INTEGER_CST)
return false;
@@ -1081,7 +1081,7 @@ build_real (tree type, REAL_VALUE_TYPE d
and whose value is the integer value of the INTEGER_CST node I. */
REAL_VALUE_TYPE
-real_value_from_int_cst (tree type, tree i)
+real_value_from_int_cst (const_tree type, const_tree i)
{
REAL_VALUE_TYPE d;
@@ -1099,7 +1099,7 @@ real_value_from_int_cst (tree type, tree
representing the same value as a floating-point constant of type TYPE. */
tree
-build_real_from_int_cst (tree type, tree i)
+build_real_from_int_cst (tree type, const_tree i)
{
tree v;
int overflow = TREE_OVERFLOW (i);
@@ -1255,7 +1255,7 @@ make_tree_vec_stat (int len MEM_STAT_DEC
of zero. */
int
-integer_zerop (tree expr)
+integer_zerop (const_tree expr)
{
STRIP_NOPS (expr);
@@ -1271,7 +1271,7 @@ integer_zerop (tree expr)
complex constant. */
int
-integer_onep (tree expr)
+integer_onep (const_tree expr)
{
STRIP_NOPS (expr);
@@ -1287,7 +1287,7 @@ integer_onep (tree expr)
it contains. Likewise for the corresponding complex constant. */
int
-integer_all_onesp (tree expr)
+integer_all_onesp (const_tree expr)
{
int prec;
int uns;
@@ -1339,7 +1339,7 @@ integer_all_onesp (tree expr)
one bit on). */
int
-integer_pow2p (tree expr)
+integer_pow2p (const_tree expr)
{
int prec;
HOST_WIDE_INT high, low;
@@ -1384,7 +1384,7 @@ integer_pow2p (tree expr)
complex constant other than zero. */
int
-integer_nonzerop (tree expr)
+integer_nonzerop (const_tree expr)
{
STRIP_NOPS (expr);
@@ -1400,7 +1400,7 @@ integer_nonzerop (tree expr)
power of two. */
int
-tree_log2 (tree expr)
+tree_log2 (const_tree expr)
{
int prec;
HOST_WIDE_INT high, low;
@@ -1438,7 +1438,7 @@ tree_log2 (tree expr)
than or equal to EXPR. */
int
-tree_floor_log2 (tree expr)
+tree_floor_log2 (const_tree expr)
{
int prec;
HOST_WIDE_INT high, low;
@@ -1476,7 +1476,7 @@ tree_floor_log2 (tree expr)
/* Return 1 if EXPR is the real constant zero. */
int
-real_zerop (tree expr)
+real_zerop (const_tree expr)
{
STRIP_NOPS (expr);
@@ -1490,7 +1490,7 @@ real_zerop (tree expr)
/* Return 1 if EXPR is the real constant one in real or complex form. */
int
-real_onep (tree expr)
+real_onep (const_tree expr)
{
STRIP_NOPS (expr);
@@ -1504,7 +1504,7 @@ real_onep (tree expr)
/* Return 1 if EXPR is the real constant two. */
int
-real_twop (tree expr)
+real_twop (const_tree expr)
{
STRIP_NOPS (expr);
@@ -1518,7 +1518,7 @@ real_twop (tree expr)
/* Return 1 if EXPR is the real constant minus one. */
int
-real_minus_onep (tree expr)
+real_minus_onep (const_tree expr)
{
STRIP_NOPS (expr);
@@ -1532,7 +1532,7 @@ real_minus_onep (tree expr)
/* Nonzero if EXP is a constant or a cast of a constant. */
int
-really_constant_p (tree exp)
+really_constant_p (const_tree exp)
{
/* This is not quite the same as STRIP_NOPS. It does more. */
while (TREE_CODE (exp) == NOP_EXPR
@@ -1575,7 +1575,7 @@ purpose_member (tree elem, tree list)
/* Return nonzero if ELEM is part of the chain CHAIN. */
int
-chain_member (tree elem, tree chain)
+chain_member (const_tree elem, const_tree chain)
{
while (chain)
{
@@ -1592,11 +1592,11 @@ chain_member (tree elem, tree chain)
This is the Lisp primitive `length'. */
int
-list_length (tree t)
+list_length (const_tree t)
{
- tree p = t;
+ const_tree p = t;
#ifdef ENABLE_TREE_CHECKING
- tree q = t;
+ const_tree q = t;
#endif
int len = 0;
@@ -1617,9 +1617,9 @@ list_length (tree t)
/* Returns the number of FIELD_DECLs in TYPE. */
int
-fields_length (tree type)
+fields_length (const_tree type)
{
- tree t = TYPE_FIELDS (type);
+ const_tree t = TYPE_FIELDS (type);
int count = 0;
for (; t; t = TREE_CHAIN (t))
@@ -1757,7 +1757,7 @@ size_in_bytes (tree type)
or return -1 if the size can vary or is larger than an integer. */
HOST_WIDE_INT
-int_size_in_bytes (tree type)
+int_size_in_bytes (const_tree type)
{
tree t;
@@ -1813,7 +1813,7 @@ max_int_size_in_bytes (tree type)
This is a tree of type bitsizetype. */
tree
-bit_position (tree field)
+bit_position (const_tree field)
{
return bit_from_pos (DECL_FIELD_OFFSET (field),
DECL_FIELD_BIT_OFFSET (field));
@@ -1824,7 +1824,7 @@ bit_position (tree field)
option of returning -1 like int_size_in_byte can. */
HOST_WIDE_INT
-int_bit_position (tree field)
+int_bit_position (const_tree field)
{
return tree_low_cst (bit_position (field), 0);
}
@@ -1852,7 +1852,7 @@ int_byte_position (tree field)
/* Return the strictest alignment, in bits, that T is known to have. */
unsigned int
-expr_align (tree t)
+expr_align (const_tree t)
{
unsigned int align0, align1;
@@ -1899,7 +1899,7 @@ expr_align (tree t)
ARRAY_TYPE) minus one. This counts only elements of the top array. */
tree
-array_type_nelts (tree type)
+array_type_nelts (const_tree type)
{
tree index_type, min, max;
@@ -2091,7 +2091,7 @@ skip_simple_arithmetic (tree expr)
/* Return which tree structure is used by T. */
enum tree_node_structure_enum
-tree_node_structure (tree t)
+tree_node_structure (const_tree t)
{
enum tree_code code = TREE_CODE (t);
@@ -2169,7 +2169,7 @@ tree_node_structure (tree t)
or offset that depends on a field within a record. */
bool
-contains_placeholder_p (tree exp)
+contains_placeholder_p (const_tree exp)
{
enum tree_code code;
@@ -2239,7 +2239,7 @@ contains_placeholder_p (tree exp)
(for QUAL_UNION_TYPE) and field positions. */
static bool
-type_contains_placeholder_1 (tree type)
+type_contains_placeholder_1 (const_tree type)
{
/* If the size contains a placeholder or the parent type (component type in
the case of arrays) type involves a placeholder, this type does. */
@@ -3315,7 +3315,7 @@ iterative_hash_hashval_t (hashval_t val,
/* Produce good hash value combining PTR and VAL2. */
static inline hashval_t
-iterative_hash_pointer (void *ptr, hashval_t val2)
+iterative_hash_pointer (const void *ptr, hashval_t val2)
{
if (sizeof (ptr) == sizeof (hashval_t))
return iterative_hash_hashval_t ((size_t) ptr, val2);
@@ -3428,7 +3428,7 @@ build_type_attribute_variant (tree ttype
their canonicalized form. */
static int
-is_attribute_with_length_p (const char *attr, int attr_len, tree ident)
+is_attribute_with_length_p (const char *attr, int attr_len, const_tree ident)
{
int ident_len;
const char *p;
@@ -3472,7 +3472,7 @@ is_attribute_with_length_p (const char *
We try both `text' and `__text__', ATTR may be either one. */
int
-is_attribute_p (const char *attr, tree ident)
+is_attribute_p (const char *attr, const_tree ident)
{
return is_attribute_with_length_p (attr, strlen (attr), ident);
}
@@ -3781,7 +3781,7 @@ set_type_quals (tree type, int type_qual
/* Returns true iff cand is equivalent to base with type_quals. */
bool
-check_qualified_type (tree cand, tree base, int type_quals)
+check_qualified_type (const_tree cand, const_tree base, int type_quals)
{
return (TYPE_QUALS (cand) == type_quals
&& TYPE_NAME (cand) == TYPE_NAME (base)
@@ -3894,7 +3894,7 @@ tree_map_hash (const void *item)
int
tree_map_marked_p (const void *p)
{
- tree from = ((struct tree_map *) p)->from;
+ tree from = ((const struct tree_map *) p)->from;
return ggc_marked_p (from);
}
@@ -3923,7 +3923,7 @@ tree_int_map_hash (const void *item)
static int
tree_int_map_marked_p (const void *p)
{
- tree from = ((struct tree_int_map *) p)->from;
+ tree from = ((const struct tree_int_map *) p)->from;
return ggc_marked_p (from);
}
@@ -4290,7 +4290,7 @@ type_hash_canon (unsigned int hashcode,
static int
type_hash_marked_p (const void *p)
{
- tree type = ((struct type_hash *) p)->type;
+ tree type = ((const struct type_hash *) p)->type;
return ggc_marked_p (type) || TYPE_SYMTAB_POINTER (type);
}
@@ -4309,9 +4309,9 @@ print_type_hash_statistics (void)
by adding the hash codes of the individual attributes. */
unsigned int
-attribute_hash_list (tree list, hashval_t hashcode)
+attribute_hash_list (const_tree list, hashval_t hashcode)
{
- tree tail;
+ const_tree tail;
for (tail = list; tail; tail = TREE_CHAIN (tail))
/* ??? Do we want to add in TREE_VALUE too? */
@@ -4386,9 +4386,9 @@ attribute_list_contained (tree l1, tree
Also, the TREE_PURPOSEs must match. */
int
-type_list_equal (tree l1, tree l2)
+type_list_equal (const_tree l1, const_tree l2)
{
- tree t1, t2;
+ const_tree t1, t2;
for (t1 = l1, t2 = l2; t1 && t2; t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2))
if (TREE_VALUE (t1) != TREE_VALUE (t2)
@@ -4406,7 +4406,7 @@ type_list_equal (tree l1, tree l2)
then this function counts only the ordinary arguments. */
int
-type_num_arguments (tree type)
+type_num_arguments (const_tree type)
{
int i = 0;
tree t;
@@ -4426,7 +4426,7 @@ type_num_arguments (tree type)
represent the same constant value. */
int
-tree_int_cst_equal (tree t1, tree t2)
+tree_int_cst_equal (const_tree t1, const_tree t2)
{
if (t1 == t2)
return 1;
@@ -4447,7 +4447,7 @@ tree_int_cst_equal (tree t1, tree t2)
The precise way of comparison depends on their data type. */
int
-tree_int_cst_lt (tree t1, tree t2)
+tree_int_cst_lt (const_tree t1, const_tree t2)
{
if (t1 == t2)
return 0;
@@ -4474,7 +4474,7 @@ tree_int_cst_lt (tree t1, tree t2)
/* Returns -1 if T1 < T2, 0 if T1 == T2, and 1 if T1 > T2. */
int
-tree_int_cst_compare (tree t1, tree t2)
+tree_int_cst_compare (const_tree t1, const_tree t2)
{
if (tree_int_cst_lt (t1, t2))
return -1;
@@ -4490,7 +4490,7 @@ tree_int_cst_compare (tree t1, tree t2)
be represented in a single unsigned HOST_WIDE_INT. */
int
-host_integerp (tree t, int pos)
+host_integerp (const_tree t, int pos)
{
return (TREE_CODE (t) == INTEGER_CST
&& ((TREE_INT_CST_HIGH (t) == 0
@@ -4506,7 +4506,7 @@ host_integerp (tree t, int pos)
be non-negative. We must be able to satisfy the above conditions. */
HOST_WIDE_INT
-tree_low_cst (tree t, int pos)
+tree_low_cst (const_tree t, int pos)
{
gcc_assert (host_integerp (t, pos));
return TREE_INT_CST_LOW (t);
@@ -4515,7 +4515,7 @@ tree_low_cst (tree t, int pos)
/* Return the most significant bit of the integer constant T. */
int
-tree_int_cst_msb (tree t)
+tree_int_cst_msb (const_tree t)
{
int prec;
HOST_WIDE_INT h;
@@ -4534,7 +4534,7 @@ tree_int_cst_msb (tree t)
Note that -1 will never be returned if T's type is unsigned. */
int
-tree_int_cst_sgn (tree t)
+tree_int_cst_sgn (const_tree t)
{
if (TREE_INT_CST_LOW (t) == 0 && TREE_INT_CST_HIGH (t) == 0)
return 0;
@@ -4550,7 +4550,7 @@ tree_int_cst_sgn (tree t)
are known to be equal; otherwise return 0. */
int
-simple_cst_list_equal (tree l1, tree l2)
+simple_cst_list_equal (const_tree l1, const_tree l2)
{
while (l1 != NULL_TREE && l2 != NULL_TREE)
{
@@ -4571,7 +4571,7 @@ simple_cst_list_equal (tree l1, tree l2)
this function. */
int
-simple_cst_equal (tree t1, tree t2)
+simple_cst_equal (const_tree t1, const_tree t2)
{
enum tree_code code1, code2;
int cmp;
@@ -4720,7 +4720,7 @@ simple_cst_equal (tree t1, tree t2)
than U, respectively. */
int
-compare_tree_int (tree t, unsigned HOST_WIDE_INT u)
+compare_tree_int (const_tree t, unsigned HOST_WIDE_INT u)
{
if (tree_int_cst_sgn (t) < 0)
return -1;
@@ -4794,7 +4794,7 @@ commutative_tree_code (enum tree_code co
would compare equal using operand_equal_p. */
hashval_t
-iterative_hash_expr (tree t, hashval_t val)
+iterative_hash_expr (const_tree t, hashval_t val)
{
int i;
enum tree_code code;
@@ -5175,7 +5175,7 @@ build_array_type (tree elt_type, tree in
the innermost dimension of ARRAY. */
tree
-get_inner_array_type (tree array)
+get_inner_array_type (const_tree array)
{
tree type = TREE_TYPE (array);
@@ -5801,7 +5801,7 @@ variably_modified_type_p (tree type, tre
NULL_TREE if there is no containing scope. */
tree
-get_containing_scope (tree t)
+get_containing_scope (const_tree t)
{
return (TYPE_P (t) ? TYPE_CONTEXT (t) : DECL_CONTEXT (t));
}
@@ -5810,7 +5810,7 @@ get_containing_scope (tree t)
a FUNCTION_DECL, or zero if none. */
tree
-decl_function_context (tree decl)
+decl_function_context (const_tree decl)
{
tree context;
@@ -5846,7 +5846,7 @@ decl_function_context (tree decl)
TYPE_DECLs and FUNCTION_DECLs are transparent to this function. */
tree
-decl_type_context (tree decl)
+decl_type_context (const_tree decl)
{
tree context = DECL_CONTEXT (decl);
@@ -6087,7 +6087,7 @@ get_file_function_name (int kind)
are of the caller. */
void
-tree_check_failed (const tree node, const char *file,
+tree_check_failed (const_tree node, const char *file,
int line, const char *function, ...)
{
va_list args;
@@ -6129,7 +6129,7 @@ tree_check_failed (const tree node, cons
the caller. */
void
-tree_not_check_failed (const tree node, const char *file,
+tree_not_check_failed (const_tree node, const char *file,
int line, const char *function, ...)
{
va_list args;
@@ -6165,7 +6165,7 @@ tree_not_check_failed (const tree node,
code, given in CL. */
void
-tree_class_check_failed (const tree node, const enum tree_code_class cl,
+tree_class_check_failed (const_tree node, const enum tree_code_class cl,
const char *file, int line, const char *function)
{
internal_error
@@ -6179,7 +6179,7 @@ tree_class_check_failed (const tree node
dozen codes, use the knowledge that they're all sequential. */
void
-tree_range_check_failed (const tree node, const char *file, int line,
+tree_range_check_failed (const_tree node, const char *file, int line,
const char *function, enum tree_code c1,
enum tree_code c2)
{
@@ -6214,7 +6214,7 @@ tree_range_check_failed (const tree node
not have the specified code, given in CL. */
void
-tree_not_class_check_failed (const tree node, const enum tree_code_class cl,
+tree_not_class_check_failed (const_tree node, const enum tree_code_class cl,
const char *file, int line, const char *function)
{
internal_error
@@ -6228,7 +6228,7 @@ tree_not_class_check_failed (const tree
/* Similar to tree_check_failed but applied to OMP_CLAUSE codes. */
void
-omp_clause_check_failed (const tree node, const char *file, int line,
+omp_clause_check_failed (const_tree node, const char *file, int line,
const char *function, enum omp_clause_code code)
{
internal_error ("tree check: expected omp_clause %s, have %s in %s, at %s:%d",
@@ -6240,7 +6240,7 @@ omp_clause_check_failed (const tree node
/* Similar to tree_range_check_failed but applied to OMP_CLAUSE codes. */
void
-omp_clause_range_check_failed (const tree node, const char *file, int line,
+omp_clause_range_check_failed (const_tree node, const char *file, int line,
const char *function, enum omp_clause_code c1,
enum omp_clause_code c2)
{
@@ -6285,7 +6285,7 @@ static const char *ts_enum_names[] = {
whether CODE contains the tree structure identified by EN. */
void
-tree_contains_struct_check_failed (const tree node,
+tree_contains_struct_check_failed (const_tree node,
const enum tree_node_structure_enum en,
const char *file, int line,
const char *function)
@@ -6338,7 +6338,7 @@ tree_operand_check_failed (int idx, enum
operands of an OMP_CLAUSE node. */
void
-omp_clause_operand_check_failed (int idx, tree t, const char *file,
+omp_clause_operand_check_failed (int idx, const_tree t, const char *file,
int line, const char *function)
{
internal_error
@@ -6848,7 +6848,7 @@ build_resx (int region_number)
/* Given an initializer INIT, return TRUE if INIT is zero or some
aggregate of zeros. Otherwise return FALSE. */
bool
-initializer_zerop (tree init)
+initializer_zerop (const_tree init)
{
tree elt;
@@ -6991,7 +6991,7 @@ range_in_array_bounds_p (tree ref)
/* Return true if T (assumed to be a DECL) is a global variable. */
bool
-is_global_var (tree t)
+is_global_var (const_tree t)
{
if (MTAG_P (t))
return (TREE_STATIC (t) || MTAG_GLOBAL (t));
@@ -7016,7 +7016,7 @@ needs_to_live_in_memory (tree t)
are compatible. It is assumed that the parent records are compatible. */
bool
-fields_compatible_p (tree f1, tree f2)
+fields_compatible_p (const_tree f1, const_tree f2)
{
if (!operand_equal_p (DECL_FIELD_BIT_OFFSET (f1),
DECL_FIELD_BIT_OFFSET (f2), OEP_ONLY_CONST))
@@ -7058,7 +7058,7 @@ find_compatible_field (tree record, tree
/* Return value of a constant X. */
HOST_WIDE_INT
-int_cst_value (tree x)
+int_cst_value (const_tree x)
{
unsigned bits = TYPE_PRECISION (TREE_TYPE (x));
unsigned HOST_WIDE_INT val = TREE_INT_CST_LOW (x);
@@ -7263,7 +7263,7 @@ operand_equal_for_phi_arg_p (tree arg0,
??? Use ffs if available? */
tree
-num_ending_zeros (tree x)
+num_ending_zeros (const_tree x)
{
unsigned HOST_WIDE_INT fr, nfr;
unsigned num, abits;
diff -rup orig/egcc-SVN20060725/gcc/tree.h egcc-SVN20060725/gcc/tree.h
--- orig/egcc-SVN20060725/gcc/tree.h 2006-07-28 12:59:45.541817635 -0400
+++ egcc-SVN20060725/gcc/tree.h 2006-07-28 12:59:35.397404074 -0400
@@ -772,22 +772,22 @@ enum tree_node_structure_enum {
__FILE__, __LINE__, __FUNCTION__); \
&__t->exp.operands[__i]; }))
-extern void tree_contains_struct_check_failed (const tree,
+extern void tree_contains_struct_check_failed (const_tree,
const enum tree_node_structure_enum,
const char *, int, const char *)
ATTRIBUTE_NORETURN;
-extern void tree_check_failed (const tree, const char *, int, const char *,
+extern void tree_check_failed (const_tree, const char *, int, const char *,
...) ATTRIBUTE_NORETURN;
-extern void tree_not_check_failed (const tree, const char *, int, const char *,
+extern void tree_not_check_failed (const_tree, const char *, int, const char *,
...) ATTRIBUTE_NORETURN;
-extern void tree_class_check_failed (const tree, const enum tree_code_class,
+extern void tree_class_check_failed (const_tree, const enum tree_code_class,
const char *, int, const char *)
ATTRIBUTE_NORETURN;
-extern void tree_range_check_failed (const tree, const char *, int,
+extern void tree_range_check_failed (const_tree, const char *, int,
const char *, enum tree_code,
enum tree_code);
-extern void tree_not_class_check_failed (const tree,
+extern void tree_not_class_check_failed (const_tree,
const enum tree_code_class,
const char *, int, const char *)
ATTRIBUTE_NORETURN;
@@ -800,13 +800,13 @@ extern void phi_node_elt_check_failed (i
extern void tree_operand_check_failed (int, enum tree_code,
const char *, int, const char *)
ATTRIBUTE_NORETURN;
-extern void omp_clause_check_failed (const tree, const char *, int,
+extern void omp_clause_check_failed (const_tree, const char *, int,
const char *, enum omp_clause_code)
ATTRIBUTE_NORETURN;
-extern void omp_clause_operand_check_failed (int, tree, const char *,
+extern void omp_clause_operand_check_failed (int, const_tree, const char *,
int, const char *)
ATTRIBUTE_NORETURN;
-extern void omp_clause_range_check_failed (const tree, const char *, int,
+extern void omp_clause_range_check_failed (const_tree, const char *, int,
const char *, enum omp_clause_code,
enum omp_clause_code)
ATTRIBUTE_NORETURN;
@@ -3422,7 +3422,7 @@ extern tree decl_assembler_name (tree);
/* Compute the number of bytes occupied by 'node'. This routine only
looks at TREE_CODE and, if the code is TREE_VEC, TREE_VEC_LENGTH. */
-extern size_t tree_size (tree);
+extern size_t tree_size (const_tree);
/* Compute the number of bytes occupied by a tree with code CODE. This
function cannot be used for TREE_VEC or PHI_NODE codes, which are of
@@ -3532,7 +3532,7 @@ extern tree build_vector_from_ctor (tree
extern tree build_constructor (tree, VEC(constructor_elt,gc) *);
extern tree build_constructor_single (tree, tree, tree);
extern tree build_constructor_from_list (tree, tree);
-extern tree build_real_from_int_cst (tree, tree);
+extern tree build_real_from_int_cst (tree, const_tree);
extern tree build_complex (tree, tree, tree);
extern tree build_one_cst (tree);
extern tree build_string (int, const char *);
@@ -3575,7 +3575,7 @@ extern tree build_method_type (tree, tre
extern tree build_offset_type (tree, tree);
extern tree build_complex_type (tree);
extern tree build_resx (int);
-extern tree array_type_nelts (tree);
+extern tree array_type_nelts (const_tree);
extern bool in_array_bounds_p (tree);
extern bool range_in_array_bounds_p (tree);
@@ -3584,17 +3584,17 @@ extern tree purpose_member (tree, tree);
extern int attribute_list_equal (tree, tree);
extern int attribute_list_contained (tree, tree);
-extern int tree_int_cst_equal (tree, tree);
-extern int tree_int_cst_lt (tree, tree);
-extern int tree_int_cst_compare (tree, tree);
-extern int host_integerp (tree, int);
-extern HOST_WIDE_INT tree_low_cst (tree, int);
-extern int tree_int_cst_msb (tree);
-extern int tree_int_cst_sgn (tree);
+extern int tree_int_cst_equal (const_tree, const_tree);
+extern int tree_int_cst_lt (const_tree, const_tree);
+extern int tree_int_cst_compare (const_tree, const_tree);
+extern int host_integerp (const_tree, int);
+extern HOST_WIDE_INT tree_low_cst (const_tree, int);
+extern int tree_int_cst_msb (const_tree);
+extern int tree_int_cst_sgn (const_tree);
extern int tree_int_cst_sign_bit (tree);
extern int tree_expr_nonnegative_p (tree);
extern bool may_negate_without_overflow_p (tree);
-extern tree get_inner_array_type (tree);
+extern tree get_inner_array_type (const_tree);
/* From expmed.c. Since rtl.h is included after tree.h, we can't
put the prototype here. Rtl.h does declare the prototype if
@@ -3689,7 +3689,7 @@ extern tree merge_type_attributes (tree,
/* Given a tree node and a string, return nonzero if the tree node is
a valid attribute name for the string. */
-extern int is_attribute_p (const char *, tree);
+extern int is_attribute_p (const char *, const_tree);
/* Given an attribute name and a list of attributes, return the list element
of the attribute or NULL_TREE if not found. */
@@ -3717,7 +3717,7 @@ extern tree handle_dll_attribute (tree *
/* Check whether CAND is suitable to be returned from get_qualified_type
(BASE, TYPE_QUALS). */
-extern bool check_qualified_type (tree, tree, int);
+extern bool check_qualified_type (const_tree, const_tree, int);
/* Return a version of the TYPE, qualified as indicated by the
TYPE_QUALS, if one exists. If no qualified version exists yet,
@@ -3839,15 +3839,15 @@ extern enum machine_mode mode_for_size_t
extern tree non_lvalue (tree);
extern tree convert (tree, tree);
-extern unsigned int expr_align (tree);
+extern unsigned int expr_align (const_tree);
extern tree expr_first (tree);
extern tree expr_last (tree);
extern tree expr_only (tree);
extern tree size_in_bytes (tree);
-extern HOST_WIDE_INT int_size_in_bytes (tree);
+extern HOST_WIDE_INT int_size_in_bytes (const_tree);
extern HOST_WIDE_INT max_int_size_in_bytes (tree);
-extern tree bit_position (tree);
-extern HOST_WIDE_INT int_bit_position (tree);
+extern tree bit_position (const_tree);
+extern HOST_WIDE_INT int_bit_position (const_tree);
extern tree byte_position (tree);
extern HOST_WIDE_INT int_byte_position (tree);
@@ -3918,16 +3918,16 @@ extern tree nreverse (tree);
/* Returns the length of a chain of nodes
(number of chain pointers to follow before reaching a null pointer). */
-extern int list_length (tree);
+extern int list_length (const_tree);
/* Returns the number of FIELD_DECLs in a type. */
-extern int fields_length (tree);
+extern int fields_length (const_tree);
/* Given an initializer INIT, return TRUE if INIT is zero or some
aggregate of zeros. Otherwise return FALSE. */
-extern bool initializer_zerop (tree);
+extern bool initializer_zerop (const_tree);
/* Examine CTOR to discover:
* how many scalar fields are set to nonzero values,
@@ -3947,30 +3947,30 @@ extern HOST_WIDE_INT count_type_elements
/* integer_zerop (tree x) is nonzero if X is an integer constant of value 0. */
-extern int integer_zerop (tree);
+extern int integer_zerop (const_tree);
/* integer_onep (tree x) is nonzero if X is an integer constant of value 1. */
-extern int integer_onep (tree);
+extern int integer_onep (const_tree);
/* integer_all_onesp (tree x) is nonzero if X is an integer constant
all of whose significant bits are 1. */
-extern int integer_all_onesp (tree);
+extern int integer_all_onesp (const_tree);
/* integer_pow2p (tree x) is nonzero is X is an integer constant with
exactly one bit 1. */
-extern int integer_pow2p (tree);
+extern int integer_pow2p (const_tree);
/* integer_nonzerop (tree x) is nonzero if X is an integer constant
with a nonzero value. */
-extern int integer_nonzerop (tree);
+extern int integer_nonzerop (const_tree);
extern bool zero_p (tree);
-extern bool cst_and_fits_in_hwi (tree);
-extern tree num_ending_zeros (tree);
+extern bool cst_and_fits_in_hwi (const_tree);
+extern tree num_ending_zeros (const_tree);
/* staticp (tree x) is nonzero if X is a reference to data allocated
at a fixed address in memory. Returns the outermost data. */
@@ -3990,7 +3990,7 @@ extern tree skip_simple_arithmetic (tree
/* Return which tree structure is used by T. */
-enum tree_node_structure_enum tree_node_structure (tree);
+enum tree_node_structure_enum tree_node_structure (const_tree);
/* Return 1 if EXP contains a PLACEHOLDER_EXPR; i.e., if it represents a size
or offset that depends on a field within a record.
@@ -3998,7 +3998,7 @@ enum tree_node_structure_enum tree_node_
Note that we only allow such expressions within simple arithmetic
or a COND_EXPR. */
-extern bool contains_placeholder_p (tree);
+extern bool contains_placeholder_p (const_tree);
/* This macro calls the above function but short-circuits the common
case of a constant to save time. Also check for null. */
@@ -4106,18 +4106,18 @@ extern tree component_ref_field_offset (
/* Given a DECL or TYPE, return the scope in which it was declared, or
NUL_TREE if there is no containing scope. */
-extern tree get_containing_scope (tree);
+extern tree get_containing_scope (const_tree);
/* Return the FUNCTION_DECL which provides this _DECL with its context,
or zero if none. */
-extern tree decl_function_context (tree);
+extern tree decl_function_context (const_tree);
/* Return the RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE which provides
this _DECL with its context, or zero if none. */
-extern tree decl_type_context (tree);
+extern tree decl_type_context (const_tree);
/* Return 1 if EXPR is the real constant zero. */
-extern int real_zerop (tree);
+extern int real_zerop (const_tree);
/* Declare commonly used variables for tree structure. */
@@ -4139,7 +4139,7 @@ extern void clean_symbol_name (char *);
extern tree get_file_function_name_long (const char *);
extern tree get_callee_fndecl (tree);
extern void change_decl_assembler_name (tree, tree);
-extern int type_num_arguments (tree);
+extern int type_num_arguments (const_tree);
extern bool associative_tree_code (enum tree_code);
extern bool commutative_tree_code (enum tree_code);
extern tree upper_bound_in_type (tree, tree);
@@ -4288,43 +4288,43 @@ extern int alias_sets_might_conflict_p (
extern int objects_must_conflict_p (tree, tree);
/* In tree.c */
-extern int really_constant_p (tree);
+extern int really_constant_p (const_tree);
extern int int_fits_type_p (tree, tree);
extern bool variably_modified_type_p (tree, tree);
-extern int tree_log2 (tree);
-extern int tree_floor_log2 (tree);
-extern int simple_cst_equal (tree, tree);
-extern hashval_t iterative_hash_expr (tree, hashval_t);
-extern int compare_tree_int (tree, unsigned HOST_WIDE_INT);
-extern int type_list_equal (tree, tree);
-extern int chain_member (tree, tree);
+extern int tree_log2 (const_tree);
+extern int tree_floor_log2 (const_tree);
+extern int simple_cst_equal (const_tree, const_tree);
+extern hashval_t iterative_hash_expr (const_tree, hashval_t);
+extern int compare_tree_int (const_tree, unsigned HOST_WIDE_INT);
+extern int type_list_equal (const_tree, const_tree);
+extern int chain_member (const_tree, const_tree);
extern tree type_hash_lookup (unsigned int, tree);
extern void type_hash_add (unsigned int, tree);
-extern int simple_cst_list_equal (tree, tree);
+extern int simple_cst_list_equal (const_tree, const_tree);
extern void dump_tree_statistics (void);
extern void expand_function_end (void);
extern void expand_function_start (tree);
extern void stack_protect_prologue (void);
extern void stack_protect_epilogue (void);
extern void recompute_tree_invariant_for_addr_expr (tree);
-extern bool is_global_var (tree t);
+extern bool is_global_var (const_tree t);
extern bool needs_to_live_in_memory (tree);
extern tree reconstruct_complex_type (tree, tree);
-extern int real_onep (tree);
-extern int real_twop (tree);
-extern int real_minus_onep (tree);
+extern int real_onep (const_tree);
+extern int real_twop (const_tree);
+extern int real_minus_onep (const_tree);
extern void init_ttree (void);
extern void build_common_tree_nodes (bool, bool);
extern void build_common_tree_nodes_2 (int);
extern void build_common_builtin_nodes (void);
extern tree build_nonstandard_integer_type (unsigned HOST_WIDE_INT, int);
extern tree build_range_type (tree, tree, tree);
-extern HOST_WIDE_INT int_cst_value (tree);
+extern HOST_WIDE_INT int_cst_value (const_tree);
extern tree tree_fold_gcd (tree, tree);
extern tree build_addr (tree, tree);
-extern bool fields_compatible_p (tree, tree);
+extern bool fields_compatible_p (const_tree, const_tree);
extern tree find_compatible_field (tree, tree);
/* In function.c */
@@ -4357,9 +4357,9 @@ extern void print_rtl (FILE *, rtx);
/* In print-tree.c */
extern void debug_tree (tree);
#ifdef BUFSIZ
-extern void dump_addr (FILE*, const char *, void *);
+extern void dump_addr (FILE*, const char *, const void *);
extern void print_node (FILE *, const char *, tree, int);
-extern void print_node_brief (FILE *, const char *, tree, int);
+extern void print_node_brief (FILE *, const char *, const_tree, int);
extern void indent_to (FILE *, int);
#endif