]> gcc.gnu.org Git - gcc.git/commitdiff
c-lex.c (c_lex_with_flags, lex_string): Constify.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Wed, 25 Jul 2007 18:14:57 +0000 (18:14 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Wed, 25 Jul 2007 18:14:57 +0000 (18:14 +0000)
* c-lex.c (c_lex_with_flags, lex_string): Constify.
* c-ppoutput.c (print_line, pp_dir_change): Likewise.
* c-typeck.c (free_all_tagged_tu_seen_up_to): Likewise.
* cfg.c (bb_copy_original_hash, bb_copy_original_eq): Likewise.
* cfgloop.c (loop_exit_hash, loop_exit_eq): Likewise.
* ddg.c (compare_sccs): Likewise.
* df-scan.c (df_ref_compare, df_mw_compare): Likewise.
* dfp.c (decimal_real_from_string, decimal_to_decnumber,
decimal_to_binary, decimal_do_compare, decimal_real_to_decimal,
decimal_do_fix_trunc, decimal_real_to_integer,
decimal_real_to_integer2, decimal_real_maxval): Likewise.
* dse.c (const_group_info_t): New.
(invariant_group_base_eq, invariant_group_base_hash): Constify.
* dwarf2out.c (const_dw_die_ref): New.
(decl_die_table_hash, decl_die_table_eq, file_info_cmp): Constify.
* tree-browser.c (TB_parent_eq): Likewise.
* unwind-dw2-fde.c (__register_frame_info_bases,
__deregister_frame_info_bases, fde_unencoded_compare, fde_split,
add_fdes, linear_search_fdes, binary_search_unencoded_fdes):
Likewise.
* unwind-dw2-fde.h (get_cie, next_fde): Likewise.
* unwind-dw2.c (uw_frame_state_for): Likewise.
* value-prof.c (histogram_hash, histogram_eq): Likewise.
* value-prof.h (const_histogram_value): New.

From-SVN: r126920

17 files changed:
gcc/ChangeLog
gcc/c-lex.c
gcc/c-ppoutput.c
gcc/c-typeck.c
gcc/cfg.c
gcc/cfgloop.c
gcc/ddg.c
gcc/df-scan.c
gcc/dfp.c
gcc/dse.c
gcc/dwarf2out.c
gcc/tree-browser.c
gcc/unwind-dw2-fde.c
gcc/unwind-dw2-fde.h
gcc/unwind-dw2.c
gcc/value-prof.c
gcc/value-prof.h

index 20bcc6988b732ca21109180755310a528704f093..9d176594f1555c7c0dd613c8a9b869d321f68863 100644 (file)
@@ -1,3 +1,30 @@
+2007-07-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * c-lex.c (c_lex_with_flags, lex_string): Constify.
+       * c-ppoutput.c (print_line, pp_dir_change): Likewise.
+       * c-typeck.c (free_all_tagged_tu_seen_up_to): Likewise.
+       * cfg.c (bb_copy_original_hash, bb_copy_original_eq): Likewise.
+       * cfgloop.c (loop_exit_hash, loop_exit_eq): Likewise.
+       * ddg.c (compare_sccs): Likewise.
+       * df-scan.c (df_ref_compare, df_mw_compare): Likewise.
+       * dfp.c (decimal_real_from_string, decimal_to_decnumber,
+       decimal_to_binary, decimal_do_compare, decimal_real_to_decimal,
+       decimal_do_fix_trunc, decimal_real_to_integer,
+       decimal_real_to_integer2, decimal_real_maxval): Likewise.
+       * dse.c (const_group_info_t): New.
+       (invariant_group_base_eq, invariant_group_base_hash): Constify.
+       * dwarf2out.c (const_dw_die_ref): New.
+       (decl_die_table_hash, decl_die_table_eq, file_info_cmp): Constify.
+       * tree-browser.c (TB_parent_eq): Likewise.
+       * unwind-dw2-fde.c (__register_frame_info_bases,
+       __deregister_frame_info_bases, fde_unencoded_compare, fde_split,
+       add_fdes, linear_search_fdes, binary_search_unencoded_fdes):
+       Likewise.
+       * unwind-dw2-fde.h (get_cie, next_fde): Likewise.
+       * unwind-dw2.c (uw_frame_state_for): Likewise.
+       * value-prof.c (histogram_hash, histogram_eq): Likewise.
+       * value-prof.h (const_histogram_value): New.
+
 2007-07-25  Richard Sandiford  <richard@codesourcery.com>
 
        * config/mips/mips.c (machine_function): Add
index ff8eee6baecfe736586bf29757801ba5f4bd1895..28b5d98a5bc90c0bc9d76ec3f6498a85b14cb18d 100644 (file)
@@ -460,7 +460,7 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags)
          type = lex_string (tok, value, false);
          break;
        }
