Commit 5f754896 by Kaveh R. Ghazi Committed by Kaveh Ghazi

c-lex.c (c_lex_with_flags, lex_string): Constify.

	* 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
parent d6076cee
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> 2007-07-25 Richard Sandiford <richard@codesourcery.com>
* config/mips/mips.c (machine_function): Add * config/mips/mips.c (machine_function): Add
......
...@@ -460,7 +460,7 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags) ...@@ -460,7 +460,7 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags)
type = lex_string (tok, value, false); type = lex_string (tok, value, false);
break; 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; break;
case CPP_PRAGMA: case CPP_PRAGMA:
...@@ -811,7 +811,7 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string) ...@@ -811,7 +811,7 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string)
? cpp_interpret_string : cpp_interpret_string_notranslate) ? cpp_interpret_string : cpp_interpret_string_notranslate)
(parse_in, strs, concats + 1, &istr, wide)) (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); free ((void *) istr.text);
if (c_lex_string_translate == -1) if (c_lex_string_translate == -1)
...@@ -824,13 +824,13 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string) ...@@ -824,13 +824,13 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string)
gcc_assert (xlated); gcc_assert (xlated);
if (TREE_STRING_LENGTH (value) != (int) istr.len if (TREE_STRING_LENGTH (value) != (int) istr.len
|| 0 != strncmp (TREE_STRING_POINTER (value), (char *) istr.text, || 0 != strncmp (TREE_STRING_POINTER (value),
istr.len)) (const char *) istr.text, istr.len))
{ {
/* Arrange for us to return the untranslated string in /* Arrange for us to return the untranslated string in
*valp, but to set up the C type of the translated *valp, but to set up the C type of the translated
one. */ one. */
*valp = build_string (istr.len, (char *) istr.text); *valp = build_string (istr.len, (const char *) istr.text);
valp = &TREE_CHAIN (*valp); valp = &TREE_CHAIN (*valp);
} }
free ((void *) istr.text); free ((void *) istr.text);
......
...@@ -255,7 +255,7 @@ print_line (source_location src_loc, const char *special_flags) ...@@ -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 /* cpp_quote_string does not nul-terminate, so we have to do it
ourselves. */ ourselves. */
p = cpp_quote_string (to_file_quoted, 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'; *p = '\0';
fprintf (print.outf, "# %u \"%s\"%s", fprintf (print.outf, "# %u \"%s\"%s",
print.src_line == 0 ? 1 : print.src_line, print.src_line == 0 ? 1 : print.src_line,
...@@ -375,7 +375,7 @@ pp_dir_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const char *dir) ...@@ -375,7 +375,7 @@ pp_dir_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const char *dir)
unsigned char *p; unsigned char *p;
/* cpp_quote_string does not nul-terminate, so we have to do it ourselves. */ /* 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'; *p = '\0';
fprintf (print.outf, "# 1 \"%s//\"\n", to_file_quoted); fprintf (print.outf, "# 1 \"%s//\"\n", to_file_quoted);
} }
......
...@@ -1024,9 +1024,10 @@ free_all_tagged_tu_seen_up_to (const struct tagged_tu_seen_cache *tu_til) ...@@ -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; const struct tagged_tu_seen_cache *tu = tagged_tu_seen_base;
while (tu != tu_til) 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; tu = tu1->next;
free (tu1); free ((void *)tu1);
} }
tagged_tu_seen_base = tu_til; tagged_tu_seen_base = tu_til;
} }
......
...@@ -1107,18 +1107,18 @@ struct htab_bb_copy_original_entry ...@@ -1107,18 +1107,18 @@ struct htab_bb_copy_original_entry
static hashval_t static hashval_t
bb_copy_original_hash (const void *p) bb_copy_original_hash (const void *p)
{ {
struct htab_bb_copy_original_entry *data const struct htab_bb_copy_original_entry *data
= ((struct htab_bb_copy_original_entry *)p); = ((const struct htab_bb_copy_original_entry *)p);
return data->index1; return data->index1;
} }
static int static int
bb_copy_original_eq (const void *p, const void *q) bb_copy_original_eq (const void *p, const void *q)
{ {
struct htab_bb_copy_original_entry *data const struct htab_bb_copy_original_entry *data
= ((struct htab_bb_copy_original_entry *)p); = ((const struct htab_bb_copy_original_entry *)p);
struct htab_bb_copy_original_entry *data2 const struct htab_bb_copy_original_entry *data2
= ((struct htab_bb_copy_original_entry *)q); = ((const struct htab_bb_copy_original_entry *)q);
return data->index1 == data2->index1; return data->index1 == data2->index1;
} }
......
...@@ -942,7 +942,7 @@ get_loop_body_in_bfs_order (const struct loop *loop) ...@@ -942,7 +942,7 @@ get_loop_body_in_bfs_order (const struct loop *loop)
static hashval_t static hashval_t
loop_exit_hash (const void *ex) 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); return htab_hash_pointer (exit->e);
} }
...@@ -952,7 +952,7 @@ loop_exit_hash (const void *ex) ...@@ -952,7 +952,7 @@ loop_exit_hash (const void *ex)
static int static int
loop_exit_eq (const void *ex, const void *e) 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; return exit->e == e;
} }
......
...@@ -856,8 +856,8 @@ find_predecessors (sbitmap preds, ddg_ptr g, sbitmap ops) ...@@ -856,8 +856,8 @@ find_predecessors (sbitmap preds, ddg_ptr g, sbitmap ops)
static int static int
compare_sccs (const void *s1, const void *s2) compare_sccs (const void *s1, const void *s2)
{ {
int rec_l1 = (*(ddg_scc_ptr *)s1)->recurrence_length; const int rec_l1 = (*(const ddg_scc_ptr *)s1)->recurrence_length;
int rec_l2 = (*(ddg_scc_ptr *)s2)->recurrence_length; const int rec_l2 = (*(const ddg_scc_ptr *)s2)->recurrence_length;
return ((rec_l2 > rec_l1) - (rec_l2 < rec_l1)); return ((rec_l2 > rec_l1) - (rec_l2 < rec_l1));
} }
......
...@@ -2148,8 +2148,8 @@ df_ref_equal_p (struct df_ref *ref1, struct df_ref *ref2) ...@@ -2148,8 +2148,8 @@ df_ref_equal_p (struct df_ref *ref1, struct df_ref *ref2)
static int static int
df_ref_compare (const void *r1, const void *r2) df_ref_compare (const void *r1, const void *r2)
{ {
const struct df_ref *ref1 = *(struct df_ref **)r1; const struct df_ref *const ref1 = *(const struct df_ref *const*)r1;
const struct df_ref *ref2 = *(struct df_ref **)r2; const struct df_ref *const ref2 = *(const struct df_ref *const*)r2;
if (ref1 == ref2) if (ref1 == ref2)
return 0; return 0;
...@@ -2265,8 +2265,8 @@ df_mw_equal_p (struct df_mw_hardreg *mw1, struct df_mw_hardreg *mw2) ...@@ -2265,8 +2265,8 @@ df_mw_equal_p (struct df_mw_hardreg *mw1, struct df_mw_hardreg *mw2)
static int static int
df_mw_compare (const void *m1, const void *m2) 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 *const mw1 = *(const struct df_mw_hardreg *const*)m1;
const struct df_mw_hardreg *mw2 = *(struct df_mw_hardreg **)m2; const struct df_mw_hardreg *const mw2 = *(const struct df_mw_hardreg *const*)m2;
if (mw1 == mw2) if (mw1 == mw2)
return 0; return 0;
......
...@@ -96,7 +96,7 @@ decimal_real_from_string (REAL_VALUE_TYPE *r, const char *s) ...@@ -96,7 +96,7 @@ decimal_real_from_string (REAL_VALUE_TYPE *r, const char *s)
decContextDefault (&set, DEC_INIT_DECIMAL128); decContextDefault (&set, DEC_INIT_DECIMAL128);
set.traps = 0; set.traps = 0;
decNumberFromString (&dn, (char *) s, &set); decNumberFromString (&dn, s, &set);
/* It would be more efficient to store directly in decNumber format, /* It would be more efficient to store directly in decNumber format,
but that is impractical from current data structure size. but that is impractical from current data structure size.
...@@ -119,17 +119,17 @@ decimal_to_decnumber (const REAL_VALUE_TYPE *r, decNumber *dn) ...@@ -119,17 +119,17 @@ decimal_to_decnumber (const REAL_VALUE_TYPE *r, decNumber *dn)
decNumberZero (dn); decNumberZero (dn);
break; break;
case rvc_inf: case rvc_inf:
decNumberFromString (dn, (char *)"Infinity", &set); decNumberFromString (dn, "Infinity", &set);
break; break;
case rvc_nan: case rvc_nan:
if (r->signalling) if (r->signalling)
decNumberFromString (dn, (char *)"snan", &set); decNumberFromString (dn, "snan", &set);
else else
decNumberFromString (dn, (char *)"nan", &set); decNumberFromString (dn, "nan", &set);
break; break;
case rvc_normal: case rvc_normal:
gcc_assert (r->decimal); gcc_assert (r->decimal);
decimal128ToNumber ((decimal128 *) r->sig, dn); decimal128ToNumber ((const decimal128 *) r->sig, dn);
break; break;
default: default:
gcc_unreachable (); gcc_unreachable ();
...@@ -312,8 +312,7 @@ decimal_to_binary (REAL_VALUE_TYPE *to, const REAL_VALUE_TYPE *from, ...@@ -312,8 +312,7 @@ decimal_to_binary (REAL_VALUE_TYPE *to, const REAL_VALUE_TYPE *from,
enum machine_mode mode) enum machine_mode mode)
{ {
char string[256]; char string[256];
decimal128 *d128; const decimal128 *const d128 = (const decimal128 *) from->sig;
d128 = (decimal128 *) from->sig;
decimal128ToString (d128, string); decimal128ToString (d128, string);
real_from_string3 (to, string, mode); real_from_string3 (to, string, mode);
...@@ -360,8 +359,8 @@ decimal_do_compare (const REAL_VALUE_TYPE *a, const REAL_VALUE_TYPE *b, ...@@ -360,8 +359,8 @@ decimal_do_compare (const REAL_VALUE_TYPE *a, const REAL_VALUE_TYPE *b,
/* Convert into decNumber form for comparison operation. */ /* Convert into decNumber form for comparison operation. */
decContextDefault (&set, DEC_INIT_DECIMAL128); decContextDefault (&set, DEC_INIT_DECIMAL128);
set.traps = 0; set.traps = 0;
decimal128ToNumber ((decimal128 *) a->sig, &dn2); decimal128ToNumber ((const decimal128 *) a->sig, &dn2);
decimal128ToNumber ((decimal128 *) b->sig, &dn3); decimal128ToNumber ((const decimal128 *) b->sig, &dn3);
/* Finally, do the comparison. */ /* Finally, do the comparison. */
decNumberCompare (&dn, &dn2, &dn3, &set); decNumberCompare (&dn, &dn2, &dn3, &set);
...@@ -451,7 +450,7 @@ decimal_real_to_decimal (char *str, const REAL_VALUE_TYPE *r_orig, ...@@ -451,7 +450,7 @@ decimal_real_to_decimal (char *str, const REAL_VALUE_TYPE *r_orig,
size_t digits ATTRIBUTE_UNUSED, size_t digits ATTRIBUTE_UNUSED,
int crop_trailing_zeros 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; /* decimal128ToString requires space for at least 24 characters;
Require two more for suffix. */ Require two more for suffix. */
...@@ -540,7 +539,7 @@ decimal_do_fix_trunc (REAL_VALUE_TYPE *r, const REAL_VALUE_TYPE *a) ...@@ -540,7 +539,7 @@ decimal_do_fix_trunc (REAL_VALUE_TYPE *r, const REAL_VALUE_TYPE *a)
decContextDefault (&set, DEC_INIT_DECIMAL128); decContextDefault (&set, DEC_INIT_DECIMAL128);
set.traps = 0; set.traps = 0;
set.round = DEC_ROUND_DOWN; set.round = DEC_ROUND_DOWN;
decimal128ToNumber ((decimal128 *) a->sig, &dn2); decimal128ToNumber ((const decimal128 *) a->sig, &dn2);
decNumberToIntegralValue (&dn, &dn2, &set); decNumberToIntegralValue (&dn, &dn2, &set);
decimal_from_decnumber (r, &dn, &set); decimal_from_decnumber (r, &dn, &set);
...@@ -559,7 +558,7 @@ decimal_real_to_integer (const REAL_VALUE_TYPE *r) ...@@ -559,7 +558,7 @@ decimal_real_to_integer (const REAL_VALUE_TYPE *r)
decContextDefault (&set, DEC_INIT_DECIMAL128); decContextDefault (&set, DEC_INIT_DECIMAL128);
set.traps = 0; set.traps = 0;
set.round = DEC_ROUND_DOWN; set.round = DEC_ROUND_DOWN;
decimal128ToNumber ((decimal128 *) r->sig, &dn); decimal128ToNumber ((const decimal128 *) r->sig, &dn);
decNumberToIntegralValue (&dn2, &dn, &set); decNumberToIntegralValue (&dn2, &dn, &set);
decNumberZero (&dn3); decNumberZero (&dn3);
...@@ -586,7 +585,7 @@ decimal_real_to_integer2 (HOST_WIDE_INT *plow, HOST_WIDE_INT *phigh, ...@@ -586,7 +585,7 @@ decimal_real_to_integer2 (HOST_WIDE_INT *plow, HOST_WIDE_INT *phigh,
decContextDefault (&set, DEC_INIT_DECIMAL128); decContextDefault (&set, DEC_INIT_DECIMAL128);
set.traps = 0; set.traps = 0;
set.round = DEC_ROUND_DOWN; set.round = DEC_ROUND_DOWN;
decimal128ToNumber ((decimal128 *) r->sig, &dn); decimal128ToNumber ((const decimal128 *) r->sig, &dn);
decNumberToIntegralValue (&dn2, &dn, &set); decNumberToIntegralValue (&dn2, &dn, &set);
decNumberZero (&dn3); decNumberZero (&dn3);
...@@ -689,18 +688,18 @@ decimal_real_arithmetic (REAL_VALUE_TYPE *r, enum tree_code code, ...@@ -689,18 +688,18 @@ decimal_real_arithmetic (REAL_VALUE_TYPE *r, enum tree_code code,
void void
decimal_real_maxval (REAL_VALUE_TYPE *r, int sign, enum machine_mode mode) decimal_real_maxval (REAL_VALUE_TYPE *r, int sign, enum machine_mode mode)
{ {
char *max; const char *max;
switch (mode) switch (mode)
{ {
case SDmode: case SDmode:
max = (char *) "9.999999E96"; max = "9.999999E96";
break; break;
case DDmode: case DDmode:
max = (char *) "9.999999999999999E384"; max = "9.999999999999999E384";
break; break;
case TDmode: case TDmode:
max = (char *) "9.999999999999999999999999999999999E6144"; max = "9.999999999999999999999999999999999E6144";
break; break;
default: default:
gcc_unreachable (); gcc_unreachable ();
......
...@@ -441,6 +441,7 @@ struct group_info ...@@ -441,6 +441,7 @@ struct group_info
int offset_map_size_n, offset_map_size_p; int offset_map_size_n, offset_map_size_p;
}; };
typedef struct group_info *group_info_t; typedef struct group_info *group_info_t;
typedef const struct group_info *const_group_info_t;
static alloc_pool rtx_group_info_pool; static alloc_pool rtx_group_info_pool;
/* Tables of group_info structures, hashed by base value. */ /* Tables of group_info structures, hashed by base value. */
...@@ -575,8 +576,8 @@ clear_alias_set_lookup (HOST_WIDE_INT alias_set) ...@@ -575,8 +576,8 @@ clear_alias_set_lookup (HOST_WIDE_INT alias_set)
static int static int
invariant_group_base_eq (const void *p1, const void *p2) invariant_group_base_eq (const void *p1, const void *p2)
{ {
const group_info_t gi1 = (const group_info_t) p1; const_group_info_t gi1 = (const_group_info_t) p1;
const group_info_t gi2 = (const group_info_t) p2; const_group_info_t gi2 = (const_group_info_t) p2;
return rtx_equal_p (gi1->rtx_base, gi2->rtx_base); return rtx_equal_p (gi1->rtx_base, gi2->rtx_base);
} }
...@@ -584,7 +585,7 @@ invariant_group_base_eq (const void *p1, const void *p2) ...@@ -584,7 +585,7 @@ invariant_group_base_eq (const void *p1, const void *p2)
static hashval_t static hashval_t
invariant_group_base_hash (const void *p) 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; int do_not_record;
return hash_rtx (gi->rtx_base, Pmode, &do_not_record, NULL, false); return hash_rtx (gi->rtx_base, Pmode, &do_not_record, NULL, false);
} }
......
...@@ -2700,6 +2700,7 @@ struct dwarf_file_data GTY(()) ...@@ -2700,6 +2700,7 @@ struct dwarf_file_data GTY(())
typedef struct dw_val_struct *dw_val_ref; typedef struct dw_val_struct *dw_val_ref;
typedef struct die_struct *dw_die_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_descr_struct *dw_loc_descr_ref;
typedef struct dw_loc_list_struct *dw_loc_list_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) ...@@ -5685,7 +5686,7 @@ equate_type_number_to_die (tree type, dw_die_ref type_die)
static hashval_t static hashval_t
decl_die_table_hash (const void *x) 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. */ /* 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) ...@@ -5693,7 +5694,7 @@ decl_die_table_hash (const void *x)
static int static int
decl_die_table_eq (const void *x, const void *y) 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. */ /* Return the DIE associated with a given declaration. */
...@@ -7778,8 +7779,8 @@ file_info_cmp (const void *p1, const void *p2) ...@@ -7778,8 +7779,8 @@ file_info_cmp (const void *p1, const void *p2)
{ {
const struct file_info *s1 = p1; const struct file_info *s1 = p1;
const struct file_info *s2 = p2; const struct file_info *s2 = p2;
unsigned char *cp1; const unsigned char *cp1;
unsigned char *cp2; const unsigned char *cp2;
/* Take care of file names without directories. We need to make sure that /* 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 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) ...@@ -7789,18 +7790,18 @@ file_info_cmp (const void *p1, const void *p2)
if ((s1->path == s1->fname || s2->path == s2->fname)) if ((s1->path == s1->fname || s2->path == s2->fname))
return (s2->path == s2->fname) - (s1->path == s1->fname); return (s2->path == s2->fname) - (s1->path == s1->fname);
cp1 = (unsigned char *) s1->path; cp1 = (const unsigned char *) s1->path;
cp2 = (unsigned char *) s2->path; cp2 = (const unsigned char *) s2->path;
while (1) while (1)
{ {
++cp1; ++cp1;
++cp2; ++cp2;
/* Reached the end of the first path? If so, handle like above. */ /* Reached the end of the first path? If so, handle like above. */
if ((cp1 == (unsigned char *) s1->fname) if ((cp1 == (const unsigned char *) s1->fname)
|| (cp2 == (unsigned char *) s2->fname)) || (cp2 == (const unsigned char *) s2->fname))
return ((cp2 == (unsigned char *) s2->fname) return ((cp2 == (const unsigned char *) s2->fname)
- (cp1 == (unsigned char *) s1->fname)); - (cp1 == (const unsigned char *) s1->fname));
/* Character of current path component the same? */ /* Character of current path component the same? */
else if (*cp1 != *cp2) else if (*cp1 != *cp2)
......
...@@ -751,9 +751,8 @@ store_child_info (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, ...@@ -751,9 +751,8 @@ store_child_info (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
static int static int
TB_parent_eq (const void *p1, const void *p2) TB_parent_eq (const void *p1, const void *p2)
{ {
tree node, parent; const_tree node = (const_tree)p2;
node = (tree) p2; tree parent = (tree) p1;
parent = (tree) p1;
if (p1 == NULL || p2 == NULL) if (p1 == NULL || p2 == NULL)
return 0; return 0;
......
...@@ -79,7 +79,7 @@ __register_frame_info_bases (const void *begin, struct object *ob, ...@@ -79,7 +79,7 @@ __register_frame_info_bases (const void *begin, struct object *ob,
void *tbase, void *dbase) void *tbase, void *dbase)
{ {
/* If .eh_frame is empty, don't register at all. */ /* 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; return;
ob->pc_begin = (void *)-1; ob->pc_begin = (void *)-1;
...@@ -177,7 +177,7 @@ __deregister_frame_info_bases (const void *begin) ...@@ -177,7 +177,7 @@ __deregister_frame_info_bases (const void *begin)
struct object *ob = 0; struct object *ob = 0;
/* If .eh_frame is empty, we haven't registered. */ /* 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; return ob;
init_object_mutex_once (); init_object_mutex_once ();
...@@ -323,8 +323,8 @@ static int ...@@ -323,8 +323,8 @@ static int
fde_unencoded_compare (struct object *ob __attribute__((unused)), fde_unencoded_compare (struct object *ob __attribute__((unused)),
const fde *x, const fde *y) const fde *x, const fde *y)
{ {
_Unwind_Ptr x_ptr = *(_Unwind_Ptr *) x->pc_begin; const _Unwind_Ptr x_ptr = *(const _Unwind_Ptr *) x->pc_begin;
_Unwind_Ptr y_ptr = *(_Unwind_Ptr *) y->pc_begin; const _Unwind_Ptr y_ptr = *(const _Unwind_Ptr *) y->pc_begin;
if (x_ptr > y_ptr) if (x_ptr > y_ptr)
return 1; return 1;
...@@ -434,7 +434,7 @@ fde_split (struct object *ob, fde_compare_t fde_compare, ...@@ -434,7 +434,7 @@ fde_split (struct object *ob, fde_compare_t fde_compare,
{ {
static const fde *marker; static const fde *marker;
size_t count = linear->count; size_t count = linear->count;
const fde **chain_end = &marker; const fde *const *chain_end = &marker;
size_t i, j, k; size_t i, j, k;
/* This should optimize out, but it is wise to make sure this assumption /* 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, ...@@ -444,13 +444,13 @@ fde_split (struct object *ob, fde_compare_t fde_compare,
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
const fde **probe; const fde *const *probe;
for (probe = chain_end; for (probe = chain_end;
probe != &marker && fde_compare (ob, linear->array[i], *probe) < 0; probe != &marker && fde_compare (ob, linear->array[i], *probe) < 0;
probe = chain_end) 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[probe - linear->array] = NULL;
} }
erratic->array[i] = (const fde *) chain_end; erratic->array[i] = (const fde *) chain_end;
...@@ -679,7 +679,7 @@ add_fdes (struct object *ob, struct fde_accumulator *accu, const fde *this_fde) ...@@ -679,7 +679,7 @@ add_fdes (struct object *ob, struct fde_accumulator *accu, const fde *this_fde)
if (encoding == DW_EH_PE_absptr) if (encoding == DW_EH_PE_absptr)
{ {
if (*(_Unwind_Ptr *) this_fde->pc_begin == 0) if (*(const _Unwind_Ptr *) this_fde->pc_begin == 0)
continue; continue;
} }
else else
...@@ -797,8 +797,8 @@ linear_search_fdes (struct object *ob, const fde *this_fde, void *pc) ...@@ -797,8 +797,8 @@ linear_search_fdes (struct object *ob, const fde *this_fde, void *pc)
if (encoding == DW_EH_PE_absptr) if (encoding == DW_EH_PE_absptr)
{ {
pc_begin = ((_Unwind_Ptr *) this_fde->pc_begin)[0]; pc_begin = ((const _Unwind_Ptr *) this_fde->pc_begin)[0];
pc_range = ((_Unwind_Ptr *) this_fde->pc_begin)[1]; pc_range = ((const _Unwind_Ptr *) this_fde->pc_begin)[1];
if (pc_begin == 0) if (pc_begin == 0)
continue; continue;
} }
...@@ -844,12 +844,9 @@ binary_search_unencoded_fdes (struct object *ob, void *pc) ...@@ -844,12 +844,9 @@ binary_search_unencoded_fdes (struct object *ob, void *pc)
for (lo = 0, hi = vec->count; lo < hi; ) for (lo = 0, hi = vec->count; lo < hi; )
{ {
size_t i = (lo + hi) / 2; size_t i = (lo + hi) / 2;
const fde *f = vec->array[i]; const fde *const f = vec->array[i];
void *pc_begin; const void *pc_begin = ((const void *const*) f->pc_begin)[0];
uaddr pc_range; const uaddr pc_range = ((const uaddr *) f->pc_begin)[1];
pc_begin = ((void **) f->pc_begin)[0];
pc_range = ((uaddr *) f->pc_begin)[1];
if (pc < pc_begin) if (pc < pc_begin)
hi = i; hi = i;
......
...@@ -160,13 +160,13 @@ typedef struct dwarf_fde fde; ...@@ -160,13 +160,13 @@ typedef struct dwarf_fde fde;
static inline const struct dwarf_cie * static inline const struct dwarf_cie *
get_cie (const struct dwarf_fde *f) 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 * static inline const fde *
next_fde (const fde *f) 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 *); extern const fde * _Unwind_Find_FDE (void *, struct dwarf_eh_bases *);
......
...@@ -1141,11 +1141,11 @@ uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs) ...@@ -1141,11 +1141,11 @@ uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
return _URC_FATAL_PHASE1_ERROR; return _URC_FATAL_PHASE1_ERROR;
/* First decode all the insns in the CIE. */ /* 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); execute_cfa_program (insn, end, context, fs);
/* Locate augmentation for the fde. */ /* 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); aug += 2 * size_of_encoded_value (fs->fde_encoding);
insn = NULL; insn = NULL;
if (fs->saw_z) if (fs->saw_z)
...@@ -1165,7 +1165,7 @@ uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs) ...@@ -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. */ /* Then the insns in the FDE up to our target PC. */
if (insn == NULL) if (insn == NULL)
insn = aug; insn = aug;
end = (unsigned char *) next_fde (fde); end = (const unsigned char *) next_fde (fde);
execute_cfa_program (insn, end, context, fs); execute_cfa_program (insn, end, context, fs);
return _URC_NO_REASON; return _URC_NO_REASON;
......
...@@ -107,7 +107,7 @@ gimple_alloc_histogram_value (struct function *fun ATTRIBUTE_UNUSED, ...@@ -107,7 +107,7 @@ gimple_alloc_histogram_value (struct function *fun ATTRIBUTE_UNUSED,
static hashval_t static hashval_t
histogram_hash (const void *x) 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. */ /* 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) ...@@ -115,7 +115,7 @@ histogram_hash (const void *x)
static int static int
histogram_eq (const void *x, const void *y) 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. */ /* Set histogram for STMT. */
......
...@@ -64,6 +64,7 @@ struct histogram_value_t ...@@ -64,6 +64,7 @@ struct histogram_value_t
}; };
typedef struct histogram_value_t *histogram_value; typedef struct histogram_value_t *histogram_value;
typedef const struct histogram_value_t *const_histogram_value;
DEF_VEC_P(histogram_value); DEF_VEC_P(histogram_value);
DEF_VEC_ALLOC_P(histogram_value,heap); DEF_VEC_ALLOC_P(histogram_value,heap);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment