diff options
44 files changed, 203 insertions, 236 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 99f56e6c69e..8436b95dc61 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2003-07-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * fixinc/fixfixes.c fixinc/fixincl.c fixinc/fixlib.c + fixinc/server.c objc/objc-act.c: Remove unnecessary casts. + 2003-07-19 Ulrich Weigand <uweigand@de.ibm.com> * config/s390/s390.c (legitimize_pic_address): Access local symbols diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4bcad833e2c..ef5694f531b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2003-07-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * call.c class.c decl.c decl2.c g++spec.c lex.c parser.c pt.c rtti.c + semantics.c typeck.c: Remove unnecessary casts. + 2003-07-18 Nathan Sidwell <nathan@codesourcery.com> * cp-tree.h (finish_non_static_data_member): Add object param. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 6f677a5243b..013d60059a0 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -1207,8 +1207,7 @@ add_candidate (struct z_candidate **candidates, tree fn, tree args, tree convs, tree access_path, tree conversion_path, int viable) { - struct z_candidate *cand - = (struct z_candidate *) ggc_alloc_cleared (sizeof (struct z_candidate)); + struct z_candidate *cand = ggc_alloc_cleared (sizeof (struct z_candidate)); cand->fn = fn; cand->args = args; diff --git a/gcc/cp/class.c b/gcc/cp/class.c index ca22d82d7aa..b9f139fc645 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5380,8 +5380,7 @@ init_class_processing (void) current_class_depth = 0; current_class_stack_size = 10; current_class_stack - = (class_stack_node_t) xmalloc (current_class_stack_size - * sizeof (struct class_stack_node)); + = xmalloc (current_class_stack_size * sizeof (struct class_stack_node)); VARRAY_TREE_INIT (local_classes, 8, "local_classes"); ridpointers[(int) RID_PUBLIC] = access_public_node; @@ -5426,9 +5425,9 @@ pushclass (tree type, bool modify) { current_class_stack_size *= 2; current_class_stack - = (class_stack_node_t) xrealloc (current_class_stack, - current_class_stack_size - * sizeof (struct class_stack_node)); + = xrealloc (current_class_stack, + current_class_stack_size + * sizeof (struct class_stack_node)); } /* Insert a new entry on the class stack. */ @@ -6205,8 +6204,7 @@ get_vfield_name (tree type) binfo = BINFO_BASETYPE (binfo, 0); type = BINFO_TYPE (binfo); - buf = (char *) alloca (sizeof (VFIELD_NAME_FORMAT) - + TYPE_NAME_LENGTH (type) + 2); + buf = 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/decl.c b/gcc/cp/decl.c index 62ecbc487b4..eb0902d23ba 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2220,7 +2220,7 @@ maybe_push_to_top_level (int pseudo) int need_pop; timevar_push (TV_NAME_LOOKUP); - s = (struct saved_scope *) ggc_alloc_cleared (sizeof (struct saved_scope)); + s = ggc_alloc_cleared (sizeof (struct saved_scope)); b = scope_chain ? current_binding_level : 0; @@ -4669,8 +4669,7 @@ use_label (tree decl) || named_label_uses->label_decl != decl) { struct named_label_use_list *new_ent; - new_ent = ((struct named_label_use_list *) - ggc_alloc (sizeof (struct named_label_use_list))); + new_ent = ggc_alloc (sizeof (struct named_label_use_list)); new_ent->label_decl = decl; new_ent->names_in_scope = current_binding_level->names; new_ent->binding_level = current_binding_level; @@ -4707,8 +4706,7 @@ lookup_label (tree id) /* Record this label on the list of labels used in this function. We do this before calling make_label_decl so that we get the IDENTIFIER_LABEL_VALUE before the new label is declared. */ - ent = ((struct named_label_list *) - ggc_alloc_cleared (sizeof (struct named_label_list))); + ent = ggc_alloc_cleared (sizeof (struct named_label_list)); ent->old_value = IDENTIFIER_LABEL_VALUE (id); ent->next = named_labels; named_labels = ent; @@ -5003,8 +5001,7 @@ static struct cp_switch *switch_stack; void push_switch (tree switch_stmt) { - struct cp_switch *p - = (struct cp_switch *) xmalloc (sizeof (struct cp_switch)); + struct cp_switch *p = xmalloc (sizeof (struct cp_switch)); p->level = current_binding_level; p->next = switch_stack; p->switch_stmt = switch_stmt; @@ -13772,8 +13769,7 @@ save_function_data (tree decl) 19990908); /* Make a copy. */ - f = ((struct language_function *) - ggc_alloc (sizeof (struct language_function))); + f = ggc_alloc (sizeof (struct language_function)); memcpy (f, cp_function_chain, sizeof (struct language_function)); DECL_SAVED_FUNCTION_DATA (decl) = f; @@ -14442,8 +14438,7 @@ void cxx_push_function_context (struct function * f) { struct language_function *p - = ((struct language_function *) - ggc_alloc_cleared (sizeof (struct language_function))); + = ggc_alloc_cleared (sizeof (struct language_function)); f->language = p; /* It takes an explicit call to expand_body to generate RTL for a diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 9a0185bd75e..f03603dc0e5 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2220,7 +2220,7 @@ get_priority_info (int priority) { /* Create a new priority information structure, and insert it into the map. */ - pi = (priority_info) xmalloc (sizeof (struct priority_info_s)); + pi = xmalloc (sizeof (struct priority_info_s)); pi->initializations_p = 0; pi->destructions_p = 0; splay_tree_insert (priority_info_map, diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c index 26bc383799d..d3407a31604 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 = (int *) xcalloc (argc, sizeof (int)); + args = xcalloc (argc, sizeof (int)); for (i = 1; i < argc; i++) { @@ -168,12 +168,12 @@ lang_specific_driver (int *in_argc, const char *const **in_argv, saw_speclang = 1; } else if (((argv[i][2] == '\0' - && (char *)strchr ("bBVDUoeTuIYmLiA", argv[i][1]) != NULL) + && strchr ("bBVDUoeTuIYmLiA", argv[i][1]) != NULL) || strcmp (argv[i], "-Xlinker") == 0 || strcmp (argv[i], "-Tdata") == 0)) quote = argv[i]; else if ((argv[i][2] == '\0' - && (char *) strchr ("cSEM", argv[i][1]) != NULL) + && strchr ("cSEM", argv[i][1]) != NULL) || strcmp (argv[i], "-MM") == 0 || strcmp (argv[i], "-fsyntax-only") == 0) { @@ -243,7 +243,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv, /* Make sure to have room for the trailing NULL argument. */ num_args = argc + added + need_math + shared_libgcc + (library > 0) + 1; - arglist = (const char **) xmalloc (num_args * sizeof (char *)); + arglist = xmalloc (num_args * sizeof (char *)); i = 0; j = 0; diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 2266f04080e..e3979775426 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -354,7 +354,7 @@ init_reswords (void) int mask = ((flag_no_asm ? D_ASM : 0) | (flag_no_gnu_keywords ? D_EXT : 0)); - ridpointers = (tree *) ggc_calloc ((int) RID_MAX, sizeof (tree)); + ridpointers = ggc_calloc ((int) RID_MAX, sizeof (tree)); for (i = 0; i < ARRAY_SIZE (reswords); i++) { id = get_identifier (reswords[i].word); @@ -643,7 +643,7 @@ handle_pragma_implementation (cpp_reader* dfile ATTRIBUTE_UNUSED ) } if (ifiles == 0) { - ifiles = (struct impl_files*) xmalloc (sizeof (struct impl_files)); + ifiles = xmalloc (sizeof (struct impl_files)); ifiles->filename = main_filename; ifiles->next = impl_file_chain; impl_file_chain = ifiles; @@ -756,7 +756,7 @@ retrofit_lang_decl (tree t) else size = sizeof (struct lang_decl_flags); - ld = (struct lang_decl *) ggc_alloc_cleared (size); + ld = ggc_alloc_cleared (size); ld->decl_flags.can_be_full = CAN_HAVE_FULL_LANG_DECL_P (t) ? 1 : 0; ld->decl_flags.u1sel = TREE_CODE (t) == NAMESPACE_DECL ? 1 : 0; @@ -792,7 +792,7 @@ cxx_dup_lang_specific_decl (tree node) size = sizeof (struct lang_decl_flags); else size = sizeof (struct lang_decl); - ld = (struct lang_decl *) ggc_alloc (size); + ld = ggc_alloc (size); memcpy (ld, DECL_LANG_SPECIFIC (node), size); DECL_LANG_SPECIFIC (node) = ld; @@ -829,7 +829,7 @@ copy_lang_type (tree node) size = sizeof (struct lang_type); else size = sizeof (struct lang_type_ptrmem); - lt = (struct lang_type *) ggc_alloc (size); + lt = ggc_alloc (size); memcpy (lt, TYPE_LANG_SPECIFIC (node), size); TYPE_LANG_SPECIFIC (node) = lt; @@ -862,8 +862,7 @@ cxx_make_type (enum tree_code code) { struct lang_type *pi; - pi = ((struct lang_type *) - ggc_alloc_cleared (sizeof (struct lang_type))); + pi = ggc_alloc_cleared (sizeof (struct lang_type)); TYPE_LANG_SPECIFIC (t) = pi; pi->u.c.h.is_lang_type_class = 1; diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 8af9f46d7f1..df45bb60b57 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -127,7 +127,7 @@ static void cp_token_cache_push_token static cp_token_cache * cp_token_cache_new () { - return (cp_token_cache *) ggc_alloc_cleared (sizeof (cp_token_cache)); + return ggc_alloc_cleared (sizeof (cp_token_cache)); } /* Add *TOKEN to *CACHE. */ @@ -141,7 +141,7 @@ cp_token_cache_push_token (cp_token_cache *cache, /* See if we need to allocate a new token block. */ if (!b || b->num_tokens == CP_TOKEN_BLOCK_NUM_TOKENS) { - b = ((cp_token_block *) ggc_alloc_cleared (sizeof (cp_token_block))); + b = ggc_alloc_cleared (sizeof (cp_token_block)); b->prev = cache->last; if (cache->last) { @@ -305,11 +305,10 @@ cp_lexer_new_main (void) cpp_get_callbacks (parse_in)->valid_pch = NULL; /* Allocate the memory. */ - lexer = (cp_lexer *) ggc_alloc_cleared (sizeof (cp_lexer)); + lexer = ggc_alloc_cleared (sizeof (cp_lexer)); /* Create the circular buffer. */ - lexer->buffer = ((cp_token *) - ggc_calloc (CP_TOKEN_BUFFER_SIZE, sizeof (cp_token))); + lexer->buffer = ggc_calloc (CP_TOKEN_BUFFER_SIZE, sizeof (cp_token)); lexer->buffer_end = lexer->buffer + CP_TOKEN_BUFFER_SIZE; /* There is one token in the buffer. */ @@ -345,13 +344,13 @@ cp_lexer_new_from_tokens (cp_token_cache *tokens) ptrdiff_t num_tokens; /* Allocate the memory. */ - lexer = (cp_lexer *) ggc_alloc_cleared (sizeof (cp_lexer)); + lexer = ggc_alloc_cleared (sizeof (cp_lexer)); /* Create a new buffer, appropriately sized. */ num_tokens = 0; for (block = tokens->first; block != NULL; block = block->next) num_tokens += block->num_tokens; - lexer->buffer = ((cp_token *) ggc_alloc (num_tokens * sizeof (cp_token))); + lexer->buffer = ggc_alloc (num_tokens * sizeof (cp_token)); lexer->buffer_end = lexer->buffer + num_tokens; /* Install the tokens. */ @@ -521,9 +520,8 @@ cp_lexer_maybe_grow_buffer (cp_lexer* lexer) /* Compute the current buffer size. */ buffer_length = lexer->buffer_end - lexer->buffer; /* Allocate a buffer twice as big. */ - new_buffer = ((cp_token *) - ggc_realloc (lexer->buffer, - 2 * buffer_length * sizeof (cp_token))); + new_buffer = ggc_realloc (lexer->buffer, + 2 * buffer_length * sizeof (cp_token)); /* Because the buffer is circular, logically consecutive tokens are not necessarily placed consecutively in memory. @@ -1130,11 +1128,10 @@ cp_parser_context_new (cp_parser_context* next) /* Pull the first entry from the free list. */ context = cp_parser_context_free_list; cp_parser_context_free_list = context->next; - memset ((char *)context, 0, sizeof (*context)); + memset (context, 0, sizeof (*context)); } else - context = ((cp_parser_context *) - ggc_alloc_cleared (sizeof (cp_parser_context))); + context = ggc_alloc_cleared (sizeof (cp_parser_context)); /* No errors have occurred yet in this context. */ context->status = CP_PARSER_STATUS_KIND_NO_ERROR; /* If this is not the bottomost context, copy information that we @@ -2067,7 +2064,7 @@ cp_parser_new (void) cp_lexer_new_main might load a PCH file. */ lexer = cp_lexer_new_main (); - parser = (cp_parser *) ggc_alloc_cleared (sizeof (cp_parser)); + parser = ggc_alloc_cleared (sizeof (cp_parser)); parser->lexer = lexer; parser->context = cp_parser_context_new (NULL); @@ -13796,10 +13793,9 @@ cp_parser_sizeof_operand (cp_parser* parser, enum rid keyword) saved_message = parser->type_definition_forbidden_message; /* And create the new one. */ parser->type_definition_forbidden_message - = ((const char *) - xmalloc (strlen (format) - + strlen (IDENTIFIER_POINTER (ridpointers[keyword])) - + 1 /* `\0' */)); + = xmalloc (strlen (format) + + strlen (IDENTIFIER_POINTER (ridpointers[keyword])) + + 1 /* `\0' */); sprintf ((char *) parser->type_definition_forbidden_message, format, IDENTIFIER_POINTER (ridpointers[keyword])); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9d66c3c0add..774d6d9150a 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -840,9 +840,8 @@ retrieve_specialization (tree tmpl, tree args) static tree retrieve_local_specialization (tree tmpl) { - tree spec = - (tree) htab_find_with_hash (local_specializations, tmpl, - htab_hash_pointer (tmpl)); + tree spec = htab_find_with_hash (local_specializations, tmpl, + htab_hash_pointer (tmpl)); return spec ? TREE_PURPOSE (spec) : NULL_TREE; } @@ -2409,11 +2408,11 @@ process_partial_specialization (tree decl) { /* We haven't yet initialized TPD2. Do so now. */ tpd2.arg_uses_template_parms - = (int*) alloca (sizeof (int) * nargs); + = 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 = (int*) alloca (sizeof (int) * nargs); + tpd2.parms = alloca (sizeof (int) * nargs); tpd2.level = TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (maintmpl)); } @@ -5541,9 +5540,9 @@ static tree tsubst_template_arg_vector (tree t, tree args, tsubst_flags_t complain) { int len = TREE_VEC_LENGTH (t), need_new = 0, i; - tree *elts = (tree *) alloca (len * sizeof (tree)); + tree *elts = alloca (len * sizeof (tree)); - memset ((char *) elts, 0, len * sizeof (tree)); + memset (elts, 0, len * sizeof (tree)); for (i = 0; i < len; i++) { diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index b28fea6212a..067ddee1773 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -1125,7 +1125,7 @@ create_pseudo_type_info (const char *real_name, int ident, ...) va_start (ap, ident); /* Generate the pseudo type name. */ - pseudo_name = (char *)alloca (strlen (real_name) + 30); + pseudo_name = alloca (strlen (real_name) + 30); strcpy (pseudo_name, real_name); strcat (pseudo_name, "_pseudo"); if (ident) diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 812ef6df2dc..a34cc4618d0 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -155,7 +155,7 @@ void push_deferring_access_checks (deferring_kind deferring) deferred_access_free_list = d->next; } else - d = (deferred_access *) ggc_alloc (sizeof (deferred_access)); + d = ggc_alloc (sizeof (deferred_access)); d->next = deferred_access_stack; d->deferred_access_checks = NULL_TREE; diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 9498dee4d94..0f1011e76b9 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -5969,7 +5969,7 @@ c_expand_asm_operands (tree string, tree outputs, tree inputs, tree clobbers, int noutputs = list_length (outputs); register int i; /* o[I] is the place that output number I should be written. */ - register tree *o = (tree *) alloca (noutputs * sizeof (tree)); + register tree *o = alloca (noutputs * sizeof (tree)); register tree tail; /* Record the contents of OUTPUTS before it is modified. */ diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 5ca6035432d..1333be2d721 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,9 @@ +Sat Jul 19 12:03:03 2003 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * com.c data.c expr.c fini.c g77spec.c global.c lab.c lex.c name.c + sta.c stc.c std.c storag.c stt.c stw.c symbol.c target.c type.c: + Remove unnecessary casts. + Thu Jul 17 06:34:41 2003 Neil Booth <neil@daikokuya.co.uk> * lang-options.h: Remove. diff --git a/gcc/f/com.c b/gcc/f/com.c index 770daf9e378..aec04b6c538 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -13787,8 +13787,7 @@ pop_f_function_context (void) static void push_f_function_context (void) { - struct f_function *p - = (struct f_function *) xmalloc (sizeof (struct f_function)); + struct f_function *p = xmalloc (sizeof (struct f_function)); push_function_context (); @@ -14216,7 +14215,7 @@ static bool ffe_init (void) { #ifdef IO_BUFFER_SIZE - setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE); + setvbuf (finput, xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE); #endif ffecom_init_decl_processing (); @@ -15226,7 +15225,7 @@ open_include_file (char *filename, struct file_name_list *searchptr) } else { - dir = (char *) xmalloc (p - filename + 1); + dir = xmalloc (p - filename + 1); memcpy (dir, filename, p - filename); dir[p - filename] = '\0'; from = p + 1; @@ -15357,8 +15356,7 @@ read_name_map (const char *dirname) if (! strcmp (map_list_ptr->map_list_name, dirname)) return map_list_ptr->map_list_map; - map_list_ptr = ((struct file_name_map_list *) - xmalloc (sizeof (struct file_name_map_list))); + map_list_ptr = xmalloc (sizeof (struct file_name_map_list)); map_list_ptr->map_list_name = xstrdup (dirname); map_list_ptr->map_list_map = NULL; @@ -15388,8 +15386,7 @@ read_name_map (const char *dirname) ; to = read_filename_string (ch, f); - ptr = ((struct file_name_map *) - xmalloc (sizeof (struct file_name_map))); + ptr = xmalloc (sizeof (struct file_name_map)); ptr->map_from = from; /* Make the real filename absolute. */ @@ -15429,7 +15426,7 @@ ffecom_file_ (const char *name) early #line directives (when -g is in effect). */ fp = &instack[++indepth]; - memset ((char *) fp, 0, sizeof (FILE_BUF)); + memset (fp, 0, sizeof (FILE_BUF)); if (name == NULL) name = ""; fp->nominal_fname = fp->fname = name; @@ -15454,8 +15451,8 @@ ffecom_decode_include_option (const char *dir) ignore_srcdir = 1; else { - struct file_name_list *dirtmp = (struct file_name_list *) - xmalloc (sizeof (struct file_name_list)); + struct file_name_list *dirtmp + = xmalloc (sizeof (struct file_name_list)); dirtmp->next = 0; /* New one goes on the end */ dirtmp->fname = dir; dirtmp->got_name_map = 0; @@ -15647,7 +15644,7 @@ ffecom_open_include_ (char *name, ffewhereLine l, ffewhereColumn c) instack[indepth].column = ffewhere_column_use (c); fp = &instack[indepth + 1]; - memset ((char *) fp, 0, sizeof (FILE_BUF)); + memset (fp, 0, sizeof (FILE_BUF)); fp->nominal_fname = fp->fname = fname; fp->dir = searchptr; diff --git a/gcc/f/data.c b/gcc/f/data.c index 39e7ff8956e..2040f0ab6dc 100644 --- a/gcc/f/data.c +++ b/gcc/f/data.c @@ -723,8 +723,8 @@ ffedata_convert_ (ffebld source, ffelexToken source_token, if (max > ffedata_convert_cache_max_) { - cache = (ffedataConvertCache_) malloc_new_ks (malloc_pool_image (), - "FFEDATA cache", max * sizeof (*cache)); + cache = malloc_new_ks (malloc_pool_image (), + "FFEDATA cache", max * sizeof (*cache)); if (ffedata_convert_cache_max_ != 0) { memcpy (cache, ffedata_convert_cache_, diff --git a/gcc/f/expr.c b/gcc/f/expr.c index 0c22fb978ee..6aeddafe4c2 100644 --- a/gcc/f/expr.c +++ b/gcc/f/expr.c @@ -8488,8 +8488,7 @@ ffeexpr_expr_new_ (void) { ffeexprExpr_ e; - e = (ffeexprExpr_) malloc_new_ks (ffe_pool_program_unit (), "FFEEXPR expr", - sizeof (*e)); + e = malloc_new_ks (ffe_pool_program_unit (), "FFEEXPR expr", sizeof (*e)); e->previous = NULL; e->type = FFEEXPR_exprtypeUNKNOWN_; e->token = NULL; diff --git a/gcc/f/fini.c b/gcc/f/fini.c index 5eeec66b905..167837b461f 100644 --- a/gcc/f/fini.c +++ b/gcc/f/fini.c @@ -367,7 +367,7 @@ main (int argc, char **argv) /* Make new name object to store name and its keyword. */ - newname = (name) xmalloc (sizeof (*newname)); + newname = xmalloc (sizeof (*newname)); newname->namelen = strlen (buf); newname->kwlen = strlen (kwname); total_length = newname->kwlen + fixlengths; diff --git a/gcc/f/g77spec.c b/gcc/f/g77spec.c index dc8347c88bb..b5404994c2d 100644 --- a/gcc/f/g77spec.c +++ b/gcc/f/g77spec.c @@ -219,7 +219,7 @@ append_arg (const char *arg) int i; newargsize = (g77_xargc << 2) + 20; /* This should handle all. */ - g77_newargv = (const char **) xmalloc (newargsize * sizeof (char *)); + g77_newargv = xmalloc (newargsize * sizeof (char *)); /* Copy what has been done so far. */ for (i = 0; i < g77_newargc; ++i) diff --git a/gcc/f/global.c b/gcc/f/global.c index f6c23cdc768..8793f62c4a7 100644 --- a/gcc/f/global.c +++ b/gcc/f/global.c @@ -107,8 +107,7 @@ ffeglobal_new_ (ffename n) assert (n != NULL); - g = (ffeglobal) malloc_new_ks (malloc_pool_image (), "FFEGLOBAL", - sizeof (*g)); + g = malloc_new_ks (malloc_pool_image (), "FFEGLOBAL", sizeof (*g)); g->n = n; g->hook = FFECOM_globalNULL; g->tick = 0; @@ -780,10 +779,9 @@ ffeglobal_proc_def_nargs (ffesymbol s, int n_args) return; } - g->u.proc.arg_info - = (ffeglobalArgInfo_) malloc_new_ks (malloc_pool_image (), - "ffeglobalArgInfo_", - n_args * sizeof (g->u.proc.arg_info[0])); + g->u.proc.arg_info = malloc_new_ks (malloc_pool_image (), + "ffeglobalArgInfo_", + n_args * sizeof (g->u.proc.arg_info[0])); while (n_args-- > 0) g->u.proc.arg_info[n_args].t = NULL; } @@ -1123,10 +1121,9 @@ ffeglobal_proc_ref_nargs (ffesymbol s, int n_args, ffelexToken t) return TRUE; } - g->u.proc.arg_info - = (ffeglobalArgInfo_) malloc_new_ks (malloc_pool_image (), - "ffeglobalArgInfo_", - n_args * sizeof (g->u.proc.arg_info[0])); + g->u.proc.arg_info = malloc_new_ks (malloc_pool_image (), + "ffeglobalArgInfo_", + n_args * sizeof (g->u.proc.arg_info[0])); while (n_args-- > 0) g->u.proc.arg_info[n_args].t = NULL; diff --git a/gcc/f/lab.c b/gcc/f/lab.c index 8691897c21c..1d278748b21 100644 --- a/gcc/f/lab.c +++ b/gcc/f/lab.c @@ -141,7 +141,7 @@ ffelab_new (ffelabValue v) ffelab l; ++ffelab_num_news_; - l = (ffelab) malloc_new_ks (ffe_pool_any_unit (), "FFELAB label", sizeof (*l)); + l = malloc_new_ks (ffe_pool_any_unit (), "FFELAB label", sizeof (*l)); l->next = ffelab_list_; l->hook = FFECOM_labelNULL; l->value = v; diff --git a/gcc/f/lex.c b/gcc/f/lex.c index 4d0429fe0e8..02f087283d5 100644 --- a/gcc/f/lex.c +++ b/gcc/f/lex.c @@ -694,7 +694,7 @@ ffelex_cfelex_ (ffelexToken *xtoken, FILE *finput, int c) register unsigned bytes_used = (p - q); buffer_length *= 2; - q = (char *)xrealloc (q, buffer_length); + q = xrealloc (q, buffer_length); p = &q[bytes_used]; r = &q[buffer_length]; } @@ -754,7 +754,7 @@ ffelex_cfelex_ (ffelexToken *xtoken, FILE *finput, int c) register unsigned bytes_used = (p - q); buffer_length = bytes_used * 2; - q = (char *)xrealloc (q, buffer_length); + q = xrealloc (q, buffer_length); p = &q[bytes_used]; r = &q[buffer_length]; } @@ -805,8 +805,7 @@ ffelex_file_pop_ (const char *filename) static void ffelex_file_push_ (int old_lineno, const char *filename) { - struct file_stack *p - = (struct file_stack *) xmalloc (sizeof (struct file_stack)); + struct file_stack *p = xmalloc (sizeof (struct file_stack)); input_file_stack->location.line = old_lineno; p->next = input_file_stack; @@ -923,7 +922,7 @@ ffelex_get_directive_line_ (char **text, FILE *finput) if (buffer_length == 0) { - directive_buffer = (char *)xmalloc (128); + directive_buffer = xmalloc (128); buffer_length = 128; } @@ -939,8 +938,7 @@ ffelex_get_directive_line_ (char **text, FILE *finput) register unsigned bytes_used = (p - directive_buffer); buffer_length *= 2; - directive_buffer - = (char *)xrealloc (directive_buffer, buffer_length); + directive_buffer = xrealloc (directive_buffer, buffer_length); p = &directive_buffer[bytes_used]; buffer_limit = &directive_buffer[buffer_length]; } @@ -1591,8 +1589,7 @@ ffelex_token_new_ (void) ++ffelex_total_tokens_; - t = (ffelexToken) malloc_new_ks (malloc_pool_image (), - "FFELEX token", sizeof (*t)); + t = malloc_new_ks (malloc_pool_image (), "FFELEX token", sizeof (*t)); t->id_ = ffelex_token_nextid_++; return t; } diff --git a/gcc/f/name.c b/gcc/f/name.c index 360279b3151..26f713ef32b 100644 --- a/gcc/f/name.c +++ b/gcc/f/name.c @@ -105,7 +105,7 @@ ffename_find (ffenameSpace ns, ffelexToken t) if (found) return n; - newn = (ffename) malloc_new_ks (ns->pool, "FFENAME name", sizeof (*n)); + newn = malloc_new_ks (ns->pool, "FFENAME name", sizeof (*n)); newn->next = n; newn->previous = n->previous; n->previous = newn; @@ -232,8 +232,7 @@ ffename_space_new (mallocPool pool) { ffenameSpace ns; - ns = (ffenameSpace) malloc_new_ks (pool, "FFENAME space", - sizeof (*ns)); + ns = malloc_new_ks (pool, "FFENAME space", sizeof (*ns)); ns->first = (ffename) &ns->first; ns->last = (ffename) &ns->first; ns->pool = pool; diff --git a/gcc/f/sta.c b/gcc/f/sta.c index 885f44c9912..4b26d8cecd8 100644 --- a/gcc/f/sta.c +++ b/gcc/f/sta.c @@ -247,9 +247,8 @@ ffesta_save_ (ffelexToken t) if (saved_tokens == NULL) { saved_tokens - = (ffelexToken *) malloc_new_ksr (malloc_pool_image (), - "FFEST Saved Tokens", - (max_saved_tokens = 8) * sizeof (ffelexToken)); + = malloc_new_ksr (malloc_pool_image (), "FFEST Saved Tokens", + (max_saved_tokens = 8) * sizeof (ffelexToken)); /* Start off with 8. */ } else if (num_saved_tokens >= max_saved_tokens) @@ -258,10 +257,9 @@ ffesta_save_ (ffelexToken t) max_saved_tokens <<= 1; /* Multiply by two. */ assert (max_saved_tokens > toknum); saved_tokens - = (ffelexToken *) malloc_resize_ksr (malloc_pool_image (), - saved_tokens, - max_saved_tokens * sizeof (ffelexToken), - toknum * sizeof (ffelexToken)); + = malloc_resize_ksr (malloc_pool_image (), saved_tokens, + max_saved_tokens * sizeof (ffelexToken), + toknum * sizeof (ffelexToken)); } *(saved_tokens + num_saved_tokens++) = ffelex_token_use (t); @@ -1319,10 +1317,8 @@ ffesta_init_0 (void) ffestaPossible_ ptr; int i; - ptr = (ffestaPossible_) malloc_new_kp (malloc_pool_image (), - "FFEST possibles", - FFESTA_maxPOSSIBLES_ - * sizeof (*ptr)); + ptr = malloc_new_kp (malloc_pool_image (), "FFEST possibles", + FFESTA_maxPOSSIBLES_ * sizeof (*ptr)); for (i = 0; i < FFESTA_maxPOSSIBLES_; ++i) ffesta_possibles_[i] = ptr++; diff --git a/gcc/f/stc.c b/gcc/f/stc.c index f859fac89df..5f058135bbf 100644 --- a/gcc/f/stc.c +++ b/gcc/f/stc.c @@ -6748,7 +6748,7 @@ ffestc_R809 (ffelexToken construct_name, ffebld expr, ffelexToken expr_token) /* Init block to manage CASE list. */ pool = malloc_pool_new ("Select", ffe_pool_any_unit (), 1024); - s = (ffestwSelect) malloc_new_kp (pool, "Select", sizeof (*s)); + s = malloc_new_kp (pool, "Select", sizeof (*s)); s->first_rel = (ffestwCase) &s->first_rel; s->last_rel = (ffestwCase) &s->first_rel; s->first_stmt = (ffestwCase) &s->first_rel; diff --git a/gcc/f/std.c b/gcc/f/std.c index 863214e9292..09f04198f0a 100644 --- a/gcc/f/std.c +++ b/gcc/f/std.c @@ -984,8 +984,8 @@ ffestd_subr_copy_easy_ (ffestpInquireIx max) ffestpInquireStmt *stmt; ffestpInquireIx ix; - stmt = (ffestpInquireStmt *) malloc_new_kp (ffesta_output_pool, - "FFESTD easy", sizeof (ffestpFile) * max); + stmt = malloc_new_kp (ffesta_output_pool, "FFESTD easy", + sizeof (ffestpFile) * max); for (ix = 0; ix < max; ++ix) { @@ -2229,8 +2229,7 @@ ffestd_R909_item (ffebld expr, ffelexToken expr_token) ffestd_check_item_ (); - item = (ffestdExprItem_) malloc_new_kp (ffesta_output_pool, - "ffestdExprItem_", sizeof (*item)); + item = malloc_new_kp (ffesta_output_pool, "ffestdExprItem_", sizeof (*item)); item->next = NULL; item->expr = expr; @@ -2306,8 +2305,7 @@ ffestd_R910_item (ffebld expr, ffelexToken expr_token) ffestd_check_item_ (); - item = (ffestdExprItem_) malloc_new_kp (ffesta_output_pool, - "ffestdExprItem_", sizeof (*item)); + item = malloc_new_kp (ffesta_output_pool, "ffestdExprItem_", sizeof (*item)); item->next = NULL; item->expr = expr; @@ -2366,8 +2364,7 @@ ffestd_R911_item (ffebld expr, ffelexToken expr_token) ffestd_check_item_ (); - item = (ffestdExprItem_) malloc_new_kp (ffesta_output_pool, - "ffestdExprItem_", sizeof (*item)); + item = malloc_new_kp (ffesta_output_pool, "ffestdExprItem_", sizeof (*item)); item->next = NULL; item->expr = expr; @@ -2535,8 +2532,7 @@ ffestd_R923B_item (ffebld expr) ffestd_check_item_ (); - item = (ffestdExprItem_) malloc_new_kp (ffesta_output_pool, - "ffestdExprItem_", sizeof (*item)); + item = malloc_new_kp (ffesta_output_pool, "ffestdExprItem_", sizeof (*item)); item->next = NULL; item->expr = expr; diff --git a/gcc/f/storag.c b/gcc/f/storag.c index db3382725f9..8e9cb247a08 100644 --- a/gcc/f/storag.c +++ b/gcc/f/storag.c @@ -416,8 +416,7 @@ ffestorag_new (ffestoragList sl) { ffestorag s; - s = (ffestorag) malloc_new_kp (ffe_pool_program_unit (), "ffestorag", - sizeof (*s)); + s = malloc_new_kp (ffe_pool_program_unit (), "ffestorag", sizeof (*s)); s->next = (ffestorag) &sl->first; s->previous = sl->last; s->hook = FFECOM_storageNULL; diff --git a/gcc/f/stt.c b/gcc/f/stt.c index 455f4e1b621..e616d492289 100644 --- a/gcc/f/stt.c +++ b/gcc/f/stt.c @@ -79,8 +79,7 @@ ffestt_caselist_append (ffesttCaseList list, bool range, ffebld case1, { ffesttCaseList new; - new = (ffesttCaseList) malloc_new_kp (ffesta_scratch_pool, - "FFEST case list", sizeof (*new)); + new = malloc_new_kp (ffesta_scratch_pool, "FFEST case list", sizeof (*new)); new->next = list->previous->next; new->previous = list->previous; new->next->previous = new; @@ -103,9 +102,8 @@ ffestt_caselist_create (void) { ffesttCaseList new; - new = (ffesttCaseList) malloc_new_kp (ffesta_scratch_pool, - "FFEST case list root", - sizeof (*new)); + new = malloc_new_kp (ffesta_scratch_pool, "FFEST case list root", + sizeof (*new)); new->next = new->previous = new; new->t = NULL; new->expr1 = NULL; @@ -151,8 +149,7 @@ ffestt_dimlist_append (ffesttDimList list, ffebld lower, ffebld upper, { ffesttDimList new; - new = (ffesttDimList) malloc_new_kp (ffesta_scratch_pool, - "FFEST dim list", sizeof (*new)); + new = malloc_new_kp (ffesta_scratch_pool, "FFEST dim list", sizeof (*new)); new->next = list->previous->next; new->previous = list->previous; new->next->previous = new; @@ -400,8 +397,8 @@ ffestt_dimlist_create (void) { ffesttDimList new; - new = (ffesttDimList) malloc_new_kp (ffesta_scratch_pool, - "FFEST dim list root", sizeof (*new)); + new = malloc_new_kp (ffesta_scratch_pool, "FFEST dim list root", + sizeof (*new)); new->next = new->previous = new; new->t = NULL; new->lower = NULL; @@ -503,8 +500,7 @@ ffestt_exprlist_append (ffesttExprList list, ffebld expr, ffelexToken t) { ffesttExprList new; - new = (ffesttExprList) malloc_new_kp (ffesta_scratch_pool, - "FFEST expr list", sizeof (*new)); + new = malloc_new_kp (ffesta_scratch_pool, "FFEST expr list", sizeof (*new)); new->next = list->previous->next; new->previous = list->previous; new->next->previous = new; @@ -525,8 +521,8 @@ ffestt_exprlist_create (void) { ffesttExprList new; - new = (ffesttExprList) malloc_new_kp (ffesta_scratch_pool, - "FFEST expr list root", sizeof (*new)); + new = malloc_new_kp (ffesta_scratch_pool, "FFEST expr list root", + sizeof (*new)); new->next = new->previous = new; new->expr = NULL; new->t = NULL; @@ -592,8 +588,8 @@ ffestt_formatlist_append (ffesttFormatList list) { ffesttFormatList new; - new = (ffesttFormatList) malloc_new_kp (ffesta_scratch_pool, - "FFEST format list", sizeof (*new)); + new = malloc_new_kp (ffesta_scratch_pool, "FFEST format list", + sizeof (*new)); new->next = list->previous->next; new->previous = list->previous; new->next->previous = new; @@ -613,8 +609,8 @@ ffestt_formatlist_create (ffesttFormatList parent, ffelexToken t) { ffesttFormatList new; - new = (ffesttFormatList) malloc_new_kp (ffesta_scratch_pool, - "FFEST format list root", sizeof (*new)); + new = malloc_new_kp (ffesta_scratch_pool, "FFEST format list root", + sizeof (*new)); new->next = new->previous = new; new->type = FFESTP_formattypeNone; new->t = t; @@ -720,8 +716,7 @@ ffestt_implist_append (ffesttImpList list, ffelexToken first, ffelexToken last) { ffesttImpList new; - new = (ffesttImpList) malloc_new_kp (ffesta_scratch_pool, - "FFEST token list", sizeof (*new)); + new = malloc_new_kp (ffesta_scratch_pool, "FFEST token list", sizeof (*new)); new->next = list->previous->next; new->previous = list->previous; new->next->previous = new; @@ -742,9 +737,8 @@ ffestt_implist_create (void) { ffesttImpList new; - new = (ffesttImpList) malloc_new_kp (ffesta_scratch_pool, - "FFEST token list root", - sizeof (*new)); + new = malloc_new_kp (ffesta_scratch_pool, "FFEST token list root", + sizeof (*new)); new->next = new->previous = new; new->first = NULL; new->last = NULL; @@ -807,8 +801,7 @@ ffestt_tokenlist_append (ffesttTokenList tl, ffelexToken t) { ffesttTokenItem ti; - ti = (ffesttTokenItem) malloc_new_kp (ffesta_scratch_pool, - "FFEST token item", sizeof (*ti)); + ti = malloc_new_kp (ffesta_scratch_pool, "FFEST token item", sizeof (*ti)); ti->next = (ffesttTokenItem) &tl->first; ti->previous = tl->last; ti->next->previous = ti; @@ -829,8 +822,7 @@ ffestt_tokenlist_create (void) { ffesttTokenList tl; - tl = (ffesttTokenList) malloc_new_kp (ffesta_scratch_pool, - "FFEST token list", sizeof (*tl)); + tl = malloc_new_kp (ffesta_scratch_pool, "FFEST token list", sizeof (*tl)); tl->first = tl->last = (ffesttTokenItem) &tl->first; tl->count = 0; return tl; diff --git a/gcc/f/stw.c b/gcc/f/stw.c index af68522d2e8..57658de3204 100644 --- a/gcc/f/stw.c +++ b/gcc/f/stw.c @@ -282,8 +282,8 @@ ffestw_init_0 (void) { ffestw b; - ffestw_stack_top_ = b = (ffestw) malloc_new_kp (malloc_pool_image (), - "FFESTW stack base", sizeof (*b)); + ffestw_stack_top_ = b = malloc_new_kp (malloc_pool_image (), + "FFESTW stack base", sizeof (*b)); b->uses_ = 0; /* catch if anyone uses, kills, &c this block. */ b->next_ = NULL; @@ -324,7 +324,7 @@ ffestw_new (void) { ffestw b; - b = (ffestw) malloc_new_kp (malloc_pool_image (), "FFESTW", sizeof (*b)); + b = malloc_new_kp (malloc_pool_image (), "FFESTW", sizeof (*b)); b->uses_ = 1; return b; diff --git a/gcc/f/symbol.c b/gcc/f/symbol.c index addacc8f144..c22697ff377 100644 --- a/gcc/f/symbol.c +++ b/gcc/f/symbol.c @@ -206,8 +206,7 @@ ffesymbol_new_ (ffename n) assert (n != NULL); - s = (ffesymbol) malloc_new_ks (FFESYMBOL_SPACE_POOL_, "FFESYMBOL", - sizeof (*s)); + s = malloc_new_ks (FFESYMBOL_SPACE_POOL_, "FFESYMBOL", sizeof (*s)); s->name = n; s->other_space_name = NULL; #if FFEGLOBAL_ENABLED @@ -258,8 +257,8 @@ ffesymbol_new_ (ffename n) return s; } - r = (ffesymbolRetract_) malloc_new_kp (ffesymbol_retract_pool_, - "FFESYMBOL retract", sizeof (*r)); + r = malloc_new_kp (ffesymbol_retract_pool_, "FFESYMBOL retract", + sizeof (*r)); r->next = NULL; r->command = FFESYMBOL_retractcommandDELETE_; r->live = s; @@ -1104,13 +1103,13 @@ ffesymbol_signal_change (ffesymbol s) if (!ffesymbol_retractable_ || s->have_old) return; - r = (ffesymbolRetract_) malloc_new_kp (ffesymbol_retract_pool_, - "FFESYMBOL retract", sizeof (*r)); + r = malloc_new_kp (ffesymbol_retract_pool_, "FFESYMBOL retract", + sizeof (*r)); r->next = NULL; r->command = FFESYMBOL_retractcommandRETRACT_; r->live = s; - r->symbol = sym = (ffesymbol) malloc_new_ks (FFESYMBOL_SPACE_POOL_, - "FFESYMBOL", sizeof (*sym)); + r->symbol = sym = malloc_new_ks (FFESYMBOL_SPACE_POOL_, + "FFESYMBOL", sizeof (*sym)); *sym = *s; /* Make an exact copy of the symbol in case we need it back. */ sym->info = ffeinfo_use (s->info); diff --git a/gcc/f/target.c b/gcc/f/target.c index 35eed17c55c..98760469831 100644 --- a/gcc/f/target.c +++ b/gcc/f/target.c @@ -2244,8 +2244,7 @@ ffetarget_real1 (ffetargetReal1 *value, ffelexToken integer, #undef dotoktxt if (sz > ARRAY_SIZE (ffetarget_string_)) - p = ptr = (char *) malloc_new_ks (malloc_pool_image (), "ffetarget_real1", - sz); + p = ptr = malloc_new_ks (malloc_pool_image (), "ffetarget_real1", sz); #define dotoktxt(x) if (x != NULL) \ { \ @@ -2327,7 +2326,7 @@ ffetarget_real2 (ffetargetReal2 *value, ffelexToken integer, #undef dotoktxt if (sz > ARRAY_SIZE (ffetarget_string_)) - p = ptr = (char *) malloc_new_ks (malloc_pool_image (), "ffetarget_real1", sz); + p = ptr = malloc_new_ks (malloc_pool_image (), "ffetarget_real1", sz); #define dotoktxt(x) if (x != NULL) \ { \ diff --git a/gcc/f/type.c b/gcc/f/type.c index 7625cbbaa0e..d25ab50f4c2 100644 --- a/gcc/f/type.c +++ b/gcc/f/type.c @@ -53,8 +53,7 @@ ffetype_new (void) { ffetype type; - type = (ffetype) malloc_new_kp (malloc_pool_image (), "ffetype", - sizeof (*type)); + type = malloc_new_kp (malloc_pool_image (), "ffetype", sizeof (*type)); type->kinds_ = NULL; type->stars_ = NULL; type->alignment_ = 0; @@ -74,9 +73,8 @@ ffetype_set_kind (ffetype base_type, int kind, ffetype type) int i; base_type->kinds_ - = (ffetype_indexes_) malloc_new_kp (malloc_pool_image (), - "ffetype_indexes_[kinds]", - sizeof (*(base_type->kinds_))); + = malloc_new_kp (malloc_pool_image (), "ffetype_indexes_[kinds]", + sizeof (*(base_type->kinds_))); for (i = 0; ((size_t) i) < ARRAY_SIZE (base_type->kinds_->type_); ++i) base_type->kinds_->type_[i] = NULL; } @@ -94,9 +92,8 @@ ffetype_set_star (ffetype base_type, int star, ffetype type) int i; base_type->stars_ - = (ffetype_indexes_) malloc_new_kp (malloc_pool_image (), - "ffetype_indexes_[stars]", - sizeof (*(base_type->stars_))); + = malloc_new_kp (malloc_pool_image (), "ffetype_indexes_[stars]", + sizeof (*(base_type->stars_))); for (i = 0; ((size_t) i) < ARRAY_SIZE (base_type->stars_->type_); ++i) base_type->stars_->type_[i] = NULL; } diff --git a/gcc/fixinc/fixfixes.c b/gcc/fixinc/fixfixes.c index b3c75ae1c1e..4ee57602b29 100644 --- a/gcc/fixinc/fixfixes.c +++ b/gcc/fixinc/fixfixes.c @@ -783,7 +783,7 @@ main( argc, argv ) return EXIT_FAILURE; } - pz_tmptmp = (char*)xmalloc( strlen( argv[4] ) + 5 ); + pz_tmptmp = xmalloc (strlen (argv[4]) + 5); strcpy( pz_tmptmp, argv[4] ); /* Don't lose because "12345678" and "12345678X" map to the same diff --git a/gcc/fixinc/fixincl.c b/gcc/fixinc/fixincl.c index 18a32fcfbec..92abcac49b9 100644 --- a/gcc/fixinc/fixincl.c +++ b/gcc/fixinc/fixincl.c @@ -488,12 +488,12 @@ run_compiles () { tFixDesc *p_fixd = fixDescList; int fix_ct = FIX_COUNT; - regex_t *p_re = (regex_t *) xmalloc (REGEX_COUNT * sizeof (regex_t)); + regex_t *p_re = xmalloc (REGEX_COUNT * sizeof (regex_t)); /* Make sure compile_re does not stumble across invalid data */ - memset ( (void*)p_re, '\0', REGEX_COUNT * sizeof (regex_t) ); - memset ( (void*)&incl_quote_re, '\0', sizeof (regex_t) ); + memset (p_re, '\0', REGEX_COUNT * sizeof (regex_t)); + memset (&incl_quote_re, '\0', sizeof (regex_t)); compile_re (incl_quote_pat, &incl_quote_re, 1, "quoted include", "run_compiles"); @@ -911,7 +911,7 @@ fix_with_system (p_fixd, pz_fix_file, pz_file_source, pz_temp_file) + strlen( pz_file_source ) + strlen( pz_temp_file ); - pz_cmd = (char*)xmalloc( argsize ); + pz_cmd = xmalloc (argsize); strcpy( pz_cmd, pz_orig_dir ); pz_scan = pz_cmd + strlen( pz_orig_dir ); @@ -970,7 +970,7 @@ fix_with_system (p_fixd, pz_fix_file, pz_file_source, pz_temp_file) } /* Estimated buffer size we will need. */ - pz_scan = pz_cmd = (char*)xmalloc( argsize ); + pz_scan = pz_cmd = xmalloc (argsize); /* How much of it do we allot to the program name and its arguments. */ parg_size = argsize - parg_size; @@ -1010,7 +1010,7 @@ fix_with_system (p_fixd, pz_fix_file, pz_file_source, pz_temp_file) while (pz_scan == (char*)NULL) { size_t already_filled = pz_scan_save - pz_cmd; - pz_cmd = (char*)xrealloc( pz_cmd, argsize += 100 ); + pz_cmd = xrealloc (pz_cmd, argsize += 100); pz_scan_save = pz_scan = pz_cmd + already_filled; parg_size += 100; pz_scan = make_raw_shell_str( pz_scan, pArg, @@ -1058,9 +1058,8 @@ start_fixer (read_fd, p_fixd, pz_fix_file) else { tSCC z_cmd_fmt[] = "file='%s'\n%s"; - pz_cmd = (char*) xmalloc (strlen (p_fixd->patch_args[2]) - + sizeof( z_cmd_fmt ) - + strlen( pz_fix_file )); + pz_cmd = xmalloc (strlen (p_fixd->patch_args[2]) + + sizeof (z_cmd_fmt) + strlen (pz_fix_file)); sprintf (pz_cmd, z_cmd_fmt, pz_fix_file, p_fixd->patch_args[2]); pz_cmd_save = p_fixd->patch_args[2]; p_fixd->patch_args[2] = pz_cmd; diff --git a/gcc/fixinc/fixlib.c b/gcc/fixinc/fixlib.c index 49edda776d1..32f65d9d67a 100644 --- a/gcc/fixinc/fixlib.c +++ b/gcc/fixinc/fixlib.c @@ -49,7 +49,7 @@ load_file_data (fp) if (space_left < 1024) { space_left += 4096; - pz_data = xrealloc ((void*)pz_data, space_left + space_used + 1 ); + pz_data = xrealloc (pz_data, space_left + space_used + 1 ); } size_read = fread (pz_data + space_used, 1, space_left, fp); @@ -73,7 +73,7 @@ load_file_data (fp) space_used += size_read; } while (! feof (fp)); - pz_data = xrealloc ((void*)pz_data, space_used+1 ); + pz_data = xrealloc (pz_data, space_used+1 ); pz_data[ space_used ] = NUL; return pz_data; diff --git a/gcc/fixinc/server.c b/gcc/fixinc/server.c index 4cb581086cd..f195f018afc 100644 --- a/gcc/fixinc/server.c +++ b/gcc/fixinc/server.c @@ -111,7 +111,7 @@ load_data (fp) size_t off = (size_t) (pz_scan - pz_text); text_size += 4096; - pz_text = xrealloc ((void *) pz_text, text_size); + pz_text = xrealloc (pz_text, text_size); pz_scan = pz_text + off; } } @@ -126,7 +126,7 @@ load_data (fp) while ((pz_scan > pz_text) && ISSPACE (pz_scan[-1])) pz_scan--; *pz_scan = NUL; - return xrealloc ((void *) pz_text, strlen (pz_text) + 1); + return xrealloc (pz_text, strlen (pz_text) + 1); } diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index df76ce6ba9d..774cf7969a6 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2003-07-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * class.c java-tree.h jcf-write.c jvspec.c: Remove unnecessary + casts. + 2003-07-19 Neil Booth <neil@daikokuya.co.uk> * lang.opt: Don't show -MD_ and -MDD_. diff --git a/gcc/java/class.c b/gcc/java/class.c index 443cfc557d8..a4278efa0c0 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -148,8 +148,7 @@ add_assume_compiled (const char *ident, int excludep) { int len; assume_compiled_node *parent; - assume_compiled_node *node = - xmalloc (sizeof (assume_compiled_node)); + assume_compiled_node *node = xmalloc (sizeof (assume_compiled_node)); node->ident = xstrdup (ident); node->excludep = excludep; @@ -2157,7 +2156,7 @@ java_treetreehash_find (htab_t ht, tree t) { struct treetreehash_entry *e; hashval_t hv = JAVA_TREEHASHHASH_H (t); - e = (struct treetreehash_entry *) htab_find_with_hash (ht, t, hv); + e = htab_find_with_hash (ht, t, hv); if (e == NULL) return NULL; else diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index 357f3493170..cd277c5dc63 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -946,8 +946,7 @@ union lang_tree_node if (DECL_LANG_SPECIFIC (T) == NULL) \ { \ DECL_LANG_SPECIFIC ((T)) \ - = ((struct lang_decl *) \ - ggc_alloc_cleared (sizeof (struct lang_decl))); \ + = ggc_alloc_cleared (sizeof (struct lang_decl)); \ DECL_LANG_SPECIFIC (T)->desc = LANG_DECL_VAR; \ } @@ -1050,9 +1049,8 @@ struct lang_decl GTY(()) #define MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC(T) \ if (TYPE_LANG_SPECIFIC ((T)) == NULL) \ { \ - TYPE_LANG_SPECIFIC ((T)) = \ - ((struct lang_type *) \ - ggc_alloc_cleared (sizeof (struct lang_type))); \ + TYPE_LANG_SPECIFIC ((T)) \ + = ggc_alloc_cleared (sizeof (struct lang_type)); \ } #define TYPE_FINIT_STMT_LIST(T) (TYPE_LANG_SPECIFIC(T)->finit_stmt_list) diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c index fcdd42447b4..44c9ec1cf80 100644 --- a/gcc/java/jcf-write.c +++ b/gcc/java/jcf-write.c @@ -386,8 +386,7 @@ static struct chunk * alloc_chunk (struct chunk *last, unsigned char *data, int size, struct obstack *work) { - struct chunk *chunk = (struct chunk *) - obstack_alloc (work, sizeof(struct chunk)); + struct chunk *chunk = obstack_alloc (work, sizeof(struct chunk)); if (data == NULL && size > 0) data = obstack_alloc (work, size); @@ -434,8 +433,8 @@ append_chunk_copy (unsigned char *data, int size, struct jcf_partial *state) static struct jcf_block * gen_jcf_label (struct jcf_partial *state) { - struct jcf_block *block = (struct jcf_block *) - obstack_alloc (state->chunk_obstack, sizeof (struct jcf_block)); + struct jcf_block *block + = obstack_alloc (state->chunk_obstack, sizeof (struct jcf_block)); block->next = NULL; block->linenumber = -1; block->pc = UNDEFINED_PC; @@ -518,8 +517,8 @@ static struct jcf_handler * alloc_handler (struct jcf_block *start_label, struct jcf_block *end_label, struct jcf_partial *state) { - struct jcf_handler *handler = (struct jcf_handler *) - obstack_alloc (state->chunk_obstack, sizeof (struct jcf_handler)); + struct jcf_handler *handler + = obstack_alloc (state->chunk_obstack, sizeof (struct jcf_handler)); handler->start_label = start_label; handler->end_label = end_label; handler->handler_label = get_jcf_label_here (state); @@ -576,8 +575,7 @@ localvar_alloc (tree decl, struct jcf_partial *state) ptr = (struct localvar_info**) state->localvars.data + index; state->localvars.ptr = (unsigned char *) (ptr + 1 + wide); } - info = (struct localvar_info *) - obstack_alloc (state->chunk_obstack, sizeof (struct localvar_info)); + info = obstack_alloc (state->chunk_obstack, sizeof (struct localvar_info)); ptr[0] = info; if (wide) ptr[1] = (struct localvar_info *)(~0); @@ -1004,8 +1002,8 @@ static void emit_reloc (HOST_WIDE_INT value, int kind, struct jcf_block *target, struct jcf_partial *state) { - struct jcf_relocation *reloc = (struct jcf_relocation *) - obstack_alloc (state->chunk_obstack, sizeof (struct jcf_relocation)); + struct jcf_relocation *reloc + = obstack_alloc (state->chunk_obstack, sizeof (struct jcf_relocation)); struct jcf_block *block = state->last_block; reloc->next = block->u.relocations; block->u.relocations = reloc; @@ -1582,8 +1580,8 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state) case CASE_EXPR: { struct jcf_switch_state *sw_state = state->sw_state; - struct jcf_relocation *reloc = (struct jcf_relocation *) - obstack_alloc (state->chunk_obstack, sizeof (struct jcf_relocation)); + struct jcf_relocation *reloc + = obstack_alloc (state->chunk_obstack, sizeof (struct jcf_relocation)); HOST_WIDE_INT case_value = TREE_INT_CST_LOW (TREE_OPERAND (exp, 0)); reloc->kind = 0; reloc->label = get_jcf_label_here (state); @@ -1663,8 +1661,8 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state) HOST_WIDE_INT i; unsigned HOST_WIDE_INT delta; /* Copy the chain of relocs into a sorted array. */ - struct jcf_relocation **relocs = (struct jcf_relocation **) - xmalloc (sw_state.num_cases * sizeof (struct jcf_relocation *)); + struct jcf_relocation **relocs + = xmalloc (sw_state.num_cases * sizeof (struct jcf_relocation *)); /* The relocs arrays is a buffer with a gap. The assumption is that cases will normally come in "runs". */ int gap_start = 0; @@ -2669,8 +2667,7 @@ perform_relocations (struct jcf_partial *state) unsigned char *old_ptr = old_buffer + old_size; if (new_size != old_size) { - chunk->data = (unsigned char *) - obstack_alloc (state->chunk_obstack, new_size); + chunk->data = obstack_alloc (state->chunk_obstack, new_size); chunk->size = new_size; } new_ptr = chunk->data + new_size; diff --git a/gcc/java/jvspec.c b/gcc/java/jvspec.c index 710a344c746..b76025ee341 100644 --- a/gcc/java/jvspec.c +++ b/gcc/java/jvspec.c @@ -319,7 +319,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) else if (argv[i][1] == 'O') saw_O = 1; else if ((argv[i][2] == '\0' - && (char *)strchr ("bBVDUoeTuIYmLiA", argv[i][1]) != NULL) + && strchr ("bBVDUoeTuIYmLiA", argv[i][1]) != NULL) || strcmp (argv[i], "-Tdata") == 0 || strcmp (argv[i], "-MT") == 0 || strcmp (argv[i], "-MF") == 0) @@ -337,7 +337,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) } else if (library != 0 && ((argv[i][2] == '\0' - && (char *) strchr ("cSEM", argv[i][1]) != NULL) + && strchr ("cSEM", argv[i][1]) != NULL) || strcmp (argv[i], "-MM") == 0)) { /* Don't specify libraries if we won't link, since that would diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index c682850fc12..4112f6369ab 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -4475,7 +4475,7 @@ synth_id_with_class_suffix (preamble, ctxt) { const char *const class_name = IDENTIFIER_POINTER (CLASS_NAME (objc_implementation_context)); - string = (char *) alloca (strlen (preamble) + strlen (class_name) + 3); + string = alloca (strlen (preamble) + strlen (class_name) + 3); sprintf (string, "%s_%s", preamble, IDENTIFIER_POINTER (CLASS_NAME (ctxt))); } @@ -4487,17 +4487,14 @@ synth_id_with_class_suffix (preamble, ctxt) = IDENTIFIER_POINTER (CLASS_NAME (objc_implementation_context)); const char *const class_super_name = IDENTIFIER_POINTER (CLASS_SUPER_NAME (objc_implementation_context)); - string = (char *) alloca (strlen (preamble) - + strlen (class_name) - + strlen (class_super_name) - + 3); + string = alloca (strlen (preamble) + strlen (class_name) + + strlen (class_super_name) + 3); sprintf (string, "%s_%s_%s", preamble, class_name, class_super_name); } else if (TREE_CODE (ctxt) == PROTOCOL_INTERFACE_TYPE) { const char *protocol_name = IDENTIFIER_POINTER (PROTOCOL_NAME (ctxt)); - string - = (char *) alloca (strlen (preamble) + strlen (protocol_name) + 3); + string = alloca (strlen (preamble) + strlen (protocol_name) + 3); sprintf (string, "%s_%s", preamble, protocol_name); } else @@ -4619,7 +4616,7 @@ build_keyword_selector (selector) len++; } - buf = (char *) alloca (len + 1); + buf = alloca (len + 1); /* Start the buffer out as an empty string. */ buf[0] = '\0'; @@ -5433,8 +5430,8 @@ hash_func (sel_name) static void hash_init () { - nst_method_hash_list = (hash *) ggc_calloc (SIZEHASHTABLE, sizeof (hash)); - cls_method_hash_list = (hash *) ggc_calloc (SIZEHASHTABLE, sizeof (hash)); + nst_method_hash_list = ggc_calloc (SIZEHASHTABLE, sizeof (hash)); + cls_method_hash_list = ggc_calloc (SIZEHASHTABLE, sizeof (hash)); } /* WARNING!!!! hash_enter is called with a method, and will peek @@ -5450,7 +5447,7 @@ hash_enter (hashlist, method) hash obj; int slot = hash_func (METHOD_SEL_NAME (method)) % SIZEHASHTABLE; - obj = (hash) ggc_alloc (sizeof (struct hashed_entry)); + obj = ggc_alloc (sizeof (struct hashed_entry)); obj->list = 0; obj->next = hashlist[slot]; obj->key = method; @@ -5484,7 +5481,7 @@ hash_add_attr (entry, value) { attr obj; - obj = (attr) ggc_alloc (sizeof (struct hashed_attribute)); + obj = ggc_alloc (sizeof (struct hashed_attribute)); obj->next = entry->list; obj->value = value; @@ -6273,7 +6270,7 @@ continue_class (class) if (!objc_class_template) build_class_template (); - imp_entry = (struct imp_entry *) ggc_alloc (sizeof (struct imp_entry)); + imp_entry = ggc_alloc (sizeof (struct imp_entry)); imp_entry->next = imp_list; imp_entry->imp_context = class; @@ -6369,7 +6366,7 @@ finish_class (class) { tree decl_specs; const char *class_name = IDENTIFIER_POINTER (CLASS_NAME (class)); - char *string = (char *) alloca (strlen (class_name) + 3); + char *string = alloca (strlen (class_name) + 3); /* extern struct objc_object *_<my_name>; */ @@ -7123,8 +7120,8 @@ really_start_method (method, parmlist) method_slot++; /* Make sure this is big enough for any plausible method label. */ - buf = (char *) alloca (50 + strlen (sel_name) + strlen (class_name) - + (cat_name ? strlen (cat_name) : 0)); + buf = alloca (50 + strlen (sel_name) + strlen (class_name) + + (cat_name ? strlen (cat_name) : 0)); OBJC_GEN_METHOD_LABEL (buf, TREE_CODE (method) == INSTANCE_METHOD_DECL, class_name, cat_name, sel_name, method_slot); @@ -8061,7 +8058,7 @@ dump_interface (fp, chain) declaration is so long that it doesn't fit in the buffer. The code and all the related functions should be rewritten to avoid using fixed size buffers. */ - char *buf = (char *) xmalloc (1024 * 10); + char *buf = xmalloc (1024 * 10); const char *my_name = IDENTIFIER_POINTER (CLASS_NAME (chain)); tree ivar_decls = CLASS_RAW_IVARS (chain); tree nst_methods = CLASS_NST_METHODS (chain); @@ -8187,7 +8184,7 @@ init_objc () gcc_obstack_init (&util_obstack); util_firstobj = (char *) obstack_finish (&util_obstack); - errbuf = (char *) xmalloc (BUFSIZE); + errbuf = xmalloc (BUFSIZE); hash_init (); synth_module_prologue (); } @@ -8367,7 +8364,7 @@ handle_class_ref (chain) tree chain; { const char *name = IDENTIFIER_POINTER (TREE_VALUE (chain)); - char *string = (char *) alloca (strlen (name) + 30); + char *string = alloca (strlen (name) + 30); tree decl; tree exp; @@ -8417,7 +8414,7 @@ handle_impent (impent) const char *const class_name = IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context)); - string = (char *) alloca (strlen (class_name) + 30); + string = alloca (strlen (class_name) + 30); sprintf (string, "%sobjc_class_name_%s", (flag_next_runtime ? "." : "__"), class_name); @@ -8429,7 +8426,7 @@ handle_impent (impent) const char *const class_super_name = IDENTIFIER_POINTER (CLASS_SUPER_NAME (impent->imp_context)); - string = (char *) alloca (strlen (class_name) + string = alloca (strlen (class_name) + strlen (class_super_name) + 30); /* Do the same for categories. Even though no references to diff --git a/gcc/treelang/ChangeLog b/gcc/treelang/ChangeLog index 6157e00431d..16398de9227 100644 --- a/gcc/treelang/ChangeLog +++ b/gcc/treelang/ChangeLog @@ -1,3 +1,7 @@ +2003-07-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * treetree.c: Remove unnecessary casts. + 2003-07-15 Neil Booth <neil@daikokuya.co.uk> * lang-options.h: Remove. diff --git a/gcc/treelang/treetree.c b/gcc/treelang/treetree.c index 2b8fd149b43..8a57e27df15 100644 --- a/gcc/treelang/treetree.c +++ b/gcc/treelang/treetree.c @@ -1124,8 +1124,7 @@ void pushlevel (ignore) int ignore ATTRIBUTE_UNUSED; { - struct binding_level *newlevel - = (struct binding_level *) xmalloc (sizeof (struct binding_level)); + struct binding_level *newlevel = xmalloc (sizeof (struct binding_level)); *newlevel = clear_binding_level; |