-      *value = build_string (tok->val.str.len, (char *) tok->val.str.text);
+      *value = build_string (tok->val.str.len, (const char *) tok->val.str.text);
       break;
       
     case CPP_PRAGMA:
@@ -811,7 +811,7 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string)
        ? cpp_interpret_string : cpp_interpret_string_notranslate)
       (parse_in, strs, concats + 1, &istr, wide))
     {
-      value = build_string (istr.len, (char *) istr.text);
+      value = build_string (istr.len, (const char *) istr.text);
       free ((void *) istr.text);
 
       if (c_lex_string_translate == -1)
@@ -824,13 +824,13 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string)
          gcc_assert (xlated);
 
          if (TREE_STRING_LENGTH (value) != (int) istr.len
-             || 0 != strncmp (TREE_STRING_POINTER (value), (char *) istr.text,
-                              istr.len))
+             || 0 != strncmp (TREE_STRING_POINTER (value),
+                              (const char *) istr.text, istr.len))
            {
              /* Arrange for us to return the untranslated string in
                 *valp, but to set up the C type of the translated
                 one.  */
-             *valp = build_string (istr.len, (char *) istr.text);
+             *valp = build_string (istr.len, (const char *) istr.text);
              valp = &TREE_CHAIN (*valp);
            }
          free ((void *) istr.text);
index 10540b7f1251faa61672f1ff4579c5d6d67ecf9d..50c3386edaf5d5a62e439682a2190dd1ce213a6c 100644 (file)
@@ -255,7 +255,7 @@ print_line (source_location src_loc, const char *special_flags)
       /* cpp_quote_string does not nul-terminate, so we have to do it
         ourselves.  */
       p = cpp_quote_string (to_file_quoted,
-                           (unsigned char *) map->to_file, to_file_len);
+                           (const unsigned char *) map->to_file, to_file_len);
       *p = '\0';
       fprintf (print.outf, "# %u \"%s\"%s",
               print.src_line == 0 ? 1 : print.src_line,
@@ -375,7 +375,7 @@ pp_dir_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const char *dir)
   unsigned char *p;
 
   /* cpp_quote_string does not nul-terminate, so we have to do it ourselves.  */
-  p = cpp_quote_string (to_file_quoted, (unsigned char *) dir, to_file_len);
+  p = cpp_quote_string (to_file_quoted, (const unsigned char *) dir, to_file_len);
   *p = '\0';
   fprintf (print.outf, "# 1 \"%s//\"\n", to_file_quoted);
 }
index 2151f970afcc50997fa9b4608c18b77f742205b0..f4b5560eed3175b899dd0de9193fae65823269b3 100644 (file)
@@ -1024,9 +1024,10 @@ 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)
     {
-      struct tagged_tu_seen_cache *tu1 = (struct tagged_tu_seen_cache*)tu;
+      const struct tagged_tu_seen_cache *tu1
+       = (const struct tagged_tu_seen_cache*)tu;
       tu = tu1->next;
-      free (tu1);
+      free ((void *)tu1);
     }
   tagged_tu_seen_base = tu_til;
 }
index 020be514ac90e9579d5bd363a8278e030cb604a9..2b8fe3c2da6d98b14cca76a325848385ec7b11f9 100644 (file)
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -1107,18 +1107,18 @@ struct htab_bb_copy_original_entry
 static hashval_t
 bb_copy_original_hash (const void *p)
 {
-  struct htab_bb_copy_original_entry *data
-    = ((struct htab_bb_copy_original_entry *)p);
+  const struct htab_bb_copy_original_entry *data
+    = ((const struct htab_bb_copy_original_entry *)p);
 
   return data->index1;
 }
 static int
 bb_copy_original_eq (const void *p, const void *q)
 {
-  struct htab_bb_copy_original_entry *data
-    = ((struct htab_bb_copy_original_entry *)p);
-  struct htab_bb_copy_original_entry *data2
-    = ((struct htab_bb_copy_original_entry *)q);
+  const struct htab_bb_copy_original_entry *data
+    = ((const struct htab_bb_copy_original_entry *)p);
+  const struct htab_bb_copy_original_entry *data2
+    = ((const struct htab_bb_copy_original_entry *)q);
 
   return data->index1 == data2->index1;
 }
