diff options
author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-25 18:14:57 +0000 |
---|---|---|
committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-25 18:14:57 +0000 |
commit | c1fdef8e8adf6df3aeadfb46aaabba9609f68747 (patch) | |
tree | 91c0ebb0129c4f641a66d0cade0a407bc339ef78 /gcc | |
parent | 6c1ca223e9018b57e04f59b7d55fd477d83d7974 (diff) | |
download | gcc-c1fdef8e8adf6df3aeadfb46aaabba9609f68747.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126920 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 27 | ||||
-rw-r--r-- | gcc/c-lex.c | 10 | ||||
-rw-r--r-- | gcc/c-ppoutput.c | 4 | ||||
-rw-r--r-- | gcc/c-typeck.c | 5 | ||||
-rw-r--r-- | gcc/cfg.c | 12 | ||||
-rw-r--r-- | gcc/cfgloop.c | 4 | ||||
-rw-r--r-- | gcc/ddg.c | 4 | ||||
-rw-r--r-- | gcc/df-scan.c | 8 | ||||
-rw-r--r-- | gcc/dfp.c | 33 | ||||
-rw-r--r-- | gcc/dse.c | 7 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 21 | ||||
-rw-r--r-- | gcc/tree-browser.c | 5 | ||||
-rw-r--r-- | gcc/unwind-dw2-fde.c | 29 | ||||
-rw-r--r-- | gcc/unwind-dw2-fde.h | 4 | ||||
-rw-r--r-- | gcc/unwind-dw2.c | 6 | ||||
-rw-r--r-- | gcc/value-prof.c | 4 | ||||
-rw-r--r-- | gcc/value-prof.h | 1 |
17 files changed, 105 insertions, 79 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 20bcc6988b7..9d176594f15 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/c-lex.c b/gcc/c-lex.c index ff8eee6baec..28b5d98a5bc 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -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); diff --git a/gcc/c-ppoutput.c b/gcc/c-ppoutput.c index 10540b7f125..50c3386edaf 100644 --- a/gcc/c-ppoutput.c +++ b/gcc/c-ppoutput.c @@ -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); } diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 2151f970afc..f4b5560eed3 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -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; } diff --git a/gcc/cfg.c b/gcc/cfg.c index 020be514ac9..2b8fe3c2da6 100644 --- 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; } diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index 6542b3a5ed5..48ba9bd8c6c 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -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; } diff --git a/gcc/ddg.c b/gcc/ddg.c index 31910b3a462..fa70f2fc782 100644 --- 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)); } diff --git a/gcc/df-scan.c b/gcc/df-scan.c index 3b35928ea1a..0f2bf608959 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -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; diff --git a/gcc/dfp.c b/gcc/dfp.c index c15afa91c90..ac8625edb62 100644 --- 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 (); diff --git a/gcc/dse.c b/gcc/dse.c index 1f7588df347..3839f947269 100644 --- 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); } diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 974419ffa75..5b67962e515 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -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) diff --git a/gcc/tree-browser.c b/gcc/tree-browser.c index 51f8200f313..354757000c4 100644 --- a/gcc/tree-browser.c +++ b/gcc/tree-browser.c @@ -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; diff --git a/gcc/unwind-dw2-fde.c b/gcc/unwind-dw2-fde.c index 880ba51bf38..d5dcad71554 100644 --- a/gcc/unwind-dw2-fde.c +++ b/gcc/unwind-dw2-fde.c @@ -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 = ▮ + const fde *const *chain_end = ▮ 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; diff --git a/gcc/unwind-dw2-fde.h b/gcc/unwind-dw2-fde.h index 4f8641bf9e1..06dd9c35944 100644 --- a/gcc/unwind-dw2-fde.h +++ b/gcc/unwind-dw2-fde.h @@ -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 *); diff --git a/gcc/unwind-dw2.c b/gcc/unwind-dw2.c index 8add4175a8e..1bea1b30700 100644 --- a/gcc/unwind-dw2.c +++ b/gcc/unwind-dw2.c @@ -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; diff --git a/gcc/value-prof.c b/gcc/value-prof.c index e015855e8ac..53cb5d1e10b 100644 --- a/gcc/value-prof.c +++ b/gcc/value-prof.c @@ -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. */ diff --git a/gcc/value-prof.h b/gcc/value-prof.h index 4447b14a79c..d1818570e70 100644 --- a/gcc/value-prof.h +++ b/gcc/value-prof.h @@ -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); |