c-common.c (fname_as_string, [...]): Constify.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Wed, 25 Jul 2007 19:06:06 +0000 (19:06 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Wed, 25 Jul 2007 19:06:06 +0000 (19:06 +0000)
* c-common.c (fname_as_string, c_type_hash): Constify.
* c-typeck.c (free_all_tagged_tu_seen_up_to): Likewise.
* cgraph.c (edge_hash, edge_eq): Likewise.
* dwarf2out.c (decl_die_table_eq, decl_loc_table_eq): Likewise.
* emit-rtl.c (mem_attrs_htab_eq, reg_attrs_htab_hash,
reg_attrs_htab_eq): Likewise.
* except.c (t2r_eq, t2r_hash, ttypes_filter_eq, ehl_hash, ehl_eq):
Likewise.
* genautomata.c (const_reserv_sets_t, const_unit_decl_t,
const_decl_t, const_state_t, const_automata_list_el_t): New.
(first_out_arc, DECL_UNIT, DECL_BYPASS, DECL_AUTOMATON, DECL_EXCL,
DECL_PRESENCE, DECL_ABSENCE, DECL_RESERV, DECL_INSN_RESERV,
automaton_decl_hash, automaton_decl_eq_p, insn_decl_hash,
insn_decl_eq_p, decl_hash, decl_eq_p, alt_state_cmp,
reserv_sets_cmp, reserv_sets_eq, state_hash, state_eq_p,
automata_list_hash, automata_list_eq_p, compare_states_for_equiv,
compare_max_occ_cycle_nums, out_state_arcs_num,
compare_transition_els_num, units_cmp, state_reservs_cmp):
Constify.
* genmodes.c (cmp_modes): Likewise.
* ggc-common.c (saving_htab_hash, saving_htab_eq): Likewise.
* gimplify.c (compare_case_labels): Likewise.
* ipa-type-escape.c (get_name_of_type, type_brand_s): Likewise.
* loop-unroll.c (si_info_hash, ve_info_hash): Likewise.
* matrix-reorg.c (mtt_info_hash): Likewise.
* postreload-gcse.c (hash_expr_for_htab, expr_equiv_p): Likewise.
* rtl-factoring.c (const_p_hash_bucket, const_p_hash_elem): New.
(htab_hash_bucket, htab_hash_elem): Constify.
* tree-browser.c (TB_parent_eq): Likewise.
* tree-scalar-evolution.c (hash_scev_info): Likewise.
* tree-ssa-alias.c (sort_tags_by_id): Likewise.
* tree-ssa-coalesce.c (const_coalesce_pair_p): New.
(coalesce_pair_map_hash, coalesce_pair_map_eq, compare_pairs):
Constify.
* tree-ssa-dom.c (avail_expr_hash, avail_expr_eq): Likewise.
* tree-ssa-pre.c (const_expr_pred_trans_t): New.
(expr_pred_trans_hash, expr_pred_trans_eq): Constify.
* tree-ssa-sccvn.c (const_vn_binary_op_t, const_vn_unary_op_t,
const_vn_phi_t, const_vn_reference_op_t, const_vn_reference_t):
New.
(vn_reference_op_eq, vn_reference_hash, vn_reference_eq,
vn_unary_op_hash, vn_unary_op_eq, vn_binary_op_hash,
vn_binary_op_eq, vn_phi_hash, vn_phi_eq): Constify.
* tree-ssa-threadupdate.c (redirection_data_hash,
redirection_data_eq): Likewise.
* tree-ssa-uncprop.c (equiv_hash, equiv_eq): Likewise.
* tree-ssa.c (var_ann_eq): Likewise.
* tree-vrp.c (compare_case_labels): Likewise.
* tree.c (int_cst_hash_hash, int_cst_hash_eq,
tree_map_base_marked_p, type_hash_marked_p, 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, tree_operand_check_failed):
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,
tree_operand_check_failed, omp_clause_operand_check_failed,
tree_operand_length): Likewise.
* var-tracking.c (const_variable): New.
(variable_htab_hash, variable_htab_eq): Constify.
* varasm.c (const_desc_hash): Likewise.

cp:
* decl.c (typename_hash, typename_compare): Constify.
* mangle.c (hash_type, compare_type): Likewise.
* pt.c (eq_local_specializations, hash_local_specialization):
Likewise.
* tree.c (cplus_array_hash, cplus_array_compare, list_hash_eq,
list_hash): Likewise.
* typeck2.c (pat_compare): Likewise.

fortran:
* gfortran.h (generate_isocbinding_symbol): Constify.
* symbol.c (gen_special_c_interop_ptr, gen_cptr_param,
generate_isocbinding_symbol): Likewise.

java:
* class.c (java_treetreehash_hash, java_treetreehash_compare):
Constify.
* expr.c (type_assertion_eq): Likewise.
* jcf-io.c (compare_path): Likewise.
* jcf-parse.c (cmpstringp): Likewise.
* verify-impl.c (get_one_type, compute_argument_types,
compute_return_type): Likewise.

objc:
* objc-act.c (volatilized_hash, volatilized_eq, string_hash,
string_eq): Constify.

From-SVN: r126925

48 files changed:
gcc/ChangeLog
gcc/c-common.c
gcc/c-typeck.c
gcc/cgraph.c
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/mangle.c
gcc/cp/pt.c
gcc/cp/tree.c
gcc/cp/typeck2.c
gcc/dwarf2out.c
gcc/emit-rtl.c
gcc/except.c
gcc/fortran/ChangeLog
gcc/fortran/gfortran.h
gcc/fortran/symbol.c
gcc/genautomata.c
gcc/genmodes.c
gcc/ggc-common.c
gcc/gimplify.c
gcc/ipa-type-escape.c
gcc/java/ChangeLog
gcc/java/class.c
gcc/java/expr.c
gcc/java/jcf-io.c
gcc/java/jcf-parse.c
gcc/java/verify-impl.c
gcc/loop-unroll.c
gcc/matrix-reorg.c
gcc/objc/ChangeLog
gcc/objc/objc-act.c
gcc/postreload-gcse.c
gcc/rtl-factoring.c
gcc/tree-browser.c
gcc/tree-scalar-evolution.c
gcc/tree-ssa-alias.c
gcc/tree-ssa-coalesce.c
gcc/tree-ssa-dom.c
gcc/tree-ssa-pre.c
gcc/tree-ssa-sccvn.c
gcc/tree-ssa-threadupdate.c
gcc/tree-ssa-uncprop.c
gcc/tree-ssa.c
gcc/tree-vrp.c
gcc/tree.c
gcc/tree.h
gcc/var-tracking.c
gcc/varasm.c

index ba929443a225a51ec8361fab928bde750dc5c578..6b01c6a3f179f964829cac19940b478d822b176a 100644 (file)
@@ -1,3 +1,69 @@
+2007-07-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * c-common.c (fname_as_string, c_type_hash): Constify.
+       * c-typeck.c (free_all_tagged_tu_seen_up_to): Likewise.
+       * cgraph.c (edge_hash, edge_eq): Likewise.
+       * dwarf2out.c (decl_die_table_eq, decl_loc_table_eq): Likewise.
+       * emit-rtl.c (mem_attrs_htab_eq, reg_attrs_htab_hash,
+       reg_attrs_htab_eq): Likewise.
+       * except.c (t2r_eq, t2r_hash, ttypes_filter_eq, ehl_hash, ehl_eq):
+       Likewise.
+       * genautomata.c (const_reserv_sets_t, const_unit_decl_t,
+       const_decl_t, const_state_t, const_automata_list_el_t): New.
+       (first_out_arc, DECL_UNIT, DECL_BYPASS, DECL_AUTOMATON, DECL_EXCL,
+       DECL_PRESENCE, DECL_ABSENCE, DECL_RESERV, DECL_INSN_RESERV,
+       automaton_decl_hash, automaton_decl_eq_p, insn_decl_hash,
+       insn_decl_eq_p, decl_hash, decl_eq_p, alt_state_cmp,
+       reserv_sets_cmp, reserv_sets_eq, state_hash, state_eq_p,
+       automata_list_hash, automata_list_eq_p, compare_states_for_equiv,
+       compare_max_occ_cycle_nums, out_state_arcs_num,
+       compare_transition_els_num, units_cmp, state_reservs_cmp):
+       Constify.
+       * genmodes.c (cmp_modes): Likewise.
+       * ggc-common.c (saving_htab_hash, saving_htab_eq): Likewise.
+       * gimplify.c (compare_case_labels): Likewise.
+       * ipa-type-escape.c (get_name_of_type, type_brand_s): Likewise.
+       * loop-unroll.c (si_info_hash, ve_info_hash): Likewise.
+       * matrix-reorg.c (mtt_info_hash): Likewise.
+       * postreload-gcse.c (hash_expr_for_htab, expr_equiv_p): Likewise.
+       * rtl-factoring.c (const_p_hash_bucket, const_p_hash_elem): New.
+       (htab_hash_bucket, htab_hash_elem): Constify.
+       * tree-browser.c (TB_parent_eq): Likewise.
+       * tree-scalar-evolution.c (hash_scev_info): Likewise.
+       * tree-ssa-alias.c (sort_tags_by_id): Likewise.
+       * tree-ssa-coalesce.c (const_coalesce_pair_p): New.
+       (coalesce_pair_map_hash, coalesce_pair_map_eq, compare_pairs):
+       Constify.
+       * tree-ssa-dom.c (avail_expr_hash, avail_expr_eq): Likewise.
+       * tree-ssa-pre.c (const_expr_pred_trans_t): New.
+       (expr_pred_trans_hash, expr_pred_trans_eq): Constify.
+       * tree-ssa-sccvn.c (const_vn_binary_op_t, const_vn_unary_op_t,
+       const_vn_phi_t, const_vn_reference_op_t, const_vn_reference_t):
+       New.
+       (vn_reference_op_eq, vn_reference_hash, vn_reference_eq,
+       vn_unary_op_hash, vn_unary_op_eq, vn_binary_op_hash,
+       vn_binary_op_eq, vn_phi_hash, vn_phi_eq): Constify.
+       * tree-ssa-threadupdate.c (redirection_data_hash,
+       redirection_data_eq): Likewise. 
+       * tree-ssa-uncprop.c (equiv_hash, equiv_eq): Likewise.
+       * tree-ssa.c (var_ann_eq): Likewise.
+       * tree-vrp.c (compare_case_labels): Likewise.
+       * tree.c (int_cst_hash_hash, int_cst_hash_eq,
+       tree_map_base_marked_p, type_hash_marked_p, 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, tree_operand_check_failed):
+       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,
+       tree_operand_check_failed, omp_clause_operand_check_failed,
+       tree_operand_length): Likewise. 
+       * var-tracking.c (const_variable): New.
+       (variable_htab_hash, variable_htab_eq): Constify.
+       * varasm.c (const_desc_hash): Likewise.
+
 2007-07-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * expr.c (handled_component_p): Constify.