index 6542b3a5ed595f8f675c1a59a3b0ee48ede9783e..48ba9bd8c6ca5c6f33fdecbbd5e5e0a3319707cf 100644 (file)
@@ -942,7 +942,7 @@ get_loop_body_in_bfs_order (const struct loop *loop)
 static hashval_t
 loop_exit_hash (const void *ex)
 {
-  struct loop_exit *exit = (struct loop_exit *) ex;
+  const struct loop_exit *const exit = (const struct loop_exit *) ex;
 
   return htab_hash_pointer (exit->e);
 }
@@ -952,7 +952,7 @@ loop_exit_hash (const void *ex)
 static int
 loop_exit_eq (const void *ex, const void *e)
 {
-  struct loop_exit *exit = (struct loop_exit *) ex;
+  const struct loop_exit *const exit = (const struct loop_exit *) ex;
 
   return exit->e == e;
 }
index 31910b3a46231a338c811aebeebb31bd4835bc4f..fa70f2fc782d8b1f60a0d8fc894f656b872e27e2 100644 (file)
--- a/gcc/ddg.c
+++ b/gcc/ddg.c
@@ -856,8 +856,8 @@ find_predecessors (sbitmap preds, ddg_ptr g, sbitmap ops)
 static int
 compare_sccs (const void *s1, const void *s2)
 {
-  int rec_l1 = (*(ddg_scc_ptr *)s1)->recurrence_length;
-  int rec_l2 = (*(ddg_scc_ptr *)s2)->recurrence_length; 
+  const int rec_l1 = (*(const ddg_scc_ptr *)s1)->recurrence_length;
+  const int rec_l2 = (*(const ddg_scc_ptr *)s2)->recurrence_length; 
   return ((rec_l2 > rec_l1) - (rec_l2 < rec_l1));
          
 }
