From 67f5655f98d39da5e593381ebcc35a1af9540ffa Mon Sep 17 00:00:00 2001 From: Gabriel Dos Reis Date: Sun, 29 Jan 2006 09:10:48 +0000 Subject: [PATCH] call.c (alloc_conversion): Use cast when converting from void *. * call.c (alloc_conversion): Use cast when converting from void *. (alloc_conversions): Likewise. (add_candidate): Likewise. (print_z_candidates): Likewise. (add_warning): Likewise. * pt.c (retrieve_local_specialization): Likewise. (process_partial_specialization): Likewise. (mangle_class_name_for_template): Likewise. (tsubst_template_args): Likewise. * typeck2.c (pat_calc_hash): Likewise. (pat_compare): Likewise. (abstract_virtuals_error): Likewise. * class.c (method_name_cmp): Likewise. (resort_method_name_cmp): Likewise. (get_vfield_name): Likewise. * decl2.c (generate_ctor_and_dtor_functions_for_priority): Likewise. * lex.c (init_reswords): Likewise. * rtti.c (create_pseudo_type_info): Likewise. * search.c (dfs_lookup_base): Likewise. (dfs_dcast_hint_pre): Likewise. (dfs_dcast_hint_post): Likewise. * tree.c (hash_tree_cons): Likewise. * repo.c (extract_string): Likewise. (afgets): Likewise. * cp-objcp-common.c (decl_shadowed_for_var_lookup): Likewise. * g++spec.c (lang_specific_driver): Likewise. From-SVN: r110366 --- gcc/cp/ChangeLog | 29 +++++++++++++++++++++++++++++ gcc/cp/call.c | 15 +++++++-------- gcc/cp/class.c | 11 ++++++----- gcc/cp/cp-objcp-common.c | 4 ++-- gcc/cp/decl2.c | 2 +- gcc/cp/g++spec.c | 2 +- gcc/cp/lex.c | 2 +- gcc/cp/pt.c | 16 ++++++++-------- gcc/cp/rtti.c | 2 +- gcc/cp/search.c | 6 +++--- gcc/cp/tree.c | 2 +- gcc/cp/typeck2.c | 8 +++++--- 12 files changed, 65 insertions(+), 34 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b9e22d6b346..05d7756d057 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,32 @@ +2006-01-29 Gabriel Dos Reis + + * call.c (alloc_conversion): Use cast when converting from void *. + (alloc_conversions): Likewise. + (add_candidate): Likewise. + (print_z_candidates): Likewise. + (add_warning): Likewise. + * pt.c (retrieve_local_specialization): Likewise. + (process_partial_specialization): Likewise. + (mangle_class_name_for_template): Likewise. + (tsubst_template_args): Likewise. + * typeck2.c (pat_calc_hash): Likewise. + (pat_compare): Likewise. + (abstract_virtuals_error): Likewise. + * class.c (method_name_cmp): Likewise. + (resort_method_name_cmp): Likewise. + (get_vfield_name): Likewise. + * decl2.c (generate_ctor_and_dtor_functions_for_priority): Likewise. + * lex.c (init_reswords): Likewise. + * rtti.c (create_pseudo_type_info): Likewise. + * search.c (dfs_lookup_base): Likewise. + (dfs_dcast_hint_pre): Likewise. + (dfs_dcast_hint_post): Likewise. + * tree.c (hash_tree_cons): Likewise. + * repo.c (extract_string): Likewise. + (afgets): Likewise. + * cp-objcp-common.c (decl_shadowed_for_var_lookup): Likewise. + * g++spec.c (lang_specific_driver): Likewise. + 2006-01-28 Gabriel Dos Reis * class.c (check_bases): Likewise. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 2fc5c576291..b5998fa13e5 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -468,7 +468,7 @@ static conversion * alloc_conversion (conversion_kind kind) { conversion *c; - c = conversion_obstack_alloc (sizeof (conversion)); + c = (conversion *) conversion_obstack_alloc (sizeof (conversion)); c->kind = kind; return c; } @@ -493,7 +493,7 @@ validate_conversion_obstack (void) static conversion ** alloc_conversions (size_t n) { - return conversion_obstack_alloc (n * sizeof (conversion *)); + return (conversion **) conversion_obstack_alloc (n * sizeof (conversion *)); } static conversion * @@ -1269,8 +1269,8 @@ add_candidate (struct z_candidate **candidates, tree access_path, tree conversion_path, int viable) { - struct z_candidate *cand - = conversion_obstack_alloc (sizeof (struct z_candidate)); + struct z_candidate *cand = (struct z_candidate *) + conversion_obstack_alloc (sizeof (struct z_candidate)); cand->fn = fn; cand->args = args; @@ -2442,7 +2442,7 @@ print_z_candidates (struct z_candidate *candidates) /* Indent successive candidates by the width of the translation of the above string. */ size_t len = gcc_gettext_width (str) + 1; - char *spaces = alloca (len); + char *spaces = (char *) alloca (len); memset (spaces, ' ', len-1); spaces[len - 1] = '\0'; @@ -5931,9 +5931,8 @@ source_type (conversion *t) static void add_warning (struct z_candidate *winner, struct z_candidate *loser) { - candidate_warning *cw; - - cw = conversion_obstack_alloc (sizeof (candidate_warning)); + candidate_warning *cw = (candidate_warning *) + conversion_obstack_alloc (sizeof (candidate_warning)); cw->loser = loser; cw->next = winner->warnings; winner->warnings = cw; diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 275cbced9c9..fd50f1733f6 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1617,8 +1617,8 @@ static struct { static int method_name_cmp (const void* m1_p, const void* m2_p) { - const tree *const m1 = m1_p; - const tree *const m2 = m2_p; + const tree *const m1 = (const tree *) m1_p; + const tree *const m2 = (const tree *) m2_p; if (*m1 == NULL_TREE && *m2 == NULL_TREE) return 0; @@ -1637,8 +1637,8 @@ method_name_cmp (const void* m1_p, const void* m2_p) static int resort_method_name_cmp (const void* m1_p, const void* m2_p) { - const tree *const m1 = m1_p; - const tree *const m2 = m2_p; + const tree *const m1 = (const tree *) m1_p; + const tree *const m2 = (const tree *) m2_p; if (*m1 == NULL_TREE && *m2 == NULL_TREE) return 0; if (*m1 == NULL_TREE) @@ -6194,7 +6194,8 @@ get_vfield_name (tree type) } type = BINFO_TYPE (binfo); - buf = alloca (sizeof (VFIELD_NAME_FORMAT) + TYPE_NAME_LENGTH (type) + 2); + buf = (char *) alloca (sizeof (VFIELD_NAME_FORMAT) + + TYPE_NAME_LENGTH (type) + 2); sprintf (buf, VFIELD_NAME_FORMAT, IDENTIFIER_POINTER (constructor_name (type))); return get_identifier (buf); diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c index 7a4d862336c..8dae00f742a 100644 --- a/gcc/cp/cp-objcp-common.c +++ b/gcc/cp/cp-objcp-common.c @@ -214,8 +214,8 @@ decl_shadowed_for_var_lookup (tree from) struct tree_map *h, in; in.from = from; - h = htab_find_with_hash (shadowed_var_for_decl, &in, - htab_hash_pointer (from)); + h = (struct tree_map *) htab_find_with_hash (shadowed_var_for_decl, &in, + htab_hash_pointer (from)); if (h) return h->to; return NULL_TREE; diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 637ac8c9de7..be9f326b156 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2683,7 +2683,7 @@ generate_ctor_or_dtor_function (bool constructor_p, int priority, static int generate_ctor_and_dtor_functions_for_priority (splay_tree_node n, void * data) { - location_t *locus = data; + location_t *locus = (location_t *) data; int priority = (int) n->key; priority_info pi = (priority_info) n->value; diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c index 43f429f8f8b..7e10bc9996f 100644 --- a/gcc/cp/g++spec.c +++ b/gcc/cp/g++spec.c @@ -113,7 +113,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv, argv = *in_argv; added_libraries = *in_added_libraries; - args = xcalloc (argc, sizeof (int)); + args = XCNEWVEC (int, argc); for (i = 1; i < argc; i++) { diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index a8004326564..b3d8b608f75 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -316,7 +316,7 @@ init_reswords (void) | D_OBJC | (flag_no_gnu_keywords ? D_EXT : 0)); - ridpointers = ggc_calloc ((int) RID_MAX, sizeof (tree)); + ridpointers = GGC_CNEWVEC (tree, (int) RID_MAX); for (i = 0; i < ARRAY_SIZE (reswords); i++) { id = get_identifier (reswords[i].word); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index e02cca47dc0..c8c470e9018 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -899,8 +899,8 @@ retrieve_specialization (tree tmpl, tree args, static tree retrieve_local_specialization (tree tmpl) { - tree spec = htab_find_with_hash (local_specializations, tmpl, - htab_hash_pointer (tmpl)); + tree spec = (tree) htab_find_with_hash (local_specializations, tmpl, + htab_hash_pointer (tmpl)); return spec ? TREE_PURPOSE (spec) : NULL_TREE; } @@ -2635,10 +2635,10 @@ process_partial_specialization (tree decl) or some such would have been OK. */ tpd.level = TMPL_PARMS_DEPTH (current_template_parms); - tpd.parms = alloca (sizeof (int) * ntparms); + tpd.parms = (int *) alloca (sizeof (int) * ntparms); memset (tpd.parms, 0, sizeof (int) * ntparms); - tpd.arg_uses_template_parms = alloca (sizeof (int) * nargs); + tpd.arg_uses_template_parms = (int *) alloca (sizeof (int) * nargs); memset (tpd.arg_uses_template_parms, 0, sizeof (int) * nargs); for (i = 0; i < nargs; ++i) { @@ -2709,11 +2709,11 @@ process_partial_specialization (tree decl) { /* We haven't yet initialized TPD2. Do so now. */ tpd2.arg_uses_template_parms - = alloca (sizeof (int) * nargs); + = (int *) alloca (sizeof (int) * nargs); /* The number of parameters here is the number in the main template, which, as checked in the assertion above, is NARGS. */ - tpd2.parms = alloca (sizeof (int) * nargs); + tpd2.parms = (int *) alloca (sizeof (int) * nargs); tpd2.level = TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (maintmpl)); } @@ -4123,7 +4123,7 @@ mangle_class_name_for_template (const char* name, tree parms, tree arglist) gcc_obstack_init (&scratch_obstack); else obstack_free (&scratch_obstack, scratch_firstobj); - scratch_firstobj = obstack_alloc (&scratch_obstack, 1); + scratch_firstobj = (char *) obstack_alloc (&scratch_obstack, 1); #define ccat(C) obstack_1grow (&scratch_obstack, (C)); #define cat(S) obstack_grow (&scratch_obstack, (S), strlen (S)) @@ -5981,7 +5981,7 @@ tsubst_template_args (tree t, tree args, tsubst_flags_t complain, tree in_decl) { int len = TREE_VEC_LENGTH (t); int need_new = 0, i; - tree *elts = alloca (len * sizeof (tree)); + tree *elts = (tree *) alloca (len * sizeof (tree)); for (i = 0; i < len; i++) { diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 5a1b44b6944..54d82c7165e 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -1124,7 +1124,7 @@ create_pseudo_type_info (int tk, const char *real_name, ...) va_start (ap, real_name); /* Generate the pseudo type name. */ - pseudo_name = alloca (strlen (real_name) + 30); + pseudo_name = (char *) alloca (strlen (real_name) + 30); strcpy (pseudo_name, real_name); strcat (pseudo_name, "_pseudo"); if (tk >= TK_FIXED) diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 90e88d6865e..ec572d0b6df 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -97,7 +97,7 @@ struct lookup_base_data_s static tree dfs_lookup_base (tree binfo, void *data_) { - struct lookup_base_data_s *data = data_; + struct lookup_base_data_s *data = (struct lookup_base_data_s *) data_; if (SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), data->base)) { @@ -306,7 +306,7 @@ struct dcast_data_s static tree dfs_dcast_hint_pre (tree binfo, void *data_) { - struct dcast_data_s *data = data_; + struct dcast_data_s *data = (struct dcast_data_s *) data_; if (BINFO_VIRTUAL_P (binfo)) data->virt_depth++; @@ -334,7 +334,7 @@ dfs_dcast_hint_pre (tree binfo, void *data_) static tree dfs_dcast_hint_post (tree binfo, void *data_) { - struct dcast_data_s *data = data_; + struct dcast_data_s *data = (struct dcast_data_s *) data_; if (BINFO_VIRTUAL_P (binfo)) data->virt_depth--; diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 9d1a6195a79..16e87ec2d63 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -756,7 +756,7 @@ hash_tree_cons (tree purpose, tree value, tree chain) /* If not, create a new node. */ if (!*slot) *slot = tree_cons (purpose, value, chain); - return *slot; + return (tree) *slot; } /* Constructor for hashed lists. */ diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 755535f0371..fe5b3dff78e 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -145,7 +145,8 @@ struct pending_abstract_type GTY((chain_next ("%h.next"))) static hashval_t pat_calc_hash (const void* val) { - const struct pending_abstract_type* pat = val; + const struct pending_abstract_type *pat = + (const struct pending_abstract_type *) val; return (hashval_t) TYPE_UID (pat->type); } @@ -156,7 +157,8 @@ pat_calc_hash (const void* val) static int pat_compare (const void* val1, const void* val2) { - const struct pending_abstract_type* pat1 = val1; + const struct pending_abstract_type *pat1 = + (const struct pending_abstract_type *) val1; tree type2 = (tree)val2; return (pat1->type == type2); @@ -270,7 +272,7 @@ abstract_virtuals_error (tree decl, tree type) ? DECL_SOURCE_LOCATION (decl) : input_location); - pat->next = *slot; + pat->next = (struct pending_abstract_type *) *slot; *slot = pat; return 0;