index c9874d23ccd9747366462380f720b6e3e36579ec..764a50f011e90a5f5e4f7290c34f83edbb75c1fe 100644 (file)
@@ -780,7 +780,7 @@ fname_as_string (int pretty_p)
       if (cpp_interpret_string (parse_in, &strname, 1, &cstr, false))
        {
          XDELETEVEC (namep);
-         return (char *) cstr.text;
+         return (const char *) cstr.text;
        }
     }
   else
@@ -3011,7 +3011,7 @@ c_type_hash (const void *p)
 {
   int i = 0;
   int shift, size;
-  tree t = (tree) p;
+  const_tree const t = (const_tree) p;
   tree t2;
   switch (TREE_CODE (t))
     {
index f4b5560eed3175b899dd0de9193fae65823269b3..cb1f23b4643008fa091fda28d3e1a39953ab5260 100644 (file)
@@ -1024,8 +1024,8 @@ free_all_tagged_tu_seen_up_to (const struct tagged_tu_seen_cache *tu_til)
   const struct tagged_tu_seen_cache *tu = tagged_tu_seen_base;
   while (tu != tu_til)
     {
-      const struct tagged_tu_seen_cache *tu1
-       = (const struct tagged_tu_seen_cache*)tu;
+      const struct tagged_tu_seen_cache *const tu1
+       = (const struct tagged_tu_seen_cache *) tu;
       tu = tu1->next;
       free ((void *)tu1);
     }
index 87114e2ff1316372236497a8ad847a02186007f8..422f4425e060e214d63ff92743df4d24475f9bdc 100644 (file)
@@ -246,7 +246,7 @@ cgraph_node_for_asm (tree asmname)
 static hashval_t
 edge_hash (const void *x)
 {
-  return htab_hash_pointer (((struct cgraph_edge *) x)->call_stmt);
+  return htab_hash_pointer (((const struct cgraph_edge *) x)->call_stmt);
 }
 
 /* Return nonzero if decl_id of die_struct X is the same as UID of decl *Y.  */
@@ -254,7 +254,7 @@ edge_hash (const void *x)
 static int
 edge_eq (const void *x, const void *y)
 {
-  return ((struct cgraph_edge *) x)->call_stmt == y;
+  return ((const struct cgraph_edge *) x)->call_stmt == y;
 }
 
 /* Return callgraph edge representing CALL_EXPR statement.  */
index 456e5878790388945d92336cda434d38631fffa2..cc423ede4ed74de4ca3681fe00aa5f1a35c55b66 100644 (file)
@@ -1,3 +1,13 @@
+2007-07-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * decl.c (typename_hash, typename_compare): Constify.
+       * mangle.c (hash_type, compare_type): Likewise.
+       * pt.c (eq_local_specializations, hash_local_specialization):
+       Likewise.
+       * tree.c (cplus_array_hash, cplus_array_compare, list_hash_eq,
+       list_hash): Likewise.
+       * typeck2.c (pat_compare): Likewise.
+
 2007-07-24  Nathan Sidwell  <nathan@codesourcery.com>
 
        * method.c (implicitly_declare_fn): Increase alignment if member
index e3c70a5c439e7d8f8295ce3b0ea9064fc3c08ee9..3262a310ca3295ac784d4d08a8b25feba88c40e2 100644 (file)
@@ -2716,7 +2716,7 @@ static hashval_t
 typename_hash (const void* k)
 {
   hashval_t hash;
-  tree t = (tree) k;
+  const_tree const t = (const_tree) k;
 
   hash = (htab_hash_pointer (TYPE_CONTEXT (t))
          ^ htab_hash_pointer (DECL_NAME (TYPE_NAME (t))));
@@ -2738,11 +2738,8 @@ typedef struct typename_info {
 static int
 typename_compare (const void * k1, const void * k2)
 {
-  tree t1;
-  const typename_info *t2;
-
-  t1 = (tree) k1;
-  t2 = (const typename_info *) k2;
+  const_tree const t1 = (const_tree) k1;
+  const typename_info *const t2 = (const typename_info *) k2;
 
   return (DECL_NAME (TYPE_NAME (t1)) == t2->name
          && TYPE_CONTEXT (t1) == t2->scope
index 5452f6cce795220306dfb72d9f37c9e0a2a10366..d708a2bf1f75561abc78e85c4102b294f4af937f 100644 (file)
@@ -2836,7 +2836,7 @@ static GTY ((param_is (union tree_node))) htab_t conv_type_names;
 static hashval_t
 hash_type (const void *val)
 {
-  return (hashval_t) TYPE_UID (TREE_TYPE ((tree) val));
+  return (hashval_t) TYPE_UID (TREE_TYPE ((const_tree) val));
 }
 
 /* Compare VAL1 (a node in the table) with VAL2 (a TYPE).  */
@@ -2844,7 +2844,7 @@ hash_type (const void *val)
 static int
 compare_type (const void *val1, const void *val2)
 {
-  return TREE_TYPE ((tree) val1) == (tree) val2;
+  return TREE_TYPE ((const_tree) val1) == (const_tree) val2;
 }
 
 /* Return an identifier for the mangled unqualified name for a
index 86b8eee6a1089c7cce4656b92630938aea6004d1..fc5af163e1c291bdf966a8d34abe64d6fd868d97 100644 (file)
@@ -1302,7 +1302,7 @@ reregister_specialization (tree spec, tree tmpl, tree new_spec)
 static int
 eq_local_specializations (const void *p1, const void *p2)
 {
-  return TREE_VALUE ((tree) p1) == (tree) p2;
+  return TREE_VALUE ((const_tree) p1) == (const_tree) p2;
 }
 
 /* Hash P1, an entry in the local specializations table.  */
@@ -1310,7 +1310,7 @@ eq_local_specializations (const void *p1, const void *p2)
 static hashval_t
 hash_local_specialization (const void* p1)
 {
-  return htab_hash_pointer (TREE_VALUE ((tree) p1));
+  return htab_hash_pointer (TREE_VALUE ((const_tree) p1));
 }
 
 /* Like register_specialization, but for local declarations.  We are
index dceb3f9fff273e398257b472d5a7246753e8ac4c..772df4cd8f84aa47d72adafd2d3c8283f9e18fc4 100644 (file)
@@ -489,7 +489,7 @@ static hashval_t
 cplus_array_hash (const void* k)
 {
   hashval_t hash;
-  tree t = (tree) k;
+  const_tree const t = (const_tree) k;
 
   hash = (htab_hash_pointer (TREE_TYPE (t))
          ^ htab_hash_pointer (TYPE_DOMAIN (t)));
@@ -508,8 +508,8 @@ typedef struct cplus_array_info {
 static int
 cplus_array_compare (const void * k1, const void * k2)
 {
-  tree t1 = (tree) k1;
-  const cplus_array_info *t2 = (const cplus_array_info*) k2;
+  const_tree const t1 = (const_tree) k1;
+  const cplus_array_info *const t2 = (const cplus_array_info*) k2;
 
   if (!comptypes (TREE_TYPE (t1), t2->type, COMPARE_STRUCTURAL))
     return 0;
@@ -967,8 +967,8 @@ struct list_proxy
 static int
 list_hash_eq (const void* entry, const void* data)
 {
-  tree t = (tree) entry;
-  struct list_proxy *proxy = (struct list_proxy *) data;
+  const_tree const t = (const_tree) entry;
+  const struct list_proxy *const proxy = (const struct list_proxy *) data;
 
   return (TREE_VALUE (t) == proxy->value
          && TREE_PURPOSE (t) == proxy->purpose
@@ -1003,7 +1003,7 @@ list_hash_pieces (tree purpose, tree value, tree chain)
 static hashval_t
 list_hash (const void* p)
 {
-  tree t = (tree) p;
+  const_tree const t = (const_tree) p;
   return list_hash_pieces (TREE_PURPOSE (t),
                           TREE_VALUE (t),
                           TREE_CHAIN (t));
index 14d9963f61c8d4674e1fb467603cee075eae8386..10f410c8ea863635334069252fc2ae0f4dde05e2 100644 (file)
@@ -149,9 +149,9 @@ pat_calc_hash (const void* val)
 static int
 pat_compare (const void* val1, const void* val2)
 {
-  const struct pending_abstract_type *pat1 =
+  const struct pending_abstract_type *const pat1 =
      (const struct pending_abstract_type *) val1;
-  tree type2 = (tree)val2;
+  const_tree const type2 = (const_tree)val2;
 
   return (pat1->type == type2);
 }
index 5b67962e515e3c0eee68b9c93677dfd44b88f94c..6134a9bf26a86080b68a543739336e601730b78a 100644 (file)
@@ -5694,7 +5694,7 @@ decl_die_table_hash (const void *x)
 static int
 decl_die_table_eq (const void *x, const void *y)
 {
-  return (((const_dw_die_ref) x)->decl_id == DECL_UID ((const tree) y));
+  return (((const_dw_die_ref) x)->decl_id == DECL_UID ((const_tree) y));
 }
 
 /* Return the DIE associated with a given declaration.  */
@@ -5719,7 +5719,7 @@ decl_loc_table_hash (const void *x)
 static int
 decl_loc_table_eq (const void *x, const void *y)
 {
-  return (((const var_loc_list *) x)->decl_id == DECL_UID ((const tree) y));
+  return (((const var_loc_list *) x)->decl_id == DECL_UID ((const_tree) y));
 }
 
 /* Return the var_loc list associated with a given declaration.  */
index 06ddf52c54068c35572d077807f220d393ff7f4b..e9aebe1b3329728d9005eaf8025d82dc68d02ee2 100644 (file)
@@ -263,8 +263,8 @@ mem_attrs_htab_hash (const void *x)
 static int
 mem_attrs_htab_eq (const void *x, const void *y)
 {
-  mem_attrs *p = (mem_attrs *) x;
-  mem_attrs *q = (mem_attrs *) y;
+  const mem_attrs *const p = (const mem_attrs *) x;
+  const mem_attrs *const q = (const mem_attrs *) y;
 
   return (p->alias == q->alias && p->offset == q->offset
          && p->size == q->size && p->align == q->align
@@ -315,7 +315,7 @@ get_mem_attrs (HOST_WIDE_INT alias, tree expr, rtx offset, rtx size,
 static hashval_t
 reg_attrs_htab_hash (const void *x)
 {
-  reg_attrs *p = (reg_attrs *) x;
+  const reg_attrs *const p = (const reg_attrs *) x;
 
   return ((p->offset * 1000) ^ (long) p->decl);
 }
@@ -327,8 +327,8 @@ reg_attrs_htab_hash (const void *x)
 static int
 reg_attrs_htab_eq (const void *x, const void *y)
 {
-  reg_attrs *p = (reg_attrs *) x;
-  reg_attrs *q = (reg_attrs *) y;
+  const reg_attrs *const p = (const reg_attrs *) x;
+  const reg_attrs *const q = (const reg_attrs *) y;
 
   return (p->decl == q->decl && p->offset == q->offset);
 }
index b360ae4ad1da7f63ed76ac99b5a76a3efe1dc6fd..7451e51c265613fb924df5d1cb1992e569f42483 100644 (file)
@@ -1129,8 +1129,8 @@ eh_region_outermost (struct function *ifun, int region_a, int region_b)
 static int
 t2r_eq (const void *pentry, const void *pdata)
 {
-  tree entry = (tree) pentry;
-  tree data = (tree) pdata;
+  const_tree const entry = (const_tree) pentry;
+  const_tree const data = (const_tree) pdata;
 
   return TREE_PURPOSE (entry) == data;
 }
@@ -1138,7 +1138,7 @@ t2r_eq (const void *pentry, const void *pdata)
 static hashval_t
 t2r_hash (const void *pentry)
 {
-  tree entry = (tree) pentry;
+  const_tree const entry = (const_tree) pentry;
   return TREE_HASH (TREE_PURPOSE (entry));
 }
 
@@ -1183,8 +1183,9 @@ struct ttypes_filter GTY(())
 static int
 ttypes_filter_eq (const void *pentry, const void *pdata)
 {
-  const struct ttypes_filter *entry = (const struct ttypes_filter *) pentry;
-  tree data = (tree) pdata;
+  const struct ttypes_filter *const entry
+    = (const struct ttypes_filter *) pentry;
+  const_tree const data = (const_tree) pdata;
 
   return entry->t == data;
 }
@@ -2131,7 +2132,8 @@ finish_eh_generation (void)
 static hashval_t
 ehl_hash (const void *pentry)
 {
-  struct ehl_map_entry *entry = (struct ehl_map_entry *) pentry;
+  const struct ehl_map_entry *const entry
+    = (const struct ehl_map_entry *) pentry;
 
   /* 2^32 * ((sqrt(5) - 1) / 2) */
   const hashval_t scaled_golden_ratio = 0x9e3779b9;
@@ -2141,8 +2143,10 @@ ehl_hash (const void *pentry)
 static int
 ehl_eq (const void *pentry, const void *pdata)
 {
-  struct ehl_map_entry *entry = (struct ehl_map_entry *) pentry;
-  struct ehl_map_entry *data = (struct ehl_map_entry *) pdata;
+  const struct ehl_map_entry *const entry
+    = (const struct ehl_map_entry *) pentry;
+  const struct ehl_map_entry *const data
+    = (const struct ehl_map_entry *) pdata;
 
   return entry->label == data->label;
 }
index 7050f52569af93dd4503280eb635f00e4f911c2a..cb7cae7968fc727f1ad2a79f16044255b0b61b20 100644 (file)
@@ -1,3 +1,9 @@
+2007-07-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * gfortran.h (generate_isocbinding_symbol): Constify.
+       * symbol.c (gen_special_c_interop_ptr, gen_cptr_param,
+       generate_isocbinding_symbol): Likewise.
+
 2007-07-24 Paul Thomas <pault@gcc.gnu.org>
 
        PR fortran/31205
index f475c1e9209bbd334499245d86e8eb16a2f16147..a0b79e55402d9237cb54ecd1042714ceff5f21f4 100644 (file)
@@ -2137,7 +2137,7 @@ try verify_c_interop_param (gfc_symbol *);
 try verify_bind_c_sym (gfc_symbol *, gfc_typespec *, int, gfc_common_head *);
 try verify_bind_c_derived_type (gfc_symbol *);
 try verify_com_block_vars_c_interop (gfc_common_head *);
-void generate_isocbinding_symbol (const char *, iso_c_binding_symbol, char *);
+void generate_isocbinding_symbol (const char *, iso_c_binding_symbol, const char *);
 gfc_symbol *get_iso_c_sym (gfc_symbol *, char *, char *, int);
 int gfc_get_sym_tree (const char *, gfc_namespace *, gfc_symtree **);
 int gfc_get_ha_symbol (const char *, gfc_symbol **);
index af42e9b6146ea6e2526510c180fd46b962ca3d66..3674b31cd321a865710020cf06617265ca02eee5 100644 (file)
@@ -3235,7 +3235,7 @@ gen_special_c_interop_ptr (int ptr_id, const char *ptr_name,
          current ns.  */
       generate_isocbinding_symbol (module_name, ptr_id == ISOCBINDING_NULL_PTR 
                                    ? ISOCBINDING_PTR : ISOCBINDING_FUNPTR,
-                                   (char *) (ptr_id == ISOCBINDING_NULL_PTR 
+                                   (const char *) (ptr_id == ISOCBINDING_NULL_PTR 
                                   ? "_gfortran_iso_c_binding_c_ptr"
                                   : "_gfortran_iso_c_binding_c_funptr"));
 
@@ -3356,10 +3356,10 @@ gen_cptr_param (gfc_formal_arglist **head,
          trying to use one of the iso_c_binding functions that need it.  */
       if (iso_c_sym_id == ISOCBINDING_F_PROCPOINTER)
        generate_isocbinding_symbol (module_name, ISOCBINDING_FUNPTR,
-                                    (char *)c_ptr_type);
+                                    (const char *)c_ptr_type);
       else
        generate_isocbinding_symbol (module_name, ISOCBINDING_PTR,
-                                    (char *)c_ptr_type);
+                                    (const char *)c_ptr_type);
 
       gfc_get_ha_symbol (c_ptr_type, &(c_ptr_sym));
     }
@@ -3579,9 +3579,9 @@ build_formal_args (gfc_symbol *new_proc_sym,
 
 void
 generate_isocbinding_symbol (const char *mod_name, iso_c_binding_symbol s,
-                            char *local_name)
+                            const char *local_name)
 {
-  char *name = (local_name && local_name[0]) ? local_name
+  const char *const name = (local_name && local_name[0]) ? local_name
                                             : c_interop_kinds_table[s].name;
   gfc_symtree *tmp_symtree = NULL;
   gfc_symbol *tmp_sym = NULL;
@@ -3803,7 +3803,7 @@ generate_isocbinding_symbol (const char *mod_name, iso_c_binding_symbol s,
                     generate_isocbinding_symbol
                      (mod_name, s == ISOCBINDING_FUNLOC
                                 ? ISOCBINDING_FUNPTR : ISOCBINDING_PTR,
-                      (char *)(s == ISOCBINDING_FUNLOC
+                      (const char *)(s == ISOCBINDING_FUNLOC
                                 ? "_gfortran_iso_c_binding_c_funptr"
                                : "_gfortran_iso_c_binding_c_ptr"));
                     tmp_sym->ts.derived =
index 5bfdf96fa4357da86102ff23ed871f357ac50237..979fad602ec8f1db7ba23fa79018a21252f6988f 100644 (file)
@@ -130,6 +130,7 @@ typedef unsigned HOST_WIDE_INT set_el_t;
 /* Reservations of function units are represented by value of the following
    type.  */
 typedef set_el_t *reserv_sets_t;
+typedef const set_el_t *const_reserv_sets_t;
 
 /* The following structure describes a ticker.  */
 struct ticker
@@ -182,17 +183,21 @@ struct state_ainsn_table;
 
 /* The following typedefs are for brevity.  */
 typedef struct unit_decl *unit_decl_t;
+typedef const struct unit_decl *const_unit_decl_t;
 typedef struct decl *decl_t;
+typedef const struct decl *const_decl_t;
 typedef struct regexp *regexp_t;
 typedef struct unit_set_el *unit_set_el_t;
 typedef struct pattern_set_el *pattern_set_el_t;
 typedef struct pattern_reserv *pattern_reserv_t;
 typedef struct alt_state *alt_state_t;
 typedef struct state *state_t;
+typedef const struct state *const_state_t;
 typedef struct arc *arc_t;
 typedef struct ainsn *ainsn_t;
 typedef struct automaton *automaton_t;
 typedef struct automata_list_el *automata_list_el_t;
+typedef const struct automata_list_el *const_automata_list_el_t;
 typedef struct state_ainsn_table *state_ainsn_table_t;
 
 /* Undefined position.  */
@@ -228,7 +233,7 @@ static int check_presence_pattern_sets (reserv_sets_t,
                                        reserv_sets_t, int);
 static int check_absence_pattern_sets  (reserv_sets_t, reserv_sets_t,
                                        int);
-static arc_t first_out_arc             (state_t);
+static arc_t first_out_arc             (const_state_t);
 static arc_t next_out_arc              (arc_t);
 
 \f
@@ -873,56 +878,56 @@ struct state_ainsn_table
 #if defined ENABLE_CHECKING && (GCC_VERSION >= 2007)
 
 #define DECL_UNIT(d) __extension__                                     \
-(({ struct decl *const _decl = (d);                                    \
+(({ __typeof (d) const _decl = (d);                                    \
      if (_decl->mode != dm_unit)                                       \
        decl_mode_check_failed (_decl->mode, "dm_unit",                 \
                               __FILE__, __LINE__, __FUNCTION__);       \
      &(_decl)->decl.unit; }))
 
 #define DECL_BYPASS(d) __extension__                                   \
-(({ struct decl *const _decl = (d);                                    \
+(({ __typeof (d) const _decl = (d);                                    \
      if (_decl->mode != dm_bypass)                                     \
        decl_mode_check_failed (_decl->mode, "dm_bypass",               \
                               __FILE__, __LINE__, __FUNCTION__);       \
      &(_decl)->decl.bypass; }))
 
 #define DECL_AUTOMATON(d) __extension__                                        \
-(({ struct decl *const _decl = (d);                                    \
+(({ __typeof (d) const _decl = (d);                                    \
      if (_decl->mode != dm_automaton)                                  \
        decl_mode_check_failed (_decl->mode, "dm_automaton",            \
                               __FILE__, __LINE__, __FUNCTION__);       \
      &(_decl)->decl.automaton; }))
 
 #define DECL_EXCL(d) __extension__                                     \
-(({ struct decl *const _decl = (d);                                    \
+(({ __typeof (d) const _decl = (d);                                    \
      if (_decl->mode != dm_excl)                                       \
        decl_mode_check_failed (_decl->mode, "dm_excl",                 \
                               __FILE__, __LINE__, __FUNCTION__);       \
      &(_decl)->decl.excl; }))
 
 #define DECL_PRESENCE(d) __extension__                                 \
-(({ struct decl *const _decl = (d);                                    \
+(({ __typeof (d) const _decl = (d);                                    \
      if (_decl->mode != dm_presence)                                   \
        decl_mode_check_failed (_decl->mode, "dm_presence",             \
                               __FILE__, __LINE__, __FUNCTION__);       \
      &(_decl)->decl.presence; }))
 
 #define DECL_ABSENCE(d) __extension__                                  \
-(({ struct decl *const _decl = (d);                                    \
+(({ __typeof (d) const _decl = (d);                                    \
      if (_decl->mode != dm_absence)                                    \
        decl_mode_check_failed (_decl->mode, "dm_absence",              \
                               __FILE__, __LINE__, __FUNCTION__);       \
      &(_decl)->decl.absence; }))
 
 #define DECL_RESERV(d) __extension__                                   \
-(({ struct decl *const _decl = (d);                                    \
+(({ __typeof (d) const _decl = (d);                                    \
      if (_decl->mode != dm_reserv)                                     \
        decl_mode_check_failed (_decl->mode, "dm_reserv",               \
                               __FILE__, __LINE__, __FUNCTION__);       \
      &(_decl)->decl.reserv; }))
 
 #define DECL_INSN_RESERV(d) __extension__                              \
-(({ struct decl *const _decl = (d);                                    \
+(({ __typeof (d) const _decl = (d);                                    \
      if (_decl->mode != dm_insn_reserv)                                        \
        decl_mode_check_failed (_decl->mode, "dm_insn_reserv",          \
                               __FILE__, __LINE__, __FUNCTION__);       \
@@ -1737,7 +1742,7 @@ string_hash (const char *string)
 static hashval_t
 automaton_decl_hash (const void *automaton_decl)
 {
-  const decl_t decl = (decl_t) automaton_decl;
+  const_decl_t const decl = (const_decl_t) automaton_decl;
 
   gcc_assert (decl->mode != dm_automaton
              || DECL_AUTOMATON (decl)->name);
@@ -1752,8 +1757,8 @@ static int
 automaton_decl_eq_p (const void* automaton_decl_1,
                     const void* automaton_decl_2)
 {
-  const decl_t decl1 = (decl_t) automaton_decl_1;
-  const decl_t decl2 = (decl_t) automaton_decl_2;
+  const_decl_t const decl1 = (const_decl_t) automaton_decl_1;
+  const_decl_t const decl2 = (const_decl_t) automaton_decl_2;
 
   gcc_assert (decl1->mode == dm_automaton
              && DECL_AUTOMATON (decl1)->name
@@ -1838,7 +1843,7 @@ finish_automaton_decl_table (void)
 static hashval_t
 insn_decl_hash (const void *insn_decl)
 {
-  const decl_t decl = (decl_t) insn_decl;
+  const_decl_t const decl = (const_decl_t) insn_decl;
 
   gcc_assert (decl->mode == dm_insn_reserv
              && DECL_INSN_RESERV (decl)->name);
@@ -1851,8 +1856,8 @@ insn_decl_hash (const void *insn_decl)
 static int
 insn_decl_eq_p (const void *insn_decl_1, const void *insn_decl_2)
 {
-  const decl_t decl1 = (decl_t) insn_decl_1;
-  const decl_t decl2 = (decl_t) insn_decl_2;
+  const_decl_t const decl1 = (const_decl_t) insn_decl_1;
+  const_decl_t const decl2 = (const_decl_t) insn_decl_2;
 
   gcc_assert (decl1->mode == dm_insn_reserv
              && DECL_INSN_RESERV (decl1)->name
@@ -1936,7 +1941,7 @@ finish_insn_decl_table (void)
 static hashval_t
 decl_hash (const void *decl)
 {
-  const decl_t d = (const decl_t) decl;
+  const_decl_t const d = (const_decl_t) decl;
 
   gcc_assert ((d->mode == dm_unit && DECL_UNIT (d)->name)
              || (d->mode == dm_reserv && DECL_RESERV (d)->name));
@@ -1950,8 +1955,8 @@ decl_hash (const void *decl)
 static int
 decl_eq_p (const void *decl_1, const void *decl_2)
 {
-  const decl_t d1 = (const decl_t) decl_1;
-  const decl_t d2 = (const decl_t) decl_2;
+  const_decl_t const d1 = (const_decl_t) decl_1;
+  const_decl_t const d2 = (const_decl_t) decl_2;
 
   gcc_assert ((d1->mode == dm_unit && DECL_UNIT (d1)->name)
              || (d1->mode == dm_reserv && DECL_RESERV (d1)->name));
@@ -3182,11 +3187,11 @@ free_alt_states (alt_state_t alt_states_list)
 static int
 alt_state_cmp (const void *alt_state_ptr_1, const void *alt_state_ptr_2)
 {
-  if ((*(alt_state_t *) alt_state_ptr_1)->state->unique_num
-      == (*(alt_state_t *) alt_state_ptr_2)->state->unique_num)
+  if ((*(const alt_state_t *) alt_state_ptr_1)->state->unique_num
+      == (*(const alt_state_t *) alt_state_ptr_2)->state->unique_num)
     return 0;
-  else if ((*(alt_state_t *) alt_state_ptr_1)->state->unique_num
-          < (*(alt_state_t *) alt_state_ptr_2)->state->unique_num)
+  else if ((*(const alt_state_t *) alt_state_ptr_1)->state->unique_num
+          < (*(const alt_state_t *) alt_state_ptr_2)->state->unique_num)
     return -1;
   else
     return 1;
@@ -3376,11 +3381,11 @@ reserv_sets_hash_value (reserv_sets_t reservs)
 
 /* Comparison of given reservation sets.  */
 static int
-reserv_sets_cmp (reserv_sets_t reservs_1, reserv_sets_t reservs_2)
+reserv_sets_cmp (const_reserv_sets_t reservs_1, const_reserv_sets_t reservs_2)
 {
   int reservs_num;
-  set_el_t *reserv_ptr_1;
-  set_el_t *reserv_ptr_2;
+  const set_el_t *reserv_ptr_1;
+  const set_el_t *reserv_ptr_2;
 
   gcc_assert (reservs_1 && reservs_2);
   reservs_num = els_in_reservs;
@@ -3402,7 +3407,7 @@ reserv_sets_cmp (reserv_sets_t reservs_1, reserv_sets_t reservs_2)
 
 /* The function checks equality of the reservation sets.  */
 static int
-reserv_sets_eq (reserv_sets_t reservs_1, reserv_sets_t reservs_2)
+reserv_sets_eq (const_reserv_sets_t reservs_1, const_reserv_sets_t reservs_2)
 {
   return reserv_sets_cmp (reservs_1, reservs_2) == 0;
 }
@@ -3654,12 +3659,12 @@ state_hash (const void *state)
   unsigned int hash_value;
   alt_state_t alt_state;
 
-  if (((state_t) state)->component_states == NULL)
-    hash_value = reserv_sets_hash_value (((state_t) state)->reservs);
+  if (((const_state_t) state)->component_states == NULL)
+    hash_value = reserv_sets_hash_value (((const_state_t) state)->reservs);
   else
     {
       hash_value = 0;
-      for (alt_state = ((state_t) state)->component_states;
+      for (alt_state = ((const_state_t) state)->component_states;
            alt_state != NULL;
            alt_state = alt_state->next_sorted_alt_state)
         hash_value = (((hash_value >> (sizeof (unsigned) - 1) * CHAR_BIT)
@@ -3668,7 +3673,7 @@ state_hash (const void *state)
     }
   hash_value = (((hash_value >> (sizeof (unsigned) - 1) * CHAR_BIT)
                  | (hash_value << CHAR_BIT))
-                + ((state_t) state)->automaton->automaton_order_num);
+                + ((const_state_t) state)->automaton->automaton_order_num);
   return hash_value;
 }
 
@@ -3679,17 +3684,17 @@ state_eq_p (const void *state_1, const void *state_2)
   alt_state_t alt_state_1;
   alt_state_t alt_state_2;
 
-  if (((state_t) state_1)->automaton != ((state_t) state_2)->automaton)
+  if (((const_state_t) state_1)->automaton != ((const_state_t) state_2)->automaton)
     return 0;
-  else if (((state_t) state_1)->component_states == NULL
-           && ((state_t) state_2)->component_states == NULL)
-    return reserv_sets_eq (((state_t) state_1)->reservs,
-                          ((state_t) state_2)->reservs);
-  else if (((state_t) state_1)->component_states != NULL
-           && ((state_t) state_2)->component_states != NULL)
-    {
-      for (alt_state_1 = ((state_t) state_1)->component_states,
-           alt_state_2 = ((state_t) state_2)->component_states;
+  else if (((const_state_t) state_1)->component_states == NULL
+           && ((const_state_t) state_2)->component_states == NULL)
+    return reserv_sets_eq (((const_state_t) state_1)->reservs,
+                          ((const_state_t) state_2)->reservs);
+  else if (((const_state_t) state_1)->component_states != NULL
+           && ((const_state_t) state_2)->component_states != NULL)
+    {
+      for (alt_state_1 = ((const_state_t) state_1)->component_states,
+           alt_state_2 = ((const_state_t) state_2)->component_states;
            alt_state_1 != NULL && alt_state_2 != NULL;
            alt_state_1 = alt_state_1->next_sorted_alt_state,
           alt_state_2 = alt_state_2->next_sorted_alt_state)
@@ -3908,7 +3913,7 @@ add_arc (state_t from_state, state_t to_state, ainsn_t ainsn)
 
 /* The function returns the first arc starting from STATE.  */
 static arc_t
-first_out_arc (state_t state)
+first_out_arc (const_state_t state)
 {
   return state->first_out_arc;
 }
@@ -3997,10 +4002,10 @@ static hashval_t
 automata_list_hash (const void *automata_list)
 {
   unsigned int hash_value;
-  automata_list_el_t curr_automata_list_el;
+  const_automata_list_el_t curr_automata_list_el;
 
   hash_value = 0;
-  for (curr_automata_list_el = (automata_list_el_t) automata_list;
+  for (curr_automata_list_el = (const_automata_list_el_t) automata_list;
        curr_automata_list_el != NULL;
        curr_automata_list_el = curr_automata_list_el->next_automata_list_el)
     hash_value = (((hash_value >> (sizeof (unsigned) - 1) * CHAR_BIT)
@@ -4013,11 +4018,11 @@ automata_list_hash (const void *automata_list)
 static int
 automata_list_eq_p (const void *automata_list_1, const void *automata_list_2)
 {
-  automata_list_el_t automata_list_el_1;
-  automata_list_el_t automata_list_el_2;
+  const_automata_list_el_t automata_list_el_1;
+  const_automata_list_el_t automata_list_el_2;
 
-  for (automata_list_el_1 = (automata_list_el_t) automata_list_1,
-        automata_list_el_2 = (automata_list_el_t) automata_list_2;
+  for (automata_list_el_1 = (const_automata_list_el_t) automata_list_1,
+        automata_list_el_2 = (const_automata_list_el_t) automata_list_2;
        automata_list_el_1 != NULL && automata_list_el_2 != NULL;
        automata_list_el_1 = automata_list_el_1->next_automata_list_el,
         automata_list_el_2 = automata_list_el_2->next_automata_list_el)
@@ -5717,8 +5722,8 @@ static int
 compare_states_for_equiv (const void *state_ptr_1,
                          const void *state_ptr_2)
 {
-  state_t s1 = *(state_t *)state_ptr_1;
-  state_t s2 = *(state_t *)state_ptr_2;
+  const_state_t const s1 = *(const_state_t const*)state_ptr_1;
+  const_state_t const s2 = *(const_state_t const*)state_ptr_2;
   unsigned int sz, si;
   if (s1->num_out_arcs < s2->num_out_arcs)
     return -1;
@@ -6313,11 +6318,11 @@ static int
 compare_max_occ_cycle_nums (const void *unit_decl_1,
                            const void *unit_decl_2)
 {
-  if ((DECL_UNIT (*(decl_t *) unit_decl_1)->max_occ_cycle_num)
-      < (DECL_UNIT (*(decl_t *) unit_decl_2)->max_occ_cycle_num))
+  if ((DECL_UNIT (*(const_decl_t const*) unit_decl_1)->max_occ_cycle_num)
+      < (DECL_UNIT (*(const_decl_t const*) unit_decl_2)->max_occ_cycle_num))
     return 1;
-  else if ((DECL_UNIT (*(decl_t *) unit_decl_1)->max_occ_cycle_num)
-          == (DECL_UNIT (*(decl_t *) unit_decl_2)->max_occ_cycle_num))
+  else if ((DECL_UNIT (*(const_decl_t const*) unit_decl_1)->max_occ_cycle_num)
+          == (DECL_UNIT (*(const_decl_t const*) unit_decl_2)->max_occ_cycle_num))
     return 0;
   else
     return -1;
@@ -7226,7 +7231,7 @@ add_vect (state_ainsn_table_t tab, int vect_num, vla_hwint_t vect)
 
 /* Return number of out arcs of STATE.  */
 static int
-out_state_arcs_num (state_t state)
+out_state_arcs_num (const_state_t state)
 {
   int result;
   arc_t arc;
@@ -7246,11 +7251,11 @@ static int
 compare_transition_els_num (const void *state_ptr_1,
                            const void *state_ptr_2)
 {
-  int transition_els_num_1;
-  int transition_els_num_2;
+  const int transition_els_num_1
+    = out_state_arcs_num (*(const_state_t const*) state_ptr_1);
+  const int transition_els_num_2
+    = out_state_arcs_num (*(const_state_t const*) state_ptr_2);
 
-  transition_els_num_1 = out_state_arcs_num (*(state_t *) state_ptr_1);
-  transition_els_num_2 = out_state_arcs_num (*(state_t *) state_ptr_2);
   if (transition_els_num_1 < transition_els_num_2)
     return 1;
   else if (transition_els_num_1 == transition_els_num_2)
@@ -8238,8 +8243,8 @@ output_print_reservation_func (void)
 static int
 units_cmp (const void *unit1, const void *unit2)
 {
-  const unit_decl_t u1 = *(unit_decl_t *) unit1;
-  const unit_decl_t u2 = *(unit_decl_t *) unit2;
+  const_unit_decl_t const u1 = *(const_unit_decl_t const*) unit1;
+  const_unit_decl_t const u2 = *(const_unit_decl_t const*) unit2;
 
   return strcmp (u1->name, u2->name);
 }
@@ -8641,8 +8646,8 @@ output_state_arcs (state_t state)
 static int
 state_reservs_cmp (const void *reservs_ptr_1, const void *reservs_ptr_2)
 {
-  return reserv_sets_cmp (*(reserv_sets_t *) reservs_ptr_1,
-                          *(reserv_sets_t *) reservs_ptr_2);
+  return reserv_sets_cmp (*(const_reserv_sets_t const*) reservs_ptr_1,
+                          *(const_reserv_sets_t const*) reservs_ptr_2);
 }
 
 /* The following function is used for sorting possible cpu unit
index 0a2e6f3c8778c8b3292d688924c68a7c932b31ee..956191e8ec4636c4146f8cab25c3147ade81d671 100644 (file)
@@ -740,8 +740,8 @@ create_modes (void)
 static int
 cmp_modes (const void *a, const void *b)
 {
-  struct mode_data *m = *(struct mode_data **)a;
-  struct mode_data *n = *(struct mode_data **)b;
+  const struct mode_data *const m = *(const struct mode_data *const*)a;
+  const struct mode_data *const n = *(const struct mode_data *const*)b;
 
   if (m->bytesize > n->bytesize)
     return 1;
index 7341e968edca280b17648fc6e1ee9cfa044a2fe8..c1eabb3453fa1bed27e47b37a94eccd4a0df7582 100644 (file)
@@ -305,13 +305,13 @@ gt_pch_note_reorder (void *obj, void *note_ptr_cookie,
 static hashval_t
 saving_htab_hash (const void *p)
 {
-  return POINTER_HASH (((struct ptr_data *)p)->obj);
+  return POINTER_HASH (((const struct ptr_data *)p)->obj);
 }
 
 static int
 saving_htab_eq (const void *p1, const void *p2)
 {
-  return ((struct ptr_data *)p1)->obj == p2;
+  return ((const struct ptr_data *)p1)->obj == p2;
 }
 
 /* Handy state for the traversal functions.  */
index 12ed309538b1395952ae98031c83db4bbbac79dd..47191429e72ed23c341518f5a18ec908d64cc29b 100644 (file)
@@ -1335,8 +1335,8 @@ gimplify_loop_expr (tree *expr_p, tree *pre_p)
 static int
 compare_case_labels (const void *p1, const void *p2)
 {
-  tree case1 = *(tree *)p1;
-  tree case2 = *(tree *)p2;
+  const_tree const case1 = *(const_tree const*)p1;
+  const_tree const case2 = *(const_tree const*)p2;
 
   return tree_int_cst_compare (CASE_LOW (case1), CASE_LOW (case2));
 }
index d9d464d624230a20ccd2c1b6c88448e29e92c693..0a4464dd9ae93def6e048fcb3f5efa4979ecc192 100644 (file)
@@ -140,14 +140,14 @@ static unsigned int look_for_casts (tree lhs ATTRIBUTE_UNUSED, tree);
 static bool is_cast_from_non_pointer (tree, tree, void *);
 
 /* Get the name of TYPE or return the string "<UNNAMED>".  */
-static char*
+static const char*
 get_name_of_type (tree type)
 {
   tree name = TYPE_NAME (type);
   
   if (!name)
     /* Unnamed type, do what you like here.  */
-    return (char*)"<UNNAMED>";
+    return "<UNNAMED>";
   
   /* It will be a TYPE_DECL in the case of a typedef, otherwise, an
      identifier_node */
@@ -157,20 +157,20 @@ get_name_of_type (tree type)
          IDENTIFIER_NODE.  (Some decls, most often labels, may have
          zero as the DECL_NAME).  */
       if (DECL_NAME (name))
-       return (char*)IDENTIFIER_POINTER (DECL_NAME (name));
+       return IDENTIFIER_POINTER (DECL_NAME (name));
       else
        /* Unnamed type, do what you like here.  */
-       return (char*)"<UNNAMED>";
+       return "<UNNAMED>";
     }
   else if (TREE_CODE (name) == IDENTIFIER_NODE)
-    return (char*)IDENTIFIER_POINTER (name);
+    return IDENTIFIER_POINTER (name);
   else 
-    return (char*)"<UNNAMED>";
+    return "<UNNAMED>";
 }
 
 struct type_brand_s 
 {
-  char* name;
+  const char* name;
   int seq;
 };
 
index 4b1c9ec65f6c9daaacc920d5ba11ac79c3169aaf..fab3bab5aa4b6924c745a9572ffb297d65bbaa0f 100644 (file)
@@ -1,3 +1,13 @@
+2007-07-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * class.c (java_treetreehash_hash, java_treetreehash_compare):
+       Constify. 
+       * expr.c (type_assertion_eq): Likewise.
+       * jcf-io.c (compare_path): Likewise.
+       * jcf-parse.c (cmpstringp): Likewise.
+       * verify-impl.c (get_one_type, compute_argument_types,
+       compute_return_type): Likewise. 
+
 2007-07-16  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
 
        PR target/32462
index 90381211ed64316e551d17a15f42e0625c274ff1..97d9ba12941e4bcc7f61243408d11581318ab503 100644 (file)
@@ -3048,15 +3048,17 @@ static int java_treetreehash_compare (const void *, const void *);
 static hashval_t
 java_treetreehash_hash (const void *k_p)
 {
-  struct treetreehash_entry *k = (struct treetreehash_entry *) k_p;
+  const struct treetreehash_entry *const k
+    = (const struct treetreehash_entry *) k_p;
   return JAVA_TREEHASHHASH_H (k->key);
 }
 
 static int
 java_treetreehash_compare (const void * k1_p, const void * k2_p)
 {
-  struct treetreehash_entry * k1 = (struct treetreehash_entry *) k1_p;
-  tree k2 = (tree) k2_p;
+  const struct treetreehash_entry *const k1
+    = (const struct treetreehash_entry *) k1_p;
+  const_tree const k2 = (const_tree) k2_p;
   return (k1->key == k2);
 }
 
index 81bf8bd085c89ac314a739ffe52c3eb440cada2f..db15062da4be25f005a16fcaad7f98e72057c695 100644 (file)
@@ -419,8 +419,8 @@ pop_type (tree type)
 static int
 type_assertion_eq (const void * k1_p, const void * k2_p)
 {
-  type_assertion k1 = *(type_assertion *)k1_p;
-  type_assertion k2 = *(type_assertion *)k2_p;
+  const type_assertion k1 = *(const type_assertion *)k1_p;
+  const type_assertion k2 = *(const type_assertion *)k2_p;
   return (k1.assertion_code == k2.assertion_code
           && k1.op1 == k2.op1
          && k1.op2 == k2.op2);
index 10de9d2ef0f3d986460b7046b17acfa323c263c7..3a5018ac7285a7aff52facb556ef1942c85a6ca7 100644 (file)
@@ -293,7 +293,7 @@ static int
 compare_path (const void *key, const void *entry)
 {
   return strcmp ((const char *) key, 
-                (*((const struct dirent **) entry))->d_name);
+                (*((const struct dirent *const*) entry))->d_name);
 }
 
 /* Returns nonzero if ENTRY names a .java or .class file.  */
index 9411119d0a9f20e30a02dcbd4821d1de39883371..196a7e9913822dde704f2d1d033161e9cc674c20 100644 (file)
@@ -166,7 +166,7 @@ cmpstringp (const void *p1, const void *p2)
      pointers to char", but strcmp() arguments are "pointers
      to char", hence the following cast plus dereference */
 
-  return strcmp(*(char **) p1, *(char **) p2);
+  return strcmp(*(const char *const*) p1, *(const char *const*) p2);
 }
 
 /* Create an array of strings, one for each source file that we've
index 886dfe7d66c257b8224b84a1147f318fc28e197b..1efcf686503e878e6f0307c823bf61f1ec38df33 100644 (file)
@@ -2078,8 +2078,8 @@ check_method_constant (int index, bool is_interface,
                                 method_name, method_signature);
 }
 
-static char *
-get_one_type (char *p, type *t)
+static const char *
+get_one_type (const char *p, type *t)
 {
   const char *start = p;
   vfy_jclass k;
@@ -2131,7 +2131,7 @@ static void
 compute_argument_types (vfy_string signature, type *types)
 {
   int i;
-  char *p = (char *) vfy_string_bytes (signature);
+  const char *p = vfy_string_bytes (signature);
 
   /* Skip `('.  */
   ++p;
@@ -2144,7 +2144,7 @@ compute_argument_types (vfy_string signature, type *types)
 static type
 compute_return_type (vfy_string signature)
 {
-  char *p = (char *) vfy_string_bytes (signature);
+  const char *p = vfy_string_bytes (signature);
   type t;
   while (*p != ')')
     ++p;
index 3e20fcb4b0d4a274f09334666da0916368167bb8..09d938550c9875bd7c179ced9c2f23feff0789d4 100644 (file)
@@ -1484,7 +1484,7 @@ unroll_loop_stupid (struct loop *loop)
 static hashval_t
 si_info_hash (const void *ivts)
 {
-  return (hashval_t) INSN_UID (((struct iv_to_split *) ivts)->insn);
+  return (hashval_t) INSN_UID (((const struct iv_to_split *) ivts)->insn);
 }
 
 /* An equality functions for information about insns to split.  */
@@ -1503,7 +1503,7 @@ si_info_eq (const void *ivts1, const void *ivts2)
 static hashval_t
 ve_info_hash (const void *ves)
 {
-  return (hashval_t) INSN_UID (((struct var_to_expand *) ves)->insn);
+  return (hashval_t) INSN_UID (((const struct var_to_expand *) ves)->insn);
 }
 
 /* Return true if IVTS1 and IVTS2 (which are really both of type 
index 0cff06f1ee261318bfe112e6a9352247537c22d3..174dd71028db4d59d9fc34e23e087dfdd0964ede 100644 (file)
@@ -390,7 +390,7 @@ static htab_t matrices_to_reorg = NULL;
 static hashval_t
 mtt_info_hash (const void *mtt)
 {
-  return htab_hash_pointer (((struct matrix_info *) mtt)->decl);
+  return htab_hash_pointer (((const struct matrix_info *) mtt)->decl);
 }
 
 /* Return true if MTT1 and MTT2 (which are really both of type
index eb2061a69753471d674cc0157a99250577c60360..fdcec9d37ac3fa6e0cbd804a4b3092ec10651220 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * objc-act.c (volatilized_hash, volatilized_eq, string_hash,
+       string_eq): Constify.
+
 2007-04-04  Stuart Hastings  <stuart@apple.com>
 
        PR 31281
index 19475e2f8d8dc74748c0eca823a22001792bdedd..3f0d6deea51c95e81e217697efa7aae620f21aa8 100644 (file)
@@ -1321,7 +1321,7 @@ objc_xref_basetypes (tree ref, tree basetype)
 static hashval_t
 volatilized_hash (const void *ptr)
 {
-  tree typ = ((struct volatilized_type *)ptr)->type;
+  const_tree const typ = ((const struct volatilized_type *)ptr)->type;
 
   return htab_hash_pointer(typ);
 }
@@ -1329,8 +1329,8 @@ volatilized_hash (const void *ptr)
 static int
 volatilized_eq (const void *ptr1, const void *ptr2)
 {
-  tree typ1 = ((struct volatilized_type *)ptr1)->type;
-  tree typ2 = ((struct volatilized_type *)ptr2)->type;
+  const_tree const typ1 = ((const struct volatilized_type *)ptr1)->type;
+  const_tree const typ2 = ((const struct volatilized_type *)ptr2)->type;
 
   return typ1 == typ2;
 }
@@ -1856,7 +1856,7 @@ my_build_string_pointer (int len, const char *str)
 static hashval_t
 string_hash (const void *ptr)
 {
-  tree str = ((struct string_descriptor *)ptr)->literal;
+  const_tree const str = ((const struct string_descriptor *)ptr)->literal;
   const unsigned char *p = (const unsigned char *) TREE_STRING_POINTER (str);
   int i, len = TREE_STRING_LENGTH (str);
   hashval_t h = len;
@@ -1870,8 +1870,8 @@ string_hash (const void *ptr)
 static int
 string_eq (const void *ptr1, const void *ptr2)
 {
-  tree str1 = ((struct string_descriptor *)ptr1)->literal;
-  tree str2 = ((struct string_descriptor *)ptr2)->literal;
+  const_tree const str1 = ((const struct string_descriptor *)ptr1)->literal;
+  const_tree const str2 = ((const struct string_descriptor *)ptr2)->literal;
   int len1 = TREE_STRING_LENGTH (str1);
 
   return (len1 == TREE_STRING_LENGTH (str2)
index fdf5b04fc7864878efff2c62411ee2f31f34db2b..338afc7328a0c04203ea99b70edaf6cc40cfe802 100644 (file)
@@ -297,7 +297,7 @@ hash_expr (rtx x, int *do_not_record_p)
 static hashval_t
 hash_expr_for_htab (const void *expp)
 {
-  struct expr *exp = (struct expr *) expp;
+  const struct expr *const exp = (const struct expr *) expp;
   return exp->hash;
 }
 
@@ -307,8 +307,8 @@ hash_expr_for_htab (const void *expp)
 static int
 expr_equiv_p (const void *exp1p, const void *exp2p)
 {
-  struct expr *exp1 = (struct expr *) exp1p;
-  struct expr *exp2 = (struct expr *) exp2p;
+  const struct expr *const exp1 = (const struct expr *) exp1p;
+  const struct expr *const exp2 = (const struct expr *) exp2p;
   int equiv_p = exp_equiv_p (exp1->expr, exp2->expr, 0, true);
   
   gcc_assert (!equiv_p || exp1->hash == exp2->hash);
index 6e37df7bced7579951ced9947825c527a334ae1d..0b58d8d38968e35937ac2a7893f83ac89f463a23 100644 (file)
@@ -238,6 +238,7 @@ typedef struct hash_bucket_def
   /* List of sequence candidates.  */
   htab_t seq_candidates;
 } *p_hash_bucket;
+typedef const struct hash_bucket_def *const_p_hash_bucket;
 
 /* Contains the last insn of the sequence, and its index value.  */
 typedef struct hash_elem_def
@@ -251,6 +252,7 @@ typedef struct hash_elem_def
   /* The cached length of the insn.  */
   int length;
 } *p_hash_elem;
+typedef const struct hash_elem_def *const_p_hash_elem;
 
 /* The list of same sequence candidates.  */
 static htab_t hash_buckets;
@@ -1205,7 +1207,7 @@ dump_best_pattern_seq (int iter)
 static unsigned int
 htab_hash_bucket (const void *p)
 {
-  p_hash_bucket bucket = (p_hash_bucket) p;
+  const_p_hash_bucket bucket = (const_p_hash_bucket) p;
   return bucket->hash;
 }
 
@@ -1235,7 +1237,7 @@ htab_del_bucket (void *p)
 static unsigned int
 htab_hash_elem (const void *p)
 {
-  p_hash_elem elem = (p_hash_elem) p;
+  const_p_hash_elem elem = (const_p_hash_elem) p;
   return htab_hash_pointer (elem->insn);
 }
 
index 354757000c450cb025d0fb19f7d565a91d478e94..ab2657ed653b143ffc9dac8ede6e4328ef6c54bc 100644 (file)
@@ -751,8 +751,8 @@ store_child_info (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
 static int
 TB_parent_eq (const void *p1, const void *p2)
 {
-  const_tree node = (const_tree)p2;
-  tree parent = (tree) p1;
+  const_tree const node = (const_tree)p2;
+  const_tree const parent = (const_tree) p1;
 
   if (p1 == NULL || p2 == NULL)
     return 0;
index f9d08f38794913513f431349f094da755c7ba807..66fbb90e525ee0ca57c44d9f682451559b38d9a5 100644 (file)
@@ -307,7 +307,7 @@ new_scev_info_str (tree var)
 static hashval_t
 hash_scev_info (const void *elt)
 {
-  return SSA_NAME_VERSION (((struct scev_info_str *) elt)->var);
+  return SSA_NAME_VERSION (((const struct scev_info_str *) elt)->var);
 }
 
 /* Compares database elements E1 and E2.  */
index 46c17ea68b177465106999fcbe1fde6e724d27d7..3829d1e24aaae86a43c818c6f1a07df2a0a70a21 100644 (file)
@@ -309,8 +309,8 @@ mark_non_addressable (tree var)
 static int
 sort_tags_by_id (const void *pa, const void *pb)
 {
-  tree a = *(tree *)pa;
-  tree b = *(tree *)pb;
+  const_tree const a = *(const_tree const *)pa;
+  const_tree const b = *(const_tree const *)pb;
  
   return DECL_UID (a) - DECL_UID (b);
 }
index 1c82c8d0b9185497584b7d9a823538409993522c..d50417f1463c13f8cd7f49e9ea8f1fd558aeda0d 100644 (file)
@@ -48,6 +48,7 @@ typedef struct coalesce_pair
   int second_element;
   int cost;
 } * coalesce_pair_p;
+typedef const struct coalesce_pair *const_coalesce_pair_p;
 
 typedef struct cost_one_pair_d
 {
@@ -174,8 +175,8 @@ pop_best_coalesce (coalesce_list_p cl, int *p1, int *p2)
 static unsigned int 
 coalesce_pair_map_hash (const void *pair)
 {
-  hashval_t a = (hashval_t)(((coalesce_pair_p)pair)->first_element);
-  hashval_t b = (hashval_t)(((coalesce_pair_p)pair)->second_element);
+  hashval_t a = (hashval_t)(((const_coalesce_pair_p)pair)->first_element);
+  hashval_t b = (hashval_t)(((const_coalesce_pair_p)pair)->second_element);
 
   return COALESCE_HASH_FN (a,b);
 }
@@ -187,8 +188,8 @@ coalesce_pair_map_hash (const void *pair)
 static int 
 coalesce_pair_map_eq (const void *pair1, const void *pair2)
 {
-  coalesce_pair_p p1 = (coalesce_pair_p) pair1;
-  coalesce_pair_p p2 = (coalesce_pair_p) pair2;
+  const_coalesce_pair_p const p1 = (const_coalesce_pair_p) pair1;
+  const_coalesce_pair_p const p2 = (const_coalesce_pair_p) pair2;
 
   return (p1->first_element == p2->first_element
          && p1->second_element == p2->second_element);
@@ -314,7 +315,8 @@ add_coalesce (coalesce_list_p cl, int p1, int p2,
 static int 
 compare_pairs (const void *p1, const void *p2)
 {
-  return (*(coalesce_pair_p *)p1)->cost - (*(coalesce_pair_p *)p2)->cost;
+  return (*(const_coalesce_pair_p const*)p1)->cost
+    - (*(const_coalesce_pair_p const*)p2)->cost;
 }
 
 
index b0bfbba882a0dbc65a5d8d28963811f2007cb33e..fc70fb459dfda326e7c2fb7b79aa9eab2c4685db 100644 (file)
@@ -1997,8 +1997,8 @@ lookup_avail_expr (tree stmt, bool insert)
 static hashval_t
 avail_expr_hash (const void *p)
 {
-  tree stmt = ((struct expr_hash_elt *)p)->stmt;
-  tree rhs = ((struct expr_hash_elt *)p)->rhs;
+  tree stmt = ((const struct expr_hash_elt *)p)->stmt;
+  tree rhs = ((const struct expr_hash_elt *)p)->rhs;
   tree vuse;
   ssa_op_iter iter;
   hashval_t val = 0;
@@ -2033,10 +2033,10 @@ real_avail_expr_hash (const void *p)
 static int
 avail_expr_eq (const void *p1, const void *p2)
 {
-  tree stmt1 = ((struct expr_hash_elt *)p1)->stmt;
-  tree rhs1 = ((struct expr_hash_elt *)p1)->rhs;
-  tree stmt2 = ((struct expr_hash_elt *)p2)->stmt;
-  tree rhs2 = ((struct expr_hash_elt *)p2)->rhs;
+  tree stmt1 = ((const struct expr_hash_elt *)p1)->stmt;
+  tree rhs1 = ((const struct expr_hash_elt *)p1)->rhs;
+  tree stmt2 = ((const struct expr_hash_elt *)p2)->stmt;
+  tree rhs2 = ((const struct expr_hash_elt *)p2)->rhs;
 
   /* If they are the same physical expression, return true.  */
   if (rhs1 == rhs2 && stmt1 == stmt2)
@@ -2052,8 +2052,8 @@ avail_expr_eq (const void *p1, const void *p2)
       && operand_equal_p (rhs1, rhs2, OEP_PURE_SAME))
     {
       bool ret = compare_ssa_operands_equal (stmt1, stmt2, SSA_OP_VUSE);
-      gcc_assert (!ret || ((struct expr_hash_elt *)p1)->hash
-                 == ((struct expr_hash_elt *)p2)->hash);
+      gcc_assert (!ret || ((const struct expr_hash_elt *)p1)->hash
+                 == ((const struct expr_hash_elt *)p2)->hash);
       return ret;
     }
 
index 792f6a7627d1d94483f2ea8be27b1eb3257b2038..ffa5453a222d723af632665452f466e9c8d45a19 100644 (file)
@@ -445,13 +445,14 @@ typedef struct expr_pred_trans_d
      speed reasons.  */
   hashval_t hashcode;
 } *expr_pred_trans_t;
+typedef const struct expr_pred_trans_d *const_expr_pred_trans_t;
 
 /* Return the hash value for a phi translation table entry.  */
 
 static hashval_t
 expr_pred_trans_hash (const void *p)
 {
-  const expr_pred_trans_t ve = (expr_pred_trans_t) p;
+  const_expr_pred_trans_t const ve = (const_expr_pred_trans_t) p;
   return ve->hashcode;
 }
 
@@ -461,8 +462,8 @@ expr_pred_trans_hash (const void *p)
 static int
 expr_pred_trans_eq (const void *p1, const void *p2)
 {
-  const expr_pred_trans_t ve1 = (expr_pred_trans_t) p1;
-  const expr_pred_trans_t ve2 = (expr_pred_trans_t) p2;
+  const_expr_pred_trans_t const ve1 = (const_expr_pred_trans_t) p1;
+  const_expr_pred_trans_t const ve2 = (const_expr_pred_trans_t) p2;
   basic_block b1 = ve1->pred;
   basic_block b2 = ve2->pred;
   int i;
index 589058fdc2c2e8038018c952d3edfc0b48265a44..145db955964d13b07a4192765132f093a137d219 100644 (file)
@@ -131,6 +131,7 @@ typedef struct vn_binary_op_s
   hashval_t hashcode;
   tree result;
 } *vn_binary_op_t;
+typedef const struct vn_binary_op_s *const_vn_binary_op_t;
 
 /* Unary operations in the hashtable consist of a single operand, an
    opcode, and a type.  Result is the value number of the operation,
@@ -144,6 +145,7 @@ typedef struct vn_unary_op_s
   hashval_t hashcode;
   tree result;
 } *vn_unary_op_t;
+typedef const struct vn_unary_op_s *const_vn_unary_op_t;
 
 /* Phi nodes in the hashtable consist of their non-VN_TOP phi
    arguments, and the basic block the phi is in. Result is the value
@@ -158,6 +160,7 @@ typedef struct vn_phi_s
   hashval_t hashcode;
   tree result;
 } *vn_phi_t;
+typedef const struct vn_phi_s *const_vn_phi_t;
 
 /* Reference operands only exist in reference operations structures.
    They consist of an opcode, type, and some number of operands.  For
@@ -174,6 +177,7 @@ typedef struct vn_reference_op_struct
   tree op2;
 } vn_reference_op_s;
 typedef vn_reference_op_s *vn_reference_op_t;
+typedef const vn_reference_op_s *const_vn_reference_op_t;
 
 DEF_VEC_O(vn_reference_op_s);
 DEF_VEC_ALLOC_O(vn_reference_op_s, heap);
@@ -193,6 +197,7 @@ typedef struct vn_reference_s
   hashval_t hashcode;
   tree result;
 } *vn_reference_t;
+typedef const struct vn_reference_s *const_vn_reference_t;
 
 /* Valid hashtables storing information we have proven to be
    correct.  */
@@ -281,8 +286,8 @@ VN_INFO_GET (tree name)
 static int
 vn_reference_op_eq (const void *p1, const void *p2)
 {
-  const vn_reference_op_t vro1 = (vn_reference_op_t) p1;
-  const vn_reference_op_t vro2 = (vn_reference_op_t) p2;
+  const_vn_reference_op_t const vro1 = (const_vn_reference_op_t) p1;
+  const_vn_reference_op_t const vro2 = (const_vn_reference_op_t) p2;
   return vro1->opcode == vro2->opcode
     && vro1->type == vro2->type
     && expressions_equal_p (vro1->op0, vro2->op0)
@@ -305,7 +310,7 @@ vn_reference_op_compute_hash (const vn_reference_op_t vro1)
 static hashval_t
 vn_reference_hash (const void *p1)
 {
-  const vn_reference_t vr1 = (vn_reference_t) p1;
+  const_vn_reference_t const vr1 = (const_vn_reference_t) p1;
   return vr1->hashcode;
 }
 
@@ -337,8 +342,8 @@ vn_reference_eq (const void *p1, const void *p2)
   int i;
   vn_reference_op_t vro;
 
-  const vn_reference_t vr1 = (vn_reference_t) p1;
-  const vn_reference_t vr2 = (vn_reference_t) p2;
+  const_vn_reference_t const vr1 = (const_vn_reference_t) p1;
+  const_vn_reference_t const vr2 = (const_vn_reference_t) p2;
 
   if (vr1->vuses == vr2->vuses
       && vr1->operands == vr2->operands)
@@ -694,7 +699,7 @@ vn_reference_insert (tree op, tree result, VEC (tree, gc) *vuses)
 static hashval_t
 vn_unary_op_hash (const void *p1)
 {
-  const vn_unary_op_t vuo1 = (vn_unary_op_t) p1;
+  const_vn_unary_op_t const vuo1 = (const_vn_unary_op_t) p1;
   return vuo1->hashcode;
 }
 
@@ -711,8 +716,8 @@ vn_unary_op_compute_hash (const vn_unary_op_t vuo1)
 static int
 vn_unary_op_eq (const void *p1, const void *p2)
 {
-  const vn_unary_op_t vuo1 = (vn_unary_op_t) p1;
-  const vn_unary_op_t vuo2 = (vn_unary_op_t) p2;
+  const_vn_unary_op_t const vuo1 = (const_vn_unary_op_t) p1;
+  const_vn_unary_op_t const vuo2 = (const_vn_unary_op_t) p2;
   return vuo1->opcode == vuo2->opcode
     && vuo1->type == vuo2->type
     && expressions_equal_p (vuo1->op0, vuo2->op0);
@@ -781,7 +786,7 @@ vn_binary_op_compute_hash (const vn_binary_op_t vbo1)
 static hashval_t
 vn_binary_op_hash (const void *p1)
 {
-  const vn_binary_op_t vbo1 = (vn_binary_op_t) p1;
+  const_vn_binary_op_t const vbo1 = (const_vn_binary_op_t) p1;
   return vbo1->hashcode;
 }
 
@@ -791,8 +796,8 @@ vn_binary_op_hash (const void *p1)
 static int
 vn_binary_op_eq (const void *p1, const void *p2)
 {
-  const vn_binary_op_t vbo1 = (vn_binary_op_t) p1;
-  const vn_binary_op_t vbo2 = (vn_binary_op_t) p2;
+  const_vn_binary_op_t const vbo1 = (const_vn_binary_op_t) p1;
+  const_vn_binary_op_t const vbo2 = (const_vn_binary_op_t) p2;
   return vbo1->opcode == vbo2->opcode
     && vbo1->type == vbo2->type
     && expressions_equal_p (vbo1->op0, vbo2->op0)
@@ -897,7 +902,7 @@ vn_phi_compute_hash (vn_phi_t vp1)
 static hashval_t
 vn_phi_hash (const void *p1)
 {
-  const vn_phi_t vp1 = (vn_phi_t) p1;
+  const_vn_phi_t const vp1 = (const_vn_phi_t) p1;
   return vp1->hashcode;
 }
 
@@ -906,8 +911,8 @@ vn_phi_hash (const void *p1)
 static int
 vn_phi_eq (const void *p1, const void *p2)
 {
-  const vn_phi_t vp1 = (vn_phi_t) p1;
-  const vn_phi_t vp2 = (vn_phi_t) p2;
+  const_vn_phi_t const vp1 = (const_vn_phi_t) p1;
+  const_vn_phi_t const vp2 = (const_vn_phi_t) p2;
 
   if (vp1->block == vp2->block)
     {
index 40a54370008138cb3764249c242b443461881d80..1a3bad74ab47cb90799359bc93d844c75956bf5a 100644 (file)
@@ -223,15 +223,15 @@ create_block_for_threading (basic_block bb, struct redirection_data *rd)
 static hashval_t
 redirection_data_hash (const void *p)
 {
-  edge e = ((struct redirection_data *)p)->outgoing_edge;
+  edge e = ((const struct redirection_data *)p)->outgoing_edge;
   return e->dest->index;
 }
 
 static int
 redirection_data_eq (const void *p1, const void *p2)
 {
-  edge e1 = ((struct redirection_data *)p1)->outgoing_edge;
-  edge e2 = ((struct redirection_data *)p2)->outgoing_edge;
+  edge e1 = ((const struct redirection_data *)p1)->outgoing_edge;
+  edge e2 = ((const struct redirection_data *)p2)->outgoing_edge;
 
   return e1 == e2;
 }
index 2271613c3eb7f4a8dfae01735cc8b3074c51d39d..f502a2e04c9c68f35ed89f1f242d7e4e1d0bb2a6 100644 (file)
@@ -316,15 +316,15 @@ static void uncprop_into_successor_phis (struct dom_walk_data *, basic_block);
 static hashval_t
 equiv_hash (const void *p)
 {
-  tree value = ((struct equiv_hash_elt *)p)->value;
+  tree const value = ((const struct equiv_hash_elt *)p)->value;
   return iterative_hash_expr (value, 0);
 }
 
 static int
 equiv_eq (const void *p1, const void *p2)
 {
-  tree value1 = ((struct equiv_hash_elt *)p1)->value;
-  tree value2 = ((struct equiv_hash_elt *)p2)->value;
+  tree value1 = ((const struct equiv_hash_elt *)p1)->value;
+  tree value2 = ((const struct equiv_hash_elt *)p2)->value;
 
   return operand_equal_p (value1, value2, 0);
 }
index 858745e683a867c4a6eabab339126e367ac82554..0075cd4b8e0e7c3ba17f22d43affae43fc70d652 100644 (file)
@@ -781,7 +781,7 @@ static int
 var_ann_eq (const void *va, const void *vb)
 {
   const struct static_var_ann_d *a = (const struct static_var_ann_d *) va;
-  tree b = (tree) vb;
+  const_tree const b = (const_tree) vb;
   return (a->uid == DECL_UID (b));
 }
 
index 06931f1f74d8cec0f7a42c9629f6aae97e89198b..9c2272a5f61ce9bc6827f361ea424953505be41d 100644 (file)
@@ -3843,8 +3843,8 @@ find_conditional_asserts (basic_block bb, tree last)
 static int
 compare_case_labels (const void *p1, const void *p2)
 {
-  tree case1 = *(tree *)p1;
-  tree case2 = *(tree *)p2;
+  const_tree const case1 = *(const_tree const*)p1;
+  const_tree const case2 = *(const_tree const*)p2;
   unsigned int uid1 = DECL_UID (CASE_LABEL (case1));
   unsigned int uid2 = DECL_UID (CASE_LABEL (case2));
 
index 8a1b242924ca37e0df5d9e7bb6db591db4896b77..2bd45b7e959a628d7f2cdd2ffcaff0659c074ba3 100644 (file)
@@ -811,7 +811,7 @@ build_int_cst_wide_type (tree type,
 static hashval_t
 int_cst_hash_hash (const void *x)
 {
-  tree t = (tree) x;
+  const_tree const t = (const_tree) x;
 
   return (TREE_INT_CST_HIGH (t) ^ TREE_INT_CST_LOW (t)
          ^ htab_hash_pointer (TREE_TYPE (t)));
@@ -823,8 +823,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 const xt = (const_tree) x;
+  const_tree const yt = (const_tree) y;
 
   return (TREE_TYPE (xt) == TREE_TYPE (yt)
          && TREE_INT_CST_HIGH (xt) == TREE_INT_CST_HIGH (yt)
@@ -4263,7 +4263,7 @@ tree_map_base_hash (const void *item)
 int
 tree_map_base_marked_p (const void *p)
 {
-  return ggc_marked_p (((struct tree_map_base *) p)->from);
+  return ggc_marked_p (((const struct tree_map_base *) p)->from);
 }
 
 unsigned int
@@ -4686,7 +4686,7 @@ type_hash_canon (unsigned int hashcode, tree type)
 static int
 type_hash_marked_p (const void *p)
 {
-  tree type = ((struct type_hash *) p)->type;
+  const_tree const type = ((const struct type_hash *) p)->type;
 
   return ggc_marked_p (type) || TYPE_SYMTAB_POINTER (type);
 }
@@ -6707,11 +6707,11 @@ get_file_function_name (const char *type)
    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;
-  char *buffer;
+  const char *buffer;
   unsigned length = 0;
   int code;
 
@@ -6721,23 +6721,24 @@ tree_check_failed (const tree node, const char *file,
   va_end (args);
   if (length)
     {
+      char *tmp;
       va_start (args, function);
       length += strlen ("expected ");
-      buffer = alloca (length);
+      buffer = tmp = alloca (length);
       length = 0;
       while ((code = va_arg (args, int)))
        {
          const char *prefix = length ? " or " : "expected ";
          
-         strcpy (buffer + length, prefix);
+         strcpy (tmp + length, prefix);
          length += strlen (prefix);
-         strcpy (buffer + length, tree_code_name[code]);
+         strcpy (tmp + length, tree_code_name[code]);
          length += strlen (tree_code_name[code]);
        }
       va_end (args);
     }
   else
-    buffer = (char *)"unexpected node";
+    buffer = "unexpected node";
 
   internal_error ("tree check: %s, have %s in %s, at %s:%d",
                  buffer, tree_code_name[TREE_CODE (node)],
@@ -6749,7 +6750,7 @@ tree_check_failed (const tree node, const char *file,
    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;
@@ -6785,7 +6786,7 @@ tree_not_check_failed (const tree node, const char *file,
    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
@@ -6799,7 +6800,7 @@ tree_class_check_failed (const tree node, const enum tree_code_class cl,
    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)
 {
@@ -6834,7 +6835,7 @@ tree_range_check_failed (const tree node, const char *file, int line,
    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
@@ -6848,7 +6849,7 @@ tree_not_class_check_failed (const tree node, const enum tree_code_class cl,
 /* 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",
@@ -6860,7 +6861,7 @@ omp_clause_check_failed (const tree node, const char *file, int line,
 /* 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)
 {
@@ -6905,7 +6906,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)
@@ -6945,7 +6946,7 @@ phi_node_elt_check_failed (int idx, int len, const char *file, int line,
    vector of an expression node EXP.  */
 
 void
-tree_operand_check_failed (int idx, tree exp, const char *file,
+tree_operand_check_failed (int idx, const_tree exp, const char *file,
                           int line, const char *function)
 {
   int code = TREE_CODE (exp);
index c2dbfed3f9dbe1149b06e4db7c42fe600c2179fd..393898e0849c55b28cacc3bb8845de835609136a 100644 (file)
@@ -856,22 +856,22 @@ enum tree_node_structure_enum {
       gcc_unreachable ();                                      \
     &__t->common.type; }))
 
-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;
@@ -881,16 +881,16 @@ extern void tree_vec_elt_check_failed (int, int, const char *,
 extern void phi_node_elt_check_failed (int, int, const char *,
                                       int, const char *)
     ATTRIBUTE_NORETURN;
-extern void tree_operand_check_failed (int, tree,
+extern void tree_operand_check_failed (int, const_tree,
                                       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, 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;
@@ -4929,7 +4929,7 @@ void init_inline_once (void);
    tcc_vl_exp nodes like CALL_EXPRs, this is stored in the node itself,
    otherwise it is looked up from the node's code.  */
 static inline int
-tree_operand_length (tree node)
+tree_operand_length (const_tree node)
 {
   if (VL_EXP_CLASS_P (node))
     return VL_EXP_OPERAND_LENGTH (node);
index bdc173ef5a3416d8a04652595453b0c73c2eead2..53671f5523953083a6ea031241338ab7eb0afd45 100644 (file)
@@ -258,6 +258,7 @@ typedef struct variable_def
   /* The variable parts.  */
   variable_part var_part[MAX_VAR_PARTS];
 } *variable;
+typedef const struct variable_def *const_variable;
 
 /* Hash function for DECL for VARIABLE_HTAB.  */
 #define VARIABLE_HASH_VAL(decl) (DECL_UID (decl))
@@ -601,7 +602,7 @@ adjust_stack_reference (rtx mem, HOST_WIDE_INT adjustment)
 static hashval_t
 variable_htab_hash (const void *x)
 {
-  const variable v = (const variable) x;
+  const_variable const v = (const_variable) x;
 
   return (VARIABLE_HASH_VAL (v->decl));
 }
@@ -611,8 +612,8 @@ variable_htab_hash (const void *x)
 static int
 variable_htab_eq (const void *x, const void *y)
 {
-  const variable v = (const variable) x;
-  const tree decl = (const tree) y;
+  const_variable const v = (const_variable) x;
+  const_tree const decl = (const_tree) y;
 
   return (VARIABLE_HASH_VAL (v->decl) == VARIABLE_HASH_VAL (decl));
 }
index f367561dc12050015b7c373fe29aa7b8ef6b9bd0..a897687cbedbd9d9a61e93d5789d5bbe5bfd84e4 100644 (file)
@@ -2734,7 +2734,7 @@ static void maybe_output_constant_def_contents (struct constant_descriptor_tree
 static hashval_t
 const_desc_hash (const void *ptr)
 {
-  return ((struct constant_descriptor_tree *)ptr)->hash;
+  return ((const struct constant_descriptor_tree *)ptr)->hash;
 }
 
 static hashval_t