index 3b35928ea1a2ed6bcf6f4cb8d87251c2fefa26c7..0f2bf6089599ca2323c72675dd29fa375be7ee6a 100644 (file)
@@ -2148,8 +2148,8 @@ df_ref_equal_p (struct df_ref *ref1, struct df_ref *ref2)
 static int
 df_ref_compare (const void *r1, const void *r2)
 {
-  const struct df_ref *ref1 = *(struct df_ref **)r1;
-  const struct df_ref *ref2 = *(struct df_ref **)r2;
+  const struct df_ref *const ref1 = *(const struct df_ref *const*)r1;
+  const struct df_ref *const ref2 = *(const struct df_ref *const*)r2;
 
   if (ref1 == ref2)
     return 0;
@@ -2265,8 +2265,8 @@ df_mw_equal_p (struct df_mw_hardreg *mw1, struct df_mw_hardreg *mw2)
 static int
 df_mw_compare (const void *m1, const void *m2)
 {
-  const struct df_mw_hardreg *mw1 = *(struct df_mw_hardreg **)m1;
-  const struct df_mw_hardreg *mw2 = *(struct df_mw_hardreg **)m2;
+  const struct df_mw_hardreg *const mw1 = *(const struct df_mw_hardreg *const*)m1;
+  const struct df_mw_hardreg *const mw2 = *(const struct df_mw_hardreg *const*)m2;
 
   if (mw1 == mw2)
     return 0;
index c15afa91c90f6d015d8a13aa71391de057c264e6..ac8625edb626c5db17d112b13c0a46899d94c88a 100644 (file)
--- a/gcc/dfp.c
+++ b/gcc/dfp.c
@@ -96,7 +96,7 @@ decimal_real_from_string (REAL_VALUE_TYPE *r, const char *s)
   decContextDefault (&set, DEC_INIT_DECIMAL128);
   set.traps = 0;
 
-  decNumberFromString (&dn, (char *) s, &set);
+  decNumberFromString (&dn, s, &set);
 
   /* It would be more efficient to store directly in decNumber format,
      but that is impractical from current data structure size.
@@ -119,17 +119,17 @@ decimal_to_decnumber (const REAL_VALUE_TYPE *r, decNumber *dn)
       decNumberZero (dn);
       break;
     case rvc_inf:
-      decNumberFromString (dn, (char *)"Infinity", &set);
+      decNumberFromString (dn, "Infinity", &set);
       break;
     case rvc_nan:
       if (r->signalling)
-        decNumberFromString (dn, (char *)"snan", &set);
+        decNumberFromString (dn, "snan", &set);
       else
-        decNumberFromString (dn, (char *)"nan", &set);
+        decNumberFromString (dn, "nan", &set);
       break;
     case rvc_normal:
       gcc_assert (r->decimal);
-      decimal128ToNumber ((decimal128 *) r->sig, dn);
+      decimal128ToNumber ((const decimal128 *) r->sig, dn);
       break;
     default:
       gcc_unreachable ();
@@ -312,8 +312,7 @@ decimal_to_binary (REAL_VALUE_TYPE *to, const REAL_VALUE_TYPE *from,
                   enum machine_mode mode)
 {
   char string[256];
-  decimal128 *d128;
-  d128 = (decimal128 *) from->sig;
+  const decimal128 *const d128 = (const decimal128 *) from->sig;
 
   decimal128ToString (d128, string);
   real_from_string3 (to, string, mode);
@@ -360,8 +359,8 @@ decimal_do_compare (const REAL_VALUE_TYPE *a, const REAL_VALUE_TYPE *b,
   /* Convert into decNumber form for comparison operation.  */
   decContextDefault (&set, DEC_INIT_DECIMAL128);
   set.traps = 0;  
-  decimal128ToNumber ((decimal128 *) a->sig, &dn2);
-  decimal128ToNumber ((decimal128 *) b->sig, &dn3);
+  decimal128ToNumber ((const decimal128 *) a->sig, &dn2);
+  decimal128ToNumber ((const decimal128 *) b->sig, &dn3);
 
   /* Finally, do the comparison.  */
   decNumberCompare (&dn, &dn2, &dn3, &set);
@@ -451,7 +450,7 @@ decimal_real_to_decimal (char *str, const REAL_VALUE_TYPE *r_orig,
                         size_t digits ATTRIBUTE_UNUSED,
                         int crop_trailing_zeros ATTRIBUTE_UNUSED)
 {
-  decimal128 *d128 = (decimal128*) r_orig->sig;
+  const decimal128 *const d128 = (const decimal128*) r_orig->sig;
 
   /* decimal128ToString requires space for at least 24 characters;
      Require two more for suffix.  */
@@ -540,7 +539,7 @@ decimal_do_fix_trunc (REAL_VALUE_TYPE *r, const REAL_VALUE_TYPE *a)
   decContextDefault (&set, DEC_INIT_DECIMAL128);
   set.traps = 0;
   set.round = DEC_ROUND_DOWN;
-  decimal128ToNumber ((decimal128 *) a->sig, &dn2);
+  decimal128ToNumber ((const decimal128 *) a->sig, &dn2);
 
   decNumberToIntegralValue (&dn, &dn2, &set);
   decimal_from_decnumber (r, &dn, &set);
@@ -559,7 +558,7 @@ decimal_real_to_integer (const REAL_VALUE_TYPE *r)
   decContextDefault (&set, DEC_INIT_DECIMAL128);
   set.traps = 0;
   set.round = DEC_ROUND_DOWN;
-  decimal128ToNumber ((decimal128 *) r->sig, &dn);
+  decimal128ToNumber ((const decimal128 *) r->sig, &dn);
 
   decNumberToIntegralValue (&dn2, &dn, &set);
   decNumberZero (&dn3);
@@ -586,7 +585,7 @@ decimal_real_to_integer2 (HOST_WIDE_INT *plow, HOST_WIDE_INT *phigh,
   decContextDefault (&set, DEC_INIT_DECIMAL128);
   set.traps = 0;
   set.round = DEC_ROUND_DOWN;
-  decimal128ToNumber ((decimal128 *) r->sig, &dn);
+  decimal128ToNumber ((const decimal128 *) r->sig, &dn);
 
   decNumberToIntegralValue (&dn2, &dn, &set);
   decNumberZero (&dn3);
@@ -689,18 +688,18 @@ decimal_real_arithmetic (REAL_VALUE_TYPE *r, enum tree_code code,
 void
 decimal_real_maxval (REAL_VALUE_TYPE *r, int sign, enum machine_mode mode)
 { 
-  char *max;
+  const char *max;
 
   switch (mode)
     {
     case SDmode:
-      max = (char *) "9.999999E96";
+      max = "9.999999E96";
       break;
     case DDmode:
-      max = (char *) "9.999999999999999E384";
+      max = "9.999999999999999E384";
       break;
     case TDmode:
-      max = (char *) "9.999999999999999999999999999999999E6144";
+      max = "9.999999999999999999999999999999999E6144";
       break;
     default:
       gcc_unreachable ();
index 1f7588df3476cfc0af5a84b7e549c9f1c26caf21..3839f9472698c8baf42867aaaa16c55d230c2e78 100644 (file)
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -441,6 +441,7 @@ struct group_info
   int offset_map_size_n, offset_map_size_p; 
 };
 typedef struct group_info *group_info_t;
+typedef const struct group_info *const_group_info_t;
 static alloc_pool rtx_group_info_pool;
 
 /* Tables of group_info structures, hashed by base value.  */
@@ -575,8 +576,8 @@ clear_alias_set_lookup (HOST_WIDE_INT alias_set)
 static int
 invariant_group_base_eq (const void *p1, const void *p2)
 {
-  const group_info_t gi1 = (const group_info_t) p1;
-  const group_info_t gi2 = (const group_info_t) p2;
+  const_group_info_t gi1 = (const_group_info_t) p1;
+  const_group_info_t gi2 = (const_group_info_t) p2;
   return rtx_equal_p (gi1->rtx_base, gi2->rtx_base);
 }
 
@@ -584,7 +585,7 @@ invariant_group_base_eq (const void *p1, const void *p2)
 static hashval_t
 invariant_group_base_hash (const void *p)
 {
-  const group_info_t gi = (const group_info_t) p;
+  const_group_info_t gi = (const_group_info_t) p;
   int do_not_record;
   return hash_rtx (gi->rtx_base, Pmode, &do_not_record, NULL, false);
 }
index 974419ffa75ec01be4575ae6a01ea39bd45aa2c3..5b67962e515e3c0eee68b9c93677dfd44b88f94c 100644 (file)
@@ -2700,6 +2700,7 @@ struct dwarf_file_data GTY(())
 
 typedef struct dw_val_struct *dw_val_ref;
 typedef struct die_struct *dw_die_ref;
+typedef const struct die_struct *const_dw_die_ref;
 typedef struct dw_loc_descr_struct *dw_loc_descr_ref;
 typedef struct dw_loc_list_struct *dw_loc_list_ref;
 
@@ -5685,7 +5686,7 @@ equate_type_number_to_die (tree type, dw_die_ref type_die)
 static hashval_t
 decl_die_table_hash (const void *x)
 {
-  return (hashval_t) ((const dw_die_ref) x)->decl_id;
+  return (hashval_t) ((const_dw_die_ref) x)->decl_id;
 }
 
 /* Return nonzero if decl_id of die_struct X is the same as UID of decl *Y.  */
@@ -5693,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.  */
@@ -7778,8 +7779,8 @@ file_info_cmp (const void *p1, const void *p2)
 {
   const struct file_info *s1 = p1;
   const struct file_info *s2 = p2;
-  unsigned char *cp1;
-  unsigned char *cp2;
+  const unsigned char *cp1;
+  const unsigned char *cp2;
 
   /* Take care of file names without directories.  We need to make sure that
      we return consistent values to qsort since some will get confused if
@@ -7789,18 +7790,18 @@ file_info_cmp (const void *p1, const void *p2)
   if ((s1->path == s1->fname || s2->path == s2->fname))
     return (s2->path == s2->fname) - (s1->path == s1->fname);
 
-  cp1 = (unsigned char *) s1->path;
-  cp2 = (unsigned char *) s2->path;
+  cp1 = (const unsigned char *) s1->path;
+  cp2 = (const unsigned char *) s2->path;
 
   while (1)
     {
       ++cp1;
       ++cp2;
       /* Reached the end of the first path?  If so, handle like above.  */
-      if ((cp1 == (unsigned char *) s1->fname)
-         || (cp2 == (unsigned char *) s2->fname))
-       return ((cp2 == (unsigned char *) s2->fname)
-               - (cp1 == (unsigned char *) s1->fname));
+      if ((cp1 == (const unsigned char *) s1->fname)
+         || (cp2 == (const unsigned char *) s2->fname))
+       return ((cp2 == (const unsigned char *) s2->fname)
+               - (cp1 == (const unsigned char *) s1->fname));
 
       /* Character of current path component the same?  */
       else if (*cp1 != *cp2)
index 51f8200f313f07884129292aa41dd899b1cbe158..354757000c450cb025d0fb19f7d565a91d478e94 100644 (file)
@@ -751,9 +751,8 @@ store_child_info (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
 static int
 TB_parent_eq (const void *p1, const void *p2)
 {
-  tree node, parent;
-  node = (tree) p2;
-  parent = (tree) p1;
+  const_tree node = (const_tree)p2;
+  tree parent = (tree) p1;
 
   if (p1 == NULL || p2 == NULL)
     return 0;
index 880ba51bf3819ef91f64f4ef05f4382515be5d1f..d5dcad71554e126bed8f68e40818b453867bac71 100644 (file)
@@ -79,7 +79,7 @@ __register_frame_info_bases (const void *begin, struct object *ob,
                             void *tbase, void *dbase)
 {
   /* If .eh_frame is empty, don't register at all.  */
-  if ((uword *) begin == 0 || *(uword *) begin == 0)
+  if ((const uword *) begin == 0 || *(const uword *) begin == 0)
     return;
 
   ob->pc_begin = (void *)-1;
@@ -177,7 +177,7 @@ __deregister_frame_info_bases (const void *begin)
   struct object *ob = 0;
 
   /* If .eh_frame is empty, we haven't registered.  */
-  if ((uword *) begin == 0 || *(uword *) begin == 0)
+  if ((const uword *) begin == 0 || *(const uword *) begin == 0)
     return ob;
 
   init_object_mutex_once ();
@@ -323,8 +323,8 @@ static int
 fde_unencoded_compare (struct object *ob __attribute__((unused)),
                       const fde *x, const fde *y)
 {
-  _Unwind_Ptr x_ptr = *(_Unwind_Ptr *) x->pc_begin;
-  _Unwind_Ptr y_ptr = *(_Unwind_Ptr *) y->pc_begin;
+  const _Unwind_Ptr x_ptr = *(const _Unwind_Ptr *) x->pc_begin;
+  const _Unwind_Ptr y_ptr = *(const _Unwind_Ptr *) y->pc_begin;
 
   if (x_ptr > y_ptr)
     return 1;
@@ -434,7 +434,7 @@ fde_split (struct object *ob, fde_compare_t fde_compare,
 {
   static const fde *marker;
   size_t count = linear->count;
-  const fde **chain_end = &marker;
+  const fde *const *chain_end = &marker;
   size_t i, j, k;
 
   /* This should optimize out, but it is wise to make sure this assumption
@@ -444,13 +444,13 @@ fde_split (struct object *ob, fde_compare_t fde_compare,
 
   for (i = 0; i < count; i++)
     {
-      const fde **probe;
+      const fde *const *probe;
 
       for (probe = chain_end;
           probe != &marker && fde_compare (ob, linear->array[i], *probe) < 0;
           probe = chain_end)
        {
-         chain_end = (const fde **) erratic->array[probe - linear->array];
+         chain_end = (const fde *const*) erratic->array[probe - linear->array];
          erratic->array[probe - linear->array] = NULL;
        }
       erratic->array[i] = (const fde *) chain_end;
@@ -679,7 +679,7 @@ add_fdes (struct object *ob, struct fde_accumulator *accu, const fde *this_fde)
 
       if (encoding == DW_EH_PE_absptr)
        {
-         if (*(_Unwind_Ptr *) this_fde->pc_begin == 0)
+         if (*(const _Unwind_Ptr *) this_fde->pc_begin == 0)
            continue;
        }
       else
@@ -797,8 +797,8 @@ linear_search_fdes (struct object *ob, const fde *this_fde, void *pc)
 
       if (encoding == DW_EH_PE_absptr)
        {
-         pc_begin = ((_Unwind_Ptr *) this_fde->pc_begin)[0];
-         pc_range = ((_Unwind_Ptr *) this_fde->pc_begin)[1];
+         pc_begin = ((const _Unwind_Ptr *) this_fde->pc_begin)[0];
+         pc_range = ((const _Unwind_Ptr *) this_fde->pc_begin)[1];
          if (pc_begin == 0)
            continue;
        }
@@ -844,12 +844,9 @@ binary_search_unencoded_fdes (struct object *ob, void *pc)
   for (lo = 0, hi = vec->count; lo < hi; )
     {
       size_t i = (lo + hi) / 2;
-      const fde *f = vec->array[i];
-      void *pc_begin;
-      uaddr pc_range;
-
-      pc_begin = ((void **) f->pc_begin)[0];
-      pc_range = ((uaddr *) f->pc_begin)[1];
+      const fde *const f = vec->array[i];
+      const void *pc_begin = ((const void *const*) f->pc_begin)[0];
+      const uaddr pc_range = ((const uaddr *) f->pc_begin)[1];
 
       if (pc < pc_begin)
        hi = i;
index 4f8641bf9e1fa5abeed0fb0b222c1b883e634c85..06dd9c35944f7bdf7c413f36a5600d6ea8b4fa7b 100644 (file)
@@ -160,13 +160,13 @@ typedef struct dwarf_fde fde;
 static inline const struct dwarf_cie *
 get_cie (const struct dwarf_fde *f)
 {
-  return (void *)&f->CIE_delta - f->CIE_delta;
+  return (const void *)&f->CIE_delta - f->CIE_delta;
 }
 
 static inline const fde *
 next_fde (const fde *f)
 {
-  return (const fde *) ((char *) f + f->length + sizeof (f->length));
+  return (const fde *) ((const char *) f + f->length + sizeof (f->length));
 }
 
 extern const fde * _Unwind_Find_FDE (void *, struct dwarf_eh_bases *);
index 8add4175a8ebba9db955ceacfc759622d6d1b25b..1bea1b30700ce86c1ac807aa41565e817e7b7ad7 100644 (file)
@@ -1141,11 +1141,11 @@ uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
     return _URC_FATAL_PHASE1_ERROR;
 
   /* First decode all the insns in the CIE.  */
-  end = (unsigned char *) next_fde ((struct dwarf_fde *) cie);
+  end = (const unsigned char *) next_fde ((const struct dwarf_fde *) cie);
   execute_cfa_program (insn, end, context, fs);
 
   /* Locate augmentation for the fde.  */
-  aug = (unsigned char *) fde + sizeof (*fde);
+  aug = (const unsigned char *) fde + sizeof (*fde);
   aug += 2 * size_of_encoded_value (fs->fde_encoding);
   insn = NULL;
   if (fs->saw_z)
@@ -1165,7 +1165,7 @@ uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
   /* Then the insns in the FDE up to our target PC.  */
   if (insn == NULL)
     insn = aug;
-  end = (unsigned char *) next_fde (fde);
+  end = (const unsigned char *) next_fde (fde);
   execute_cfa_program (insn, end, context, fs);
 
   return _URC_NO_REASON;
index e015855e8ac77aa2d14af76b69c60b22ed7d5d4c..53cb5d1e10b879e3c32de2bfc76c428ecd006cc5 100644 (file)
@@ -107,7 +107,7 @@ gimple_alloc_histogram_value (struct function *fun ATTRIBUTE_UNUSED,
 static hashval_t
 histogram_hash (const void *x)
 {
-  return htab_hash_pointer (((histogram_value)x)->hvalue.stmt);
+  return htab_hash_pointer (((const_histogram_value)x)->hvalue.stmt);
 }
 
 /* Return nonzero if decl_id of die_struct X is the same as UID of decl *Y.  */
@@ -115,7 +115,7 @@ histogram_hash (const void *x)
 static int
 histogram_eq (const void *x, const void *y)
 {
-  return ((histogram_value) x)->hvalue.stmt == (tree)y;
+  return ((const_histogram_value) x)->hvalue.stmt == (const_tree)y;
 }
 
 /* Set histogram for STMT.  */
index 4447b14a79c946b30c35544d3118dbaabb8021c0..d1818570e70ce9d2b31337bc0c505659b1eb81a1 100644 (file)
@@ -64,6 +64,7 @@ struct histogram_value_t
 };
 
 typedef struct histogram_value_t *histogram_value;
+typedef const struct histogram_value_t *const_histogram_value;
 
 DEF_VEC_P(histogram_value);
 DEF_VEC_ALLOC_P(histogram_value,heap);
This page took 0.134323 seconds and 5 git commands to generate.