From: Nick Clifton Date: Thu, 10 Sep 2009 13:40:44 +0000 (+0000) Subject: Updated soruces in binutils/* to compile cleanly with -Wc++-compat. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3f5e193bd6e036c43af9326d777aed6cfc14fbcb;p=binutils-gdb.git Updated soruces in binutils/* to compile cleanly with -Wc++-compat. * binutils/addr2line.c (slurp_symtab): Fix casts. Introduce variable minisyms to avoid aliasing varning. * binutils/ar.c: Add casts. (normalize): Use name del instead of delete. (display_target_list,display_info_table): Change loop counter variable a to int. * binutils/bucomm.c: Add casts. * binutils/debug.c: Update function to use new names. (struct debug_baseclass): Rename member from virtual to is_virtual. (struct debug_type_s,struct debug_field_s,struct debug_baseclass_s,struct debug_method_s,struct debug_method_variant_s,struct debug_type_s): Rename struct from avoid name collision. * /binutils/debug.h: Use new struct names. * binutils/dwarf.c: Add casts. (free_debug_memory): Change loop counter variable a to int. * binutils/ieee.c: Add casts. (enum ieee_var_kind): Move to top level. (ieee_class_baseclass): Rename parameter virtual to is_virtual. (ieee_class_method_var): Rename variable virtual to is_virtual. * binutils/nm.c: Add casts. * binutils/objcopy.c: Add casts. (copy_archive): Rename variable delete to del. * binutils/objdump.c: Add casts. (dump_dwarf_section): Change loop counter variable i to int. * binutils/prdbg.c: Add casts. (pr_class_baseclass,tg_class_baseclass): Rename parameters virtual to is_virtual. * binutils/readelf.c: Add casts. (struct ia64_unw_table_entry,struct hppa_unw_table_entry): Move to top level. * binutils/size.c: Add casts. * binutils/stabs.c (parse_stab_type, parse_stab_range_type) (parse_stab_cpp_abbrev): Rename parameter from typename to type_name. (parse_stab_baseclasses): Rename variable virtual to is_virtual. * binutils/strings.c: Add casts. * binutils/wrstabs.c (stab_class_baseclass): Rename parameter virtual to is_virtual. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 022cda57339..49e01359463 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,48 @@ +2009-09-10 Martin Thuresson + + Update soruces to compile cleanly with -Wc++-compat: + + * addr2line.c (slurp_symtab): Fix casts. Introduce variable + minisyms to avoid aliasing varning. + * ar.c: Add casts. + (normalize): Use name del instead of delete. + (display_target_list,display_info_table): Change loop counter + variable a to int. + * bucomm.c: Add casts. + * debug.c: Update function to use new names. + (struct debug_baseclass): Rename member from virtual to + is_virtual. + (struct debug_type_s, struct debug_field_s, struct + debug_baseclass_s, struct debug_method_s, struct + debug_method_variant_s, struct debug_type_s): Rename struct from + avoid name collision. + * debug.h: Use new struct names. + * dwarf.c: Add casts. + (free_debug_memory): Change loop counter variable a to int. + * ieee.c: Add casts. + (enum ieee_var_kind): Move to top level. + (ieee_class_baseclass): Rename parameter virtual to is_virtual. + (ieee_class_method_var): Rename variable virtual to is_virtual. + * nm.c: Add casts. + * objcopy.c: Add casts. + (copy_archive): Rename variable delete to del. + * objdump.c: Add casts. + (dump_dwarf_section): Change loop counter variable i to int. + * prdbg.c: Add casts. + (pr_class_baseclass,tg_class_baseclass): Rename parameters virtual + to is_virtual. + * readelf.c: Add casts. + (struct ia64_unw_table_entry,struct hppa_unw_table_entry): Move to + top level. + * size.c: Add casts. + * stabs.c (parse_stab_type, parse_stab_range_type, + (parse_stab_cpp_abbrev): Rename parameter from typename to + type_name. + (parse_stab_baseclasses): Rename variable virtual to is_virtual. + * strings.c: Add casts. + * wrstabs.c (stab_class_baseclass): Rename parameter virtual to + is_virtual. + 2009-09-09 Nick Clifton PR 10478: @@ -828,7 +873,7 @@ Cleanup code related to --identify option. - * binutils/dlltool.c (file scope): Removed globals identify_ms, + * dlltool.c (file scope): Removed globals identify_ms, identify_member_contains_symname_result, identify_dll_name_list_head, and identify_dll_name_list_tail. Renamed existing typedef dll_name_list_type to diff --git a/binutils/addr2line.c b/binutils/addr2line.c index 23643e21ded..54256645545 100644 --- a/binutils/addr2line.c +++ b/binutils/addr2line.c @@ -1,6 +1,6 @@ /* addr2line.c -- convert addresses to line number and function name - Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 - Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2009 Free Software Foundation, Inc. Contributed by Ulrich Lauther This file is part of GNU Binutils. @@ -102,13 +102,14 @@ slurp_symtab (bfd *abfd) { long symcount; unsigned int size; + void *minisyms = &syms; if ((bfd_get_file_flags (abfd) & HAS_SYMS) == 0) return; - symcount = bfd_read_minisymbols (abfd, FALSE, (void *) &syms, &size); + symcount = bfd_read_minisymbols (abfd, FALSE, &minisyms, &size); if (symcount == 0) - symcount = bfd_read_minisymbols (abfd, TRUE /* dynamic */, (void *) &syms, &size); + symcount = bfd_read_minisymbols (abfd, TRUE /* dynamic */, &minisyms, &size); if (symcount < 0) bfd_fatal (bfd_get_filename (abfd)); diff --git a/binutils/ar.c b/binutils/ar.c index 4d6a32516a7..5bffd50a66b 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -332,7 +332,7 @@ normalize (const char *file, bfd *abfd) char *s; /* Space leak. */ - s = xmalloc (abfd->xvec->ar_max_namelen + 1); + s = (char *) xmalloc (abfd->xvec->ar_max_namelen + 1); memcpy (s, filename, abfd->xvec->ar_max_namelen); s[abfd->xvec->ar_max_namelen] = '\0'; filename = s; @@ -372,7 +372,7 @@ main (int argc, char **argv) char c; enum { - none = 0, delete, replace, print_table, + none = 0, del, replace, print_table, print_files, extract, move, quick_append } operation = none; int arg_index; @@ -540,7 +540,7 @@ main (int argc, char **argv) switch (c) { case 'd': - operation = delete; + operation = del; operation_alters_arch = TRUE; break; case 'm': @@ -673,7 +673,7 @@ main (int argc, char **argv) if (counted_name_mode) { - if (operation != extract && operation != delete) + if (operation != extract && operation != del) fatal (_("`N' is only meaningful with the `x' and `d' options.")); counted_name_counter = atoi (argv[arg_index++]); if (counted_name_counter <= 0) @@ -705,7 +705,7 @@ main (int argc, char **argv) map_over_members (arch, extract_file, files, file_count); break; - case delete: + case del: if (files != NULL) delete_members (arch, files); else @@ -843,7 +843,7 @@ static void print_contents (bfd *abfd) { size_t ncopied = 0; - char *cbuf = xmalloc (BUFSIZE); + char *cbuf = (char *) xmalloc (BUFSIZE); struct stat buf; size_t size; if (bfd_stat_arch_elt (abfd, &buf) != 0) @@ -895,7 +895,7 @@ void extract_file (bfd *abfd) { FILE *ostream; - char *cbuf = xmalloc (BUFSIZE); + char *cbuf = (char *) xmalloc (BUFSIZE); size_t nread, tocopy; size_t ncopied = 0; size_t size; @@ -989,7 +989,7 @@ write_archive (bfd *iarch) char *old_name, *new_name; bfd *contents_head = iarch->archive_next; - old_name = xmalloc (strlen (bfd_get_filename (iarch)) + 1); + old_name = (char *) xmalloc (strlen (bfd_get_filename (iarch)) + 1); strcpy (old_name, bfd_get_filename (iarch)); new_name = make_tempname (old_name); diff --git a/binutils/bucomm.c b/binutils/bucomm.c index a0886aad9e1..e006e615bbc 100644 --- a/binutils/bucomm.c +++ b/binutils/bucomm.c @@ -238,7 +238,7 @@ display_target_list (void) { const bfd_target *p = bfd_target_vector[t]; bfd *abfd = bfd_openw (dummy_name, p->name); - enum bfd_architecture a; + int a; printf ("%s\n (header %s, data %s)\n", p->name, endian_string (p->header_byteorder), @@ -284,7 +284,7 @@ display_info_table (int first, int last) int t; int ret = 1; char *dummy_name; - enum bfd_architecture a; + int a; /* Print heading of target names. */ printf ("\n%*s", (int) LONGEST_ARCH, " "); @@ -294,10 +294,11 @@ display_info_table (int first, int last) dummy_name = make_temp_file (NULL); for (a = bfd_arch_obscure + 1; a < bfd_arch_last; a++) - if (strcmp (bfd_printable_arch_mach (a, 0), "UNKNOWN!") != 0) + if (strcmp (bfd_printable_arch_mach ((enum bfd_architecture) a, 0), + "UNKNOWN!") != 0) { printf ("%*s ", (int) LONGEST_ARCH - 1, - bfd_printable_arch_mach (a, 0)); + bfd_printable_arch_mach ((enum bfd_architecture) a, 0)); for (t = first; t < last && bfd_target_vector[t]; t++) { const bfd_target *p = bfd_target_vector[t]; @@ -326,7 +327,7 @@ display_info_table (int first, int last) if (ok) { - if (! bfd_set_arch_mach (abfd, a, 0)) + if (! bfd_set_arch_mach (abfd, (enum bfd_architecture) a, 0)) ok = FALSE; } @@ -461,7 +462,7 @@ template_in_dir (const char *path) if (slash != (char *) NULL) { len = slash - path; - tmpname = xmalloc (len + sizeof (template) + 2); + tmpname = (char *) xmalloc (len + sizeof (template) + 2); memcpy (tmpname, path, len); #ifdef HAVE_DOS_BASED_FILE_SYSTEM @@ -475,7 +476,7 @@ template_in_dir (const char *path) } else { - tmpname = xmalloc (sizeof (template)); + tmpname = (char *) xmalloc (sizeof (template)); len = 0; } @@ -595,7 +596,7 @@ bfd_get_archive_filename (const bfd *abfd) if (curr) free (buf); curr = needed + (needed >> 1); - buf = bfd_malloc (curr); + buf = (char *) bfd_malloc (curr); /* If we can't malloc, fail safe by returning just the file name. This function is only used when building error messages. */ if (!buf) diff --git a/binutils/debug.c b/binutils/debug.c index f96eec9f3e9..ebe63f1f25f 100644 --- a/binutils/debug.c +++ b/binutils/debug.c @@ -1,6 +1,6 @@ /* debug.c -- Handle generic debugging information. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2005, 2007 - Free Software Foundation, Inc. + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2005, 2007, + 2009 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of GNU Binutils. @@ -96,7 +96,7 @@ struct debug_file /* A type. */ -struct debug_type +struct debug_type_s { /* Kind of type. */ enum debug_type_kind kind; @@ -118,11 +118,11 @@ struct debug_type /* DEBUG_KIND_ENUM. */ struct debug_enum_type *kenum; /* DEBUG_KIND_POINTER. */ - struct debug_type *kpointer; + struct debug_type_s *kpointer; /* DEBUG_KIND_FUNCTION. */ struct debug_function_type *kfunction; /* DEBUG_KIND_REFERENCE. */ - struct debug_type *kreference; + struct debug_type_s *kreference; /* DEBUG_KIND_RANGE. */ struct debug_range_type *krange; /* DEBUG_KIND_ARRAY. */ @@ -134,9 +134,9 @@ struct debug_type /* DEBUG_KIND_METHOD. */ struct debug_method_type *kmethod; /* DEBUG_KIND_CONST. */ - struct debug_type *kconst; + struct debug_type_s *kconst; /* DEBUG_KIND_VOLATILE. */ - struct debug_type *kvolatile; + struct debug_type_s *kvolatile; /* DEBUG_KIND_NAMED, DEBUG_KIND_TAGGED. */ struct debug_named_type *knamed; } u; @@ -271,12 +271,12 @@ struct debug_named_type /* A field in a struct or union. */ -struct debug_field +struct debug_field_s { /* Name of the field. */ const char *name; /* Type of the field. */ - struct debug_type *type; + struct debug_type_s *type; /* Visibility of the field. */ enum debug_visibility visibility; /* Whether this is a static member. */ @@ -301,37 +301,37 @@ struct debug_field /* A base class for an object. */ -struct debug_baseclass +struct debug_baseclass_s { /* Type of the base class. */ - struct debug_type *type; + struct debug_type_s *type; /* Bit position of the base class in the object. */ unsigned int bitpos; /* Whether the base class is virtual. */ - bfd_boolean virtual; + bfd_boolean is_virtual; /* Visibility of the base class. */ enum debug_visibility visibility; }; /* A method of an object. */ -struct debug_method +struct debug_method_s { /* The name of the method. */ const char *name; /* A NULL terminated array of different types of variants. */ - struct debug_method_variant **variants; + struct debug_method_variant_s **variants; }; /* The variants of a method function of an object. These indicate which method to run. */ -struct debug_method_variant +struct debug_method_variant_s { /* The physical name of the function. */ const char *physname; /* The type of the function. */ - struct debug_type *type; + struct debug_type_s *type; /* The visibility of the function. */ enum debug_visibility visibility; /* Whether the function is const. */ @@ -343,7 +343,7 @@ struct debug_method_variant /* If voffset is VOFFSET_STATIC_METHOD, this is a static method. */ #define VOFFSET_STATIC_METHOD ((bfd_vma) -1) /* Context of a virtual method function. */ - struct debug_type *context; + struct debug_type_s *context; }; /* A variable. This is the information we keep for a variable object. @@ -500,9 +500,9 @@ struct debug_name union { /* DEBUG_OBJECT_TYPE. */ - struct debug_type *type; + struct debug_type_s *type; /* DEBUG_OBJECT_TAG. */ - struct debug_type *tag; + struct debug_type_s *tag; /* DEBUG_OBJECT_VARIABLE. */ struct debug_variable *variable; /* DEBUG_OBJECT_FUNCTION. */ @@ -524,7 +524,7 @@ struct debug_class_id /* Next ID number. */ struct debug_class_id *next; /* The type with the ID. */ - struct debug_type *type; + struct debug_type_s *type; /* The tag; NULL if no tag. */ const char *tag; }; @@ -537,8 +537,8 @@ struct debug_type_compare_list /* Next type on list. */ struct debug_type_compare_list *next; /* The types we are comparing. */ - struct debug_type *t1; - struct debug_type *t2; + struct debug_type_s *t1; + struct debug_type_s *t2; }; /* During debug_get_real_type, a linked list of these structures is @@ -549,7 +549,7 @@ struct debug_type_real_list /* Next type on list. */ struct debug_type_real_list *next; /* The type we are checking. */ - struct debug_type *t; + struct debug_type_s *t; }; /* Local functions. */ @@ -561,19 +561,19 @@ static struct debug_name *debug_add_to_namespace static struct debug_name *debug_add_to_current_namespace (struct debug_handle *, const char *, enum debug_object_kind, enum debug_object_linkage); -static struct debug_type *debug_make_type +static struct debug_type_s *debug_make_type (struct debug_handle *, enum debug_type_kind, unsigned int); -static struct debug_type *debug_get_real_type +static struct debug_type_s *debug_get_real_type (void *, debug_type, struct debug_type_real_list *); static bfd_boolean debug_write_name (struct debug_handle *, const struct debug_write_fns *, void *, struct debug_name *); static bfd_boolean debug_write_type (struct debug_handle *, const struct debug_write_fns *, void *, - struct debug_type *, struct debug_name *); + struct debug_type_s *, struct debug_name *); static bfd_boolean debug_write_class_type (struct debug_handle *, const struct debug_write_fns *, void *, - struct debug_type *, const char *); + struct debug_type_s *, const char *); static bfd_boolean debug_write_function (struct debug_handle *, const struct debug_write_fns *, void *, const char *, enum debug_object_linkage, struct debug_function *); @@ -583,11 +583,11 @@ static bfd_boolean debug_write_block static bfd_boolean debug_write_linenos (struct debug_handle *, const struct debug_write_fns *, void *, bfd_vma); static bfd_boolean debug_set_class_id - (struct debug_handle *, const char *, struct debug_type *); + (struct debug_handle *, const char *, struct debug_type_s *); static bfd_boolean debug_type_samep - (struct debug_handle *, struct debug_type *, struct debug_type *); + (struct debug_handle *, struct debug_type_s *, struct debug_type_s *); static bfd_boolean debug_class_type_samep - (struct debug_handle *, struct debug_type *, struct debug_type *); + (struct debug_handle *, struct debug_type_s *, struct debug_type_s *); /* Issue an error message. */ @@ -1172,13 +1172,13 @@ debug_record_variable (void *handle, const char *name, debug_type type, /* Make a type with a given kind and size. */ -static struct debug_type * +static struct debug_type_s * debug_make_type (struct debug_handle *info ATTRIBUTE_UNUSED, enum debug_type_kind kind, unsigned int size) { - struct debug_type *t; + struct debug_type_s *t; - t = (struct debug_type *) xmalloc (sizeof *t); + t = (struct debug_type_s *) xmalloc (sizeof *t); memset (t, 0, sizeof *t); t->kind = kind; @@ -1194,7 +1194,7 @@ debug_type debug_make_indirect_type (void *handle, debug_type *slot, const char *tag) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; struct debug_indirect_type *i; t = debug_make_type (info, DEBUG_KIND_INDIRECT, 0); @@ -1229,7 +1229,7 @@ debug_type debug_make_int_type (void *handle, unsigned int size, bfd_boolean unsignedp) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; t = debug_make_type (info, DEBUG_KIND_INT, size); if (t == NULL) @@ -1281,7 +1281,7 @@ debug_make_struct_type (void *handle, bfd_boolean structp, bfd_vma size, debug_field *fields) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; struct debug_class_type *c; t = debug_make_type (info, @@ -1314,7 +1314,7 @@ debug_make_object_type (void *handle, bfd_boolean structp, bfd_vma size, bfd_boolean ownvptr) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; struct debug_class_type *c; t = debug_make_type (info, @@ -1347,7 +1347,7 @@ debug_make_enum_type (void *handle, const char **names, bfd_signed_vma *values) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; struct debug_enum_type *e; t = debug_make_type (info, DEBUG_KIND_ENUM, 0); @@ -1371,7 +1371,7 @@ debug_type debug_make_pointer_type (void *handle, debug_type type) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; if (type == NULL) return DEBUG_TYPE_NULL; @@ -1398,7 +1398,7 @@ debug_make_function_type (void *handle, debug_type type, debug_type *arg_types, bfd_boolean varargs) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; struct debug_function_type *f; if (type == NULL) @@ -1426,7 +1426,7 @@ debug_type debug_make_reference_type (void *handle, debug_type type) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; if (type == NULL) return DEBUG_TYPE_NULL; @@ -1447,7 +1447,7 @@ debug_make_range_type (void *handle, debug_type type, bfd_signed_vma lower, bfd_signed_vma upper) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; struct debug_range_type *r; if (type == NULL) @@ -1481,7 +1481,7 @@ debug_make_array_type (void *handle, debug_type element_type, bfd_signed_vma upper, bfd_boolean stringp) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; struct debug_array_type *a; if (element_type == NULL || range_type == NULL) @@ -1513,7 +1513,7 @@ debug_type debug_make_set_type (void *handle, debug_type type, bfd_boolean bitstringp) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; struct debug_set_type *s; if (type == NULL) @@ -1544,7 +1544,7 @@ debug_make_offset_type (void *handle, debug_type base_type, debug_type target_type) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; struct debug_offset_type *o; if (base_type == NULL || target_type == NULL) @@ -1575,7 +1575,7 @@ debug_make_method_type (void *handle, debug_type return_type, bfd_boolean varargs) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; struct debug_method_type *m; if (return_type == NULL) @@ -1604,7 +1604,7 @@ debug_type debug_make_const_type (void *handle, debug_type type) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; if (type == NULL) return DEBUG_TYPE_NULL; @@ -1624,7 +1624,7 @@ debug_type debug_make_volatile_type (void *handle, debug_type type) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; if (type == NULL) return DEBUG_TYPE_NULL; @@ -1646,7 +1646,7 @@ debug_make_undefined_tagged_type (void *handle, const char *name, enum debug_type_kind kind) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; if (name == NULL) return DEBUG_TYPE_NULL; @@ -1680,17 +1680,17 @@ debug_make_undefined_tagged_type (void *handle, const char *name, debug_baseclass debug_make_baseclass (void *handle ATTRIBUTE_UNUSED, debug_type type, - bfd_vma bitpos, bfd_boolean virtual, + bfd_vma bitpos, bfd_boolean is_virtual, enum debug_visibility visibility) { - struct debug_baseclass *b; + struct debug_baseclass_s *b; - b = (struct debug_baseclass *) xmalloc (sizeof *b); + b = (struct debug_baseclass_s *) xmalloc (sizeof *b); memset (b, 0, sizeof *b); b->type = type; b->bitpos = bitpos; - b->virtual = virtual; + b->is_virtual = is_virtual; b->visibility = visibility; return b; @@ -1707,9 +1707,9 @@ debug_make_field (void *handle ATTRIBUTE_UNUSED, const char *name, debug_type type, bfd_vma bitpos, bfd_vma bitsize, enum debug_visibility visibility) { - struct debug_field *f; + struct debug_field_s *f; - f = (struct debug_field *) xmalloc (sizeof *f); + f = (struct debug_field_s *) xmalloc (sizeof *f); memset (f, 0, sizeof *f); f->name = name; @@ -1733,9 +1733,9 @@ debug_make_static_member (void *handle ATTRIBUTE_UNUSED, const char *name, debug_type type, const char *physname, enum debug_visibility visibility) { - struct debug_field *f; + struct debug_field_s *f; - f = (struct debug_field *) xmalloc (sizeof *f); + f = (struct debug_field_s *) xmalloc (sizeof *f); memset (f, 0, sizeof *f); f->name = name; @@ -1754,9 +1754,9 @@ debug_method debug_make_method (void *handle ATTRIBUTE_UNUSED, const char *name, debug_method_variant *variants) { - struct debug_method *m; + struct debug_method_s *m; - m = (struct debug_method *) xmalloc (sizeof *m); + m = (struct debug_method_s *) xmalloc (sizeof *m); memset (m, 0, sizeof *m); m->name = name; @@ -1781,9 +1781,9 @@ debug_make_method_variant (void *handle ATTRIBUTE_UNUSED, bfd_boolean constp, bfd_boolean volatilep, bfd_vma voffset, debug_type context) { - struct debug_method_variant *m; + struct debug_method_variant_s *m; - m = (struct debug_method_variant *) xmalloc (sizeof *m); + m = (struct debug_method_variant_s *) xmalloc (sizeof *m); memset (m, 0, sizeof *m); m->physname = physname; @@ -1807,9 +1807,9 @@ debug_make_static_method_variant (void *handle ATTRIBUTE_UNUSED, enum debug_visibility visibility, bfd_boolean constp, bfd_boolean volatilep) { - struct debug_method_variant *m; + struct debug_method_variant_s *m; - m = (struct debug_method_variant *) xmalloc (sizeof *m); + m = (struct debug_method_variant_s *) xmalloc (sizeof *m); memset (m, 0, sizeof *m); m->physname = physname; @@ -1828,7 +1828,7 @@ debug_type debug_name_type (void *handle, const char *name, debug_type type) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; struct debug_named_type *n; struct debug_name *nm; @@ -1874,7 +1874,7 @@ debug_type debug_tag_type (void *handle, const char *name, debug_type type) { struct debug_handle *info = (struct debug_handle *) handle; - struct debug_type *t; + struct debug_type_s *t; struct debug_named_type *n; struct debug_name *nm; @@ -2030,7 +2030,7 @@ debug_find_tagged_type (void *handle, const char *name, /* Get a base type. We build a linked list on the stack to avoid crashing if the type is defined circularly. */ -static struct debug_type * +static struct debug_type_s * debug_get_real_type (void *handle, debug_type type, struct debug_type_real_list *list) { @@ -2415,7 +2415,7 @@ debug_write_name (struct debug_handle *info, static bfd_boolean debug_write_type (struct debug_handle *info, const struct debug_write_fns *fns, void *fhandle, - struct debug_type *type, struct debug_name *name) + struct debug_type_s *type, struct debug_name *name) { unsigned int i; int is; @@ -2434,7 +2434,7 @@ debug_write_type (struct debug_handle *info, return (*fns->typedef_type) (fhandle, type->u.knamed->name->name); else { - struct debug_type *real; + struct debug_type_s *real; unsigned int id; real = debug_get_real_type ((void *) info, type, NULL); @@ -2531,7 +2531,7 @@ debug_write_type (struct debug_handle *info, { for (i = 0; type->u.kclass->fields[i] != NULL; i++) { - struct debug_field *f; + struct debug_field_s *f; f = type->u.kclass->fields[i]; if (! debug_write_type (info, fns, fhandle, f->type, @@ -2660,11 +2660,11 @@ debug_write_type (struct debug_handle *info, static bfd_boolean debug_write_class_type (struct debug_handle *info, const struct debug_write_fns *fns, void *fhandle, - struct debug_type *type, const char *tag) + struct debug_type_s *type, const char *tag) { unsigned int i; unsigned int id; - struct debug_type *vptrbase; + struct debug_type_s *vptrbase; if (type->u.kclass == NULL) { @@ -2713,7 +2713,7 @@ debug_write_class_type (struct debug_handle *info, { for (i = 0; type->u.kclass->fields[i] != NULL; i++) { - struct debug_field *f; + struct debug_field_s *f; f = type->u.kclass->fields[i]; if (! debug_write_type (info, fns, fhandle, f->type, @@ -2739,13 +2739,13 @@ debug_write_class_type (struct debug_handle *info, { for (i = 0; type->u.kclass->baseclasses[i] != NULL; i++) { - struct debug_baseclass *b; + struct debug_baseclass_s *b; b = type->u.kclass->baseclasses[i]; if (! debug_write_type (info, fns, fhandle, b->type, (struct debug_name *) NULL)) return FALSE; - if (! (*fns->class_baseclass) (fhandle, b->bitpos, b->virtual, + if (! (*fns->class_baseclass) (fhandle, b->bitpos, b->is_virtual, b->visibility)) return FALSE; } @@ -2755,7 +2755,7 @@ debug_write_class_type (struct debug_handle *info, { for (i = 0; type->u.kclass->methods[i] != NULL; i++) { - struct debug_method *m; + struct debug_method_s *m; unsigned int j; m = type->u.kclass->methods[i]; @@ -2763,7 +2763,7 @@ debug_write_class_type (struct debug_handle *info, return FALSE; for (j = 0; m->variants[j] != NULL; j++) { - struct debug_method_variant *v; + struct debug_method_variant_s *v; v = m->variants[j]; if (v->context != NULL) @@ -2935,7 +2935,7 @@ debug_write_linenos (struct debug_handle *info, static bfd_boolean debug_set_class_id (struct debug_handle *info, const char *tag, - struct debug_type *type) + struct debug_type_s *type) { struct debug_class_type *c; struct debug_class_id *l; @@ -2996,8 +2996,8 @@ debug_set_class_id (struct debug_handle *info, const char *tag, tags and the like. */ static bfd_boolean -debug_type_samep (struct debug_handle *info, struct debug_type *t1, - struct debug_type *t2) +debug_type_samep (struct debug_handle *info, struct debug_type_s *t1, + struct debug_type_s *t2) { struct debug_type_compare_list *l; struct debug_type_compare_list top; @@ -3133,7 +3133,7 @@ debug_type_samep (struct debug_handle *info, struct debug_type *t1, ret = TRUE; else { - struct debug_type **a1, **a2; + struct debug_type_s **a1, **a2; a1 = t1->u.kfunction->arg_types; a2 = t2->u.kfunction->arg_types; @@ -3191,7 +3191,7 @@ debug_type_samep (struct debug_handle *info, struct debug_type *t1, ret = TRUE; else { - struct debug_type **a1, **a2; + struct debug_type_s **a1, **a2; a1 = t1->u.kmethod->arg_types; a2 = t2->u.kmethod->arg_types; @@ -3231,8 +3231,8 @@ debug_type_samep (struct debug_handle *info, struct debug_type *t1, debug_type_samep. */ static bfd_boolean -debug_class_type_samep (struct debug_handle *info, struct debug_type *t1, - struct debug_type *t2) +debug_class_type_samep (struct debug_handle *info, struct debug_type_s *t1, + struct debug_type_s *t2) { struct debug_class_type *c1, *c2; @@ -3247,13 +3247,13 @@ debug_class_type_samep (struct debug_handle *info, struct debug_type *t1, if (c1->fields != NULL) { - struct debug_field **pf1, **pf2; + struct debug_field_s **pf1, **pf2; for (pf1 = c1->fields, pf2 = c2->fields; *pf1 != NULL && *pf2 != NULL; pf1++, pf2++) { - struct debug_field *f1, *f2; + struct debug_field_s *f1, *f2; f1 = *pf1; f2 = *pf2; @@ -3296,18 +3296,18 @@ debug_class_type_samep (struct debug_handle *info, struct debug_type *t1, if (c1->baseclasses != NULL) { - struct debug_baseclass **pb1, **pb2; + struct debug_baseclass_s **pb1, **pb2; for (pb1 = c1->baseclasses, pb2 = c2->baseclasses; *pb1 != NULL && *pb2 != NULL; ++pb1, ++pb2) { - struct debug_baseclass *b1, *b2; + struct debug_baseclass_s *b1, *b2; b1 = *pb1; b2 = *pb2; if (b1->bitpos != b2->bitpos - || b1->virtual != b2->virtual + || b1->is_virtual != b2->is_virtual || b1->visibility != b2->visibility || ! debug_type_samep (info, b1->type, b2->type)) return FALSE; @@ -3318,13 +3318,13 @@ debug_class_type_samep (struct debug_handle *info, struct debug_type *t1, if (c1->methods != NULL) { - struct debug_method **pm1, **pm2; + struct debug_method_s **pm1, **pm2; for (pm1 = c1->methods, pm2 = c2->methods; *pm1 != NULL && *pm2 != NULL; ++pm1, ++pm2) { - struct debug_method *m1, *m2; + struct debug_method_s *m1, *m2; m1 = *pm1; m2 = *pm2; @@ -3334,13 +3334,13 @@ debug_class_type_samep (struct debug_handle *info, struct debug_type *t1, return FALSE; if (m1->variants == NULL) { - struct debug_method_variant **pv1, **pv2; + struct debug_method_variant_s **pv1, **pv2; for (pv1 = m1->variants, pv2 = m2->variants; *pv1 != NULL && *pv2 != NULL; ++pv1, ++pv2) { - struct debug_method_variant *v1, *v2; + struct debug_method_variant_s *v1, *v2; v1 = *pv1; v2 = *pv2; diff --git a/binutils/debug.h b/binutils/debug.h index 8d06830b5af..1846119b789 100644 --- a/binutils/debug.h +++ b/binutils/debug.h @@ -1,5 +1,6 @@ /* debug.h -- Describe generic debugging information. - Copyright 1995, 1996, 2002, 2003, 2005, 2007 Free Software Foundation, Inc. + Copyright 1995, 1996, 2002, 2003, 2005, 2007, 2009 + Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of GNU Binutils. @@ -132,32 +133,32 @@ enum debug_visibility /* A type. */ -typedef struct debug_type *debug_type; +typedef struct debug_type_s *debug_type; #define DEBUG_TYPE_NULL ((debug_type) NULL) /* A field in a struct or union. */ -typedef struct debug_field *debug_field; +typedef struct debug_field_s *debug_field; #define DEBUG_FIELD_NULL ((debug_field) NULL) /* A base class for an object. */ -typedef struct debug_baseclass *debug_baseclass; +typedef struct debug_baseclass_s *debug_baseclass; #define DEBUG_BASECLASS_NULL ((debug_baseclass) NULL) /* A method of an object. */ -typedef struct debug_method *debug_method; +typedef struct debug_method_s *debug_method; #define DEBUG_METHOD_NULL ((debug_method) NULL) /* The arguments to a method function of an object. These indicate which method to run. */ -typedef struct debug_method_variant *debug_method_variant; +typedef struct debug_method_variant_s *debug_method_variant; #define DEBUG_METHOD_VARIANT_NULL ((debug_method_variant) NULL) diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 6c9a1a6fa7e..5eeef088911 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -464,7 +464,7 @@ add_abbrev (unsigned long number, unsigned long tag, int children) { abbrev_entry *entry; - entry = malloc (sizeof (*entry)); + entry = (abbrev_entry *) malloc (sizeof (*entry)); if (entry == NULL) /* ugg */ @@ -490,7 +490,7 @@ add_abbrev_attr (unsigned long attribute, unsigned long form) { abbrev_attr *attr; - attr = malloc (sizeof (*attr)); + attr = (abbrev_attr *) malloc (sizeof (*attr)); if (attr == NULL) /* ugg */ @@ -1334,11 +1334,11 @@ read_and_display_attr_value (unsigned long attribute, if (max == 0 || num >= max) { max += 1024; - debug_info_p->loc_offsets - = xcrealloc (debug_info_p->loc_offsets, + debug_info_p->loc_offsets = (long unsigned int *) + xcrealloc (debug_info_p->loc_offsets, max, sizeof (*debug_info_p->loc_offsets)); - debug_info_p->have_frame_base - = xcrealloc (debug_info_p->have_frame_base, + debug_info_p->have_frame_base = (int *) + xcrealloc (debug_info_p->have_frame_base, max, sizeof (*debug_info_p->have_frame_base)); debug_info_p->max_loc_offsets = max; } @@ -1363,8 +1363,8 @@ read_and_display_attr_value (unsigned long attribute, if (max == 0 || num >= max) { max += 1024; - debug_info_p->range_lists - = xcrealloc (debug_info_p->range_lists, + debug_info_p->range_lists = (long unsigned int *) + xcrealloc (debug_info_p->range_lists, max, sizeof (*debug_info_p->range_lists)); debug_info_p->max_range_lists = max; } @@ -1858,8 +1858,8 @@ process_debug_info (struct dwarf_section *section, } /* Then allocate an array to hold the information. */ - debug_information = cmalloc (num_units, - sizeof (* debug_information)); + debug_information = (debug_info *) cmalloc (num_units, + sizeof (* debug_information)); if (debug_information == NULL) { error (_("Not enough memory for a debug info array of %u entries"), @@ -2524,7 +2524,8 @@ display_debug_lines_decoded (struct dwarf_section *section, } /* Go through the directory table again to save the directories. */ - directory_table = xmalloc (n_directories * sizeof (unsigned char *)); + directory_table = (unsigned char **) + xmalloc (n_directories * sizeof (unsigned char *)); i = 0; while (*ptr_directory_table != 0) @@ -2562,7 +2563,7 @@ display_debug_lines_decoded (struct dwarf_section *section, } /* Go through the file table again to save the strings. */ - file_table = xmalloc (n_files * sizeof (File_Entry)); + file_table = (File_Entry *) xmalloc (n_files * sizeof (File_Entry)); i = 0; while (*ptr_file_name_table != 0) @@ -2782,7 +2783,7 @@ display_debug_lines_decoded (struct dwarf_section *section, if ((fileNameLength > MAX_FILENAME_LENGTH) && (!do_wide)) { - newFileName = xmalloc (MAX_FILENAME_LENGTH + 1); + newFileName = (char *) xmalloc (MAX_FILENAME_LENGTH + 1); /* Truncate file name */ strncpy (newFileName, fileName + fileNameLength - MAX_FILENAME_LENGTH, @@ -2790,7 +2791,7 @@ display_debug_lines_decoded (struct dwarf_section *section, } else { - newFileName = xmalloc (fileNameLength + 1); + newFileName = (char *) xmalloc (fileNameLength + 1); strncpy (newFileName, fileName, fileNameLength + 1); } @@ -2979,7 +2980,7 @@ display_debug_macinfo (struct dwarf_section *section, unsigned int lineno; const char *string; - op = *curr; + op = (enum dwarf_macinfo_record_type) *curr; curr++; switch (op) @@ -3500,8 +3501,8 @@ struct range_entry static int range_entry_compar (const void *ap, const void *bp) { - const struct range_entry *a_re = ap; - const struct range_entry *b_re = bp; + const struct range_entry *a_re = (const struct range_entry *) ap; + const struct range_entry *b_re = (const struct range_entry *) bp; const unsigned long a = a_re->ranges_offset; const unsigned long b = b_re->ranges_offset; @@ -3542,7 +3543,8 @@ display_debug_ranges (struct dwarf_section *section, if (num_range_list == 0) error (_("No range lists in .debug_info section!\n")); - range_entries = xmalloc (sizeof (*range_entries) * num_range_list); + range_entries = (struct range_entry *) + xmalloc (sizeof (*range_entries) * num_range_list); range_entry_fill = range_entries; for (i = 0; i < num_debug_info_entries; i++) @@ -3693,8 +3695,9 @@ frame_need_space (Frame_Chunk *fc, unsigned int reg) return -1; fc->ncols = reg + 1; - fc->col_type = xcrealloc (fc->col_type, fc->ncols, sizeof (short int)); - fc->col_offset = xcrealloc (fc->col_offset, fc->ncols, sizeof (int)); + fc->col_type = (short int *) xcrealloc (fc->col_type, fc->ncols, + sizeof (short int)); + fc->col_offset = (int *) xcrealloc (fc->col_offset, fc->ncols, sizeof (int)); while (prev < fc->ncols) { @@ -3928,15 +3931,15 @@ display_debug_frames (struct dwarf_section *section, { int version; - fc = xmalloc (sizeof (Frame_Chunk)); + fc = (Frame_Chunk *) xmalloc (sizeof (Frame_Chunk)); memset (fc, 0, sizeof (Frame_Chunk)); fc->next = chunks; chunks = fc; fc->chunk_start = saved_start; fc->ncols = 0; - fc->col_type = xmalloc (sizeof (short int)); - fc->col_offset = xmalloc (sizeof (int)); + fc->col_type = (short int *) xmalloc (sizeof (short int)); + fc->col_offset = (int *) xmalloc (sizeof (int)); frame_need_space (fc, max_regs - 1); version = *start++; @@ -4059,8 +4062,8 @@ display_debug_frames (struct dwarf_section *section, warn ("Invalid CIE pointer %#08lx in FDE at %#08lx\n", cie_id, (unsigned long)(saved_start - section_start)); fc->ncols = 0; - fc->col_type = xmalloc (sizeof (short int)); - fc->col_offset = xmalloc (sizeof (int)); + fc->col_type = (short int *) xmalloc (sizeof (short int)); + fc->col_offset = (int *) xmalloc (sizeof (int)); frame_need_space (fc, max_regs - 1); cie = fc; fc->augmentation = ""; @@ -4069,8 +4072,8 @@ display_debug_frames (struct dwarf_section *section, else { fc->ncols = cie->ncols; - fc->col_type = xcmalloc (fc->ncols, sizeof (short int)); - fc->col_offset = xcmalloc (fc->ncols, sizeof (int)); + fc->col_type = (short int *) xcmalloc (fc->ncols, sizeof (short int)); + fc->col_offset = (int *) xcmalloc (fc->ncols, sizeof (int)); memcpy (fc->col_type, cie->col_type, fc->ncols * sizeof (short int)); memcpy (fc->col_offset, cie->col_offset, fc->ncols * sizeof (int)); fc->augmentation = cie->augmentation; @@ -4444,10 +4447,11 @@ display_debug_frames (struct dwarf_section *section, case DW_CFA_remember_state: if (! do_debug_frames_interp) printf (" DW_CFA_remember_state\n"); - rs = xmalloc (sizeof (Frame_Chunk)); + rs = (Frame_Chunk *) xmalloc (sizeof (Frame_Chunk)); rs->ncols = fc->ncols; - rs->col_type = xcmalloc (rs->ncols, sizeof (short int)); - rs->col_offset = xcmalloc (rs->ncols, sizeof (int)); + rs->col_type = (short int *) xcmalloc (rs->ncols, + sizeof (short int)); + rs->col_offset = (int *) xcmalloc (rs->ncols, sizeof (int)); memcpy (rs->col_type, fc->col_type, rs->ncols); memcpy (rs->col_offset, fc->col_offset, rs->ncols * sizeof (int)); rs->next = remembered_state; @@ -4726,12 +4730,12 @@ warn (const char *message, ...) void free_debug_memory (void) { - enum dwarf_section_display_enum i; + unsigned int i; free_abbrevs (); for (i = 0; i < max; i++) - free_debug_section (i); + free_debug_section ((enum dwarf_section_display_enum) i); if (debug_information != NULL) { diff --git a/binutils/ieee.c b/binutils/ieee.c index 7755478d31f..fd8374b335d 100644 --- a/binutils/ieee.c +++ b/binutils/ieee.c @@ -59,6 +59,16 @@ struct ieee_blockstack /* This structure holds information for a variable. */ +enum ieee_var_kind + { + IEEE_UNKNOWN, + IEEE_EXTERNAL, + IEEE_GLOBAL, + IEEE_STATIC, + IEEE_LOCAL, + IEEE_FUNCTION + }; + struct ieee_var { /* Start of name. */ @@ -70,15 +80,7 @@ struct ieee_var /* Slot if we make an indirect type. */ debug_type *pslot; /* Kind of variable or function. */ - enum - { - IEEE_UNKNOWN, - IEEE_EXTERNAL, - IEEE_GLOBAL, - IEEE_STATIC, - IEEE_LOCAL, - IEEE_FUNCTION - } kind; + enum ieee_var_kind kind; }; /* This structure holds all the variables. */ @@ -5451,7 +5453,7 @@ ieee_pointer_type (void *p) if (! localp) { - m = ieee_get_modified_info (p, indx); + m = ieee_get_modified_info ((struct ieee_handle *) p, indx); if (m == NULL) return FALSE; @@ -5509,7 +5511,7 @@ ieee_function_type (void *p, int argcount, bfd_boolean varargs) m = NULL; if (argcount < 0 && ! localp) { - m = ieee_get_modified_info (p, retindx); + m = ieee_get_modified_info ((struct ieee_handle *) p, retindx); if (m == NULL) return FALSE; @@ -6199,7 +6201,7 @@ ieee_class_static_member (void *p, const char *name, const char *physname, /* Add a base class to a class. */ static bfd_boolean -ieee_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean virtual, +ieee_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean is_virtual, enum debug_visibility visibility) { struct ieee_handle *info = (struct ieee_handle *) p; @@ -6225,7 +6227,7 @@ ieee_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean virtual, class. The stabs debugging reader will create a field named _vb$CLASS for a virtual base class, so we just use that. FIXME: we should not depend upon a detail of stabs debugging. */ - if (virtual) + if (is_virtual) { fname = (char *) xmalloc (strlen (bname) + sizeof "_vb$"); sprintf (fname, "_vb$%s", bname); @@ -6293,7 +6295,7 @@ ieee_class_method_var (struct ieee_handle *info, const char *physname, { unsigned int flags; unsigned int nindx; - bfd_boolean virtual; + bfd_boolean is_virtual; /* We don't need the type of the method. An IEEE consumer which wants the type must track down the function by the physical name @@ -6323,18 +6325,18 @@ ieee_class_method_var (struct ieee_handle *info, const char *physname, nindx = info->type_stack->type.classdef->indx; - virtual = context || voffset > 0; + is_virtual = context || voffset > 0; if (! ieee_change_buffer (info, &info->type_stack->type.classdef->pmiscbuf) - || ! ieee_write_asn (info, nindx, virtual ? 'v' : 'm') + || ! ieee_write_asn (info, nindx, is_virtual ? 'v' : 'm') || ! ieee_write_asn (info, nindx, flags) || ! ieee_write_atn65 (info, nindx, info->type_stack->type.classdef->method) || ! ieee_write_atn65 (info, nindx, physname)) return FALSE; - if (virtual) + if (is_virtual) { if (voffset > info->type_stack->type.classdef->voffset) info->type_stack->type.classdef->voffset = voffset; diff --git a/binutils/nm.c b/binutils/nm.c index 5139471d03f..c838b0a2b03 100644 --- a/binutils/nm.c +++ b/binutils/nm.c @@ -672,7 +672,7 @@ sort_symbols_by_size (bfd *abfd, bfd_boolean dynamic, void *minisyms, /* We are going to return a special set of symbols and sizes to print. */ - symsizes = xmalloc (symcount * sizeof (struct size_sym)); + symsizes = (struct size_sym *) xmalloc (symcount * sizeof (struct size_sym)); *symsizesp = symsizes; /* Note that filter_symbols has already removed all absolute and @@ -773,7 +773,7 @@ get_relocs (bfd *abfd, asection *sec, void *dataarg) if (relsize < 0) bfd_fatal (bfd_get_filename (abfd)); - *data->relocs = xmalloc (relsize); + *data->relocs = (arelent **) xmalloc (relsize); *data->relcount = bfd_canonicalize_reloc (abfd, sec, *data->relocs, data->syms); if (*data->relcount < 0) @@ -828,7 +828,7 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd) symsize = bfd_get_symtab_upper_bound (abfd); if (symsize < 0) bfd_fatal (bfd_get_filename (abfd)); - syms = xmalloc (symsize); + syms = (asymbol **) xmalloc (symsize); symcount = bfd_canonicalize_symtab (abfd, syms); if (symcount < 0) bfd_fatal (bfd_get_filename (abfd)); @@ -865,9 +865,9 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd) seccount = bfd_count_sections (abfd); - secs = xmalloc (seccount * sizeof *secs); - relocs = xmalloc (seccount * sizeof *relocs); - relcount = xmalloc (seccount * sizeof *relcount); + secs = (asection **) xmalloc (seccount * sizeof *secs); + relocs = (arelent ***) xmalloc (seccount * sizeof *relocs); + relcount = (long *) xmalloc (seccount * sizeof *relcount); info.secs = secs; info.relocs = relocs; @@ -1025,18 +1025,18 @@ display_rel_file (bfd *abfd, bfd *archive_bfd) if (dynamic) { dyn_count = symcount; - dyn_syms = minisyms; + dyn_syms = (asymbol **) minisyms; } else { long storage = bfd_get_dynamic_symtab_upper_bound (abfd); static_count = symcount; - static_syms = minisyms; + static_syms = (asymbol **) minisyms; if (storage > 0) { - dyn_syms = xmalloc (storage); + dyn_syms = (asymbol **) xmalloc (storage); dyn_count = bfd_canonicalize_dynamic_symtab (abfd, dyn_syms); if (dyn_count < 0) bfd_fatal (bfd_get_filename (abfd)); @@ -1051,7 +1051,7 @@ display_rel_file (bfd *abfd, bfd *archive_bfd) long i; new_mini = xmalloc ((symcount + synth_count + 1) * sizeof (*symp)); - symp = new_mini; + symp = (asymbol **) new_mini; memcpy (symp, minisyms, symcount * sizeof (*symp)); symp += symcount; for (i = 0; i < synth_count; i++) diff --git a/binutils/objcopy.c b/binutils/objcopy.c index b213132c791..2048827f8e1 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -640,7 +640,7 @@ parse_flags (const char *s) { char *copy; - copy = xmalloc (len + 1); + copy = (char *) xmalloc (len + 1); strncpy (copy, s, len); copy[len] = '\0'; non_fatal (_("unrecognized section flag `%s'"), copy); @@ -669,7 +669,7 @@ find_section_list (const char *name, bfd_boolean add) if (! add) return NULL; - p = xmalloc (sizeof (struct section_list)); + p = (struct section_list *) xmalloc (sizeof (struct section_list)); p->name = name; p->used = FALSE; p->remove = FALSE; @@ -692,7 +692,7 @@ find_section_list (const char *name, bfd_boolean add) static int eq_string (const void *s1, const void *s2) { - return strcmp (s1, s2) == 0; + return strcmp ((const char *) s1, (const char *) s2) == 0; } static htab_t @@ -742,7 +742,7 @@ add_specific_symbols (const char *filename, htab_t htab) return; } - buffer = xmalloc (size + 2); + buffer = (char *) xmalloc (size + 2); f = fopen (filename, FOPEN_RT); if (f == NULL) fatal (_("cannot open '%s': %s"), filename, strerror (errno)); @@ -843,8 +843,9 @@ add_specific_symbols (const char *filename, htab_t htab) static int is_specified_symbol_predicate (void **slot, void *data) { - struct is_specified_symbol_predicate_data *d = data; - const char *slot_name = *slot; + struct is_specified_symbol_predicate_data *d = + (struct is_specified_symbol_predicate_data *) data; + const char *slot_name = (char *) *slot; if (*slot_name != '!') { @@ -1056,8 +1057,8 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms, { char *n, *ptr; - ptr = n = xmalloc (1 + strlen (prefix_symbols_string) - + strlen (name) + 1); + ptr = n = (char *) xmalloc (1 + strlen (prefix_symbols_string) + + strlen (name) + 1); if (add_leading_char) *ptr++ = bfd_get_symbol_leading_char (obfd); @@ -1208,7 +1209,7 @@ redefine_list_append (const char *cause, const char *source, const char *target) cause, target); } - new_node = xmalloc (sizeof (struct redefine_node)); + new_node = (struct redefine_node *) xmalloc (sizeof (struct redefine_node)); new_node->source = strdup (source); new_node->target = strdup (target); @@ -1236,7 +1237,7 @@ add_redefine_syms_file (const char *filename) filename, strerror (errno)); bufsize = 100; - buf = xmalloc (bufsize); + buf = (char *) xmalloc (bufsize); lineno = 1; c = getc (file); @@ -1253,7 +1254,7 @@ add_redefine_syms_file (const char *filename) if (len >= bufsize) { bufsize *= 2; - buf = xrealloc (buf, bufsize); + buf = (char *) xrealloc (buf, bufsize); } c = getc (file); } @@ -1279,7 +1280,7 @@ add_redefine_syms_file (const char *filename) if (len >= bufsize) { bufsize *= 2; - buf = xrealloc (buf, bufsize); + buf = (char *) xrealloc (buf, bufsize); } c = getc (file); } @@ -1364,7 +1365,7 @@ copy_unknown_object (bfd *ibfd, bfd *obfd) printf (_("copy from `%s' [unknown] to `%s' [unknown]\n"), bfd_get_archive_filename (ibfd), bfd_get_filename (obfd)); - cbuf = xmalloc (BUFSIZE); + cbuf = (char *) xmalloc (BUFSIZE); ncopied = 0; while (ncopied < size) { @@ -1558,7 +1559,7 @@ copy_object (bfd *ibfd, bfd *obfd) return FALSE; } - osympp = isympp = xmalloc (symsize); + osympp = isympp = (asymbol **) xmalloc (symsize); symcount = bfd_canonicalize_symtab (ibfd, isympp); if (symcount < 0) { @@ -1712,13 +1713,13 @@ copy_object (bfd *ibfd, bfd *obfd) We write out the gap contents below. */ c = bfd_count_sections (obfd); - osections = xmalloc (c * sizeof (asection *)); + osections = (asection **) xmalloc (c * sizeof (asection *)); set = osections; bfd_map_over_sections (obfd, get_sections, &set); qsort (osections, c, sizeof (asection *), compare_section_lma); - gaps = xmalloc (c * sizeof (bfd_size_type)); + gaps = (bfd_size_type *) xmalloc (c * sizeof (bfd_size_type)); memset (gaps, 0, c * sizeof (bfd_size_type)); if (gap_fill_set) @@ -1819,7 +1820,7 @@ copy_object (bfd *ibfd, bfd *obfd) bfd_map_over_sections (ibfd, mark_symbols_used_in_relocations, isympp); - osympp = xmalloc ((symcount + 1) * sizeof (asymbol *)); + osympp = (asymbol **) xmalloc ((symcount + 1) * sizeof (asymbol *)); symcount = filter_symbols (ibfd, obfd, osympp, isympp, symcount); } @@ -1872,7 +1873,7 @@ copy_object (bfd *ibfd, bfd *obfd) /* Fill in the gaps. */ if (max_gap > 8192) max_gap = 8192; - buf = xmalloc (max_gap); + buf = (bfd_byte *) xmalloc (max_gap); memset (buf, gap_fill, max_gap); c = bfd_count_sections (obfd); @@ -1995,7 +1996,7 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target, bfd *last_element; struct stat buf; int stat_status = 0; - bfd_boolean delete = TRUE; + bfd_boolean del = TRUE; /* Create an output file for this member. */ output_name = concat (dir, "/", @@ -2009,7 +2010,7 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target, fatal (_("cannot create tempdir for archive copying (error: %s)"), strerror (errno)); - l = xmalloc (sizeof (struct name_list)); + l = (struct name_list *) xmalloc (sizeof (struct name_list)); l->name = output_name; l->next = list; l->obfd = NULL; @@ -2027,7 +2028,7 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target, bfd_get_filename (this_element)); } - l = xmalloc (sizeof (struct name_list)); + l = (struct name_list *) xmalloc (sizeof (struct name_list)); l->name = output_name; l->next = list; l->obfd = NULL; @@ -2049,9 +2050,9 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target, return; } - delete = ! copy_object (this_element, output_bfd); + del = ! copy_object (this_element, output_bfd); - if (! delete + if (! del || bfd_get_arch (this_element) != bfd_arch_unknown) { if (!bfd_close (output_bfd)) @@ -2071,7 +2072,7 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target, output_bfd = bfd_openw (output_name, output_target); copy_unknown_element: - delete = !copy_unknown_object (this_element, output_bfd); + del = !copy_unknown_object (this_element, output_bfd); if (!bfd_close_all_done (output_bfd)) { bfd_nonfatal_message (output_name, NULL, NULL, NULL); @@ -2080,7 +2081,7 @@ copy_unknown_element: } } - if (delete) + if (del) { unlink (output_name); status = 1; @@ -2299,7 +2300,7 @@ add_section_rename (const char * old_name, const char * new_name, fatal (_("Multiple renames of section %s"), old_name); } - rename = xmalloc (sizeof (* rename)); + rename = (section_rename *) xmalloc (sizeof (* rename)); rename->old_name = old_name; rename->new_name = new_name; @@ -2361,7 +2362,7 @@ setup_bfd_headers (bfd *ibfd, bfd *obfd) static void setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg) { - bfd *obfd = obfdarg; + bfd *obfd = (bfd *) obfdarg; struct section_list *p; sec_ptr osection; bfd_size_type size; @@ -2394,7 +2395,7 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg) { char *n; - n = xmalloc (strlen (prefix) + strlen (name) + 1); + n = (char *) xmalloc (strlen (prefix) + strlen (name) + 1); strcpy (n, prefix); strcat (n, name); name = n; @@ -2531,7 +2532,7 @@ loser: static void copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg) { - bfd *obfd = obfdarg; + bfd *obfd = (bfd *) obfdarg; struct section_list *p; arelent **relpp; long relcount; @@ -2588,7 +2589,7 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg) bfd_set_reloc (obfd, osection, NULL, 0); else { - relpp = xmalloc (relsize); + relpp = (arelent **) xmalloc (relsize); relcount = bfd_canonicalize_reloc (ibfd, isection, relpp, isympp); if (relcount < 0) { @@ -2606,7 +2607,7 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg) long temp_relcount = 0; long i; - temp_relpp = xmalloc (relsize); + temp_relpp = (arelent **) xmalloc (relsize); for (i = 0; i < relcount; i++) if (is_specified_symbol (bfd_asymbol_name (*relpp[i]->sym_ptr_ptr), keep_specific_htab)) @@ -2663,7 +2664,7 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg) { /* Keep only every `copy_byte'th byte in MEMHUNK. */ char *from = (char *) memhunk + copy_byte; - char *to = memhunk; + char *to = (char *) memhunk; char *end = (char *) memhunk + size; for (; from < end; from += interleave) @@ -2708,7 +2709,7 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg) static void get_sections (bfd *obfd ATTRIBUTE_UNUSED, asection *osection, void *secppparg) { - asection ***secppp = secppparg; + asection ***secppp = (asection ***) secppparg; **secppp = osection; ++(*secppp); @@ -2721,8 +2722,8 @@ get_sections (bfd *obfd ATTRIBUTE_UNUSED, asection *osection, void *secppparg) static int compare_section_lma (const void *arg1, const void *arg2) { - const asection *const *sec1 = arg1; - const asection *const *sec2 = arg2; + const asection *const *sec1 = (const asection * const *) arg1; + const asection *const *sec2 = (const asection * const *) arg2; flagword flags1, flags2; /* Sort non loadable sections to the front. */ @@ -2765,7 +2766,7 @@ compare_section_lma (const void *arg1, const void *arg2) static void mark_symbols_used_in_relocations (bfd *ibfd, sec_ptr isection, void *symbolsarg) { - asymbol **symbols = symbolsarg; + asymbol **symbols = (asymbol **) symbolsarg; long relsize; arelent **relpp; long relcount, i; @@ -2786,7 +2787,7 @@ mark_symbols_used_in_relocations (bfd *ibfd, sec_ptr isection, void *symbolsarg) if (relsize == 0) return; - relpp = xmalloc (relsize); + relpp = (arelent **) xmalloc (relsize); relcount = bfd_canonicalize_reloc (ibfd, isection, relpp, symbols); if (relcount < 0) bfd_fatal (bfd_get_filename (ibfd)); @@ -3312,17 +3313,17 @@ copy_main (int argc, char *argv[]) break; } - pa = xmalloc (sizeof (struct section_add)); + pa = (struct section_add *) xmalloc (sizeof (struct section_add)); len = s - optarg; - name = xmalloc (len + 1); + name = (char *) xmalloc (len + 1); strncpy (name, optarg, len); name[len] = '\0'; pa->name = name; pa->filename = s + 1; pa->size = size; - pa->contents = xmalloc (size); + pa->contents = (bfd_byte *) xmalloc (size); f = fopen (pa->filename, FOPEN_RB); @@ -3382,7 +3383,7 @@ copy_main (int argc, char *argv[]) } len = s - optarg; - name = xmalloc (len + 1); + name = (char *) xmalloc (len + 1); strncpy (name, optarg, len); name[len] = '\0'; @@ -3480,13 +3481,13 @@ copy_main (int argc, char *argv[]) fatal (_("bad format for %s"), "--redefine-sym"); len = s - optarg; - source = xmalloc (len + 1); + source = (char *) xmalloc (len + 1); strncpy (source, optarg, len); source[len] = '\0'; nextarg = s + 1; len = strlen (nextarg); - target = xmalloc (len + 1); + target = (char *) xmalloc (len + 1); strcpy (target, nextarg); redefine_list_append ("--redefine-sym", source, target); @@ -3511,7 +3512,7 @@ copy_main (int argc, char *argv[]) fatal (_("bad format for %s"), "--set-section-flags"); len = s - optarg; - name = xmalloc (len + 1); + name = (char *) xmalloc (len + 1); strncpy (name, optarg, len); name[len] = '\0'; @@ -3538,7 +3539,7 @@ copy_main (int argc, char *argv[]) if (len == 0) fatal (_("bad format for %s"), "--rename-section"); - old_name = xmalloc (len + 1); + old_name = (char *) xmalloc (len + 1); strncpy (old_name, optarg, len); old_name[len] = 0; @@ -3558,7 +3559,7 @@ copy_main (int argc, char *argv[]) if (len == 0) fatal (_("bad format for %s"), "--rename-section"); - new_name = xmalloc (len + 1); + new_name = (char *) xmalloc (len + 1); strncpy (new_name, eq, len); new_name[len] = 0; diff --git a/binutils/objdump.c b/binutils/objdump.c index 71909980b5e..3768f7e2b93 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -467,7 +467,7 @@ slurp_symtab (bfd *abfd) if (storage < 0) bfd_fatal (bfd_get_filename (abfd)); if (storage) - sy = xmalloc (storage); + sy = (asymbol **) xmalloc (storage); symcount = bfd_canonicalize_symtab (abfd, sy); if (symcount < 0) @@ -496,7 +496,7 @@ slurp_dynamic_symtab (bfd *abfd) bfd_fatal (bfd_get_filename (abfd)); } if (storage) - sy = xmalloc (storage); + sy = (asymbol **) xmalloc (storage); dynsymcount = bfd_canonicalize_dynamic_symtab (abfd, sy); if (dynsymcount < 0) @@ -1040,7 +1040,7 @@ slurp_file (const char *fn, size_t *size) return map; } #endif - map = malloc (*size); + map = (const char *) malloc (*size); if (!map || (size_t) read (fd, (char *)map, *size) != *size) { free ((void *)map); @@ -1095,7 +1095,7 @@ index_file (const char *map, size_t size, unsigned int *maxline) if (line_map_size < lineno + 1) line_map_size = lineno + 1; newsize = line_map_size * sizeof (char *); - linemap = xrealloc (linemap, newsize); + linemap = (const char **) xrealloc (linemap, newsize); } linemap[lineno++] = lstart; @@ -1114,7 +1114,7 @@ try_print_file_open (const char *origname, const char *modname) { struct print_file_list *p; - p = xmalloc (sizeof (struct print_file_list)); + p = (struct print_file_list *) xmalloc (sizeof (struct print_file_list)); p->map = slurp_file (modname, &p->mapsize); if (p->map == NULL) @@ -1333,7 +1333,7 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset) { if (prev_functionname != NULL) free (prev_functionname); - prev_functionname = xmalloc (strlen (functionname) + 1); + prev_functionname = (char *) xmalloc (strlen (functionname) + 1); strcpy (prev_functionname, functionname); } @@ -1369,7 +1369,7 @@ objdump_sprintf (SFILE *f, const char *format, ...) break; f->alloc = (f->alloc + n) * 2; - f->buffer = xrealloc (f->buffer, f->alloc); + f->buffer = (char *) xrealloc (f->buffer, f->alloc); } f->pos += n; @@ -1419,7 +1419,7 @@ disassemble_bytes (struct disassemble_info * info, section = aux->sec; sfile.alloc = 120; - sfile.buffer = xmalloc (sfile.alloc); + sfile.buffer = (char *) xmalloc (sfile.alloc); sfile.pos = 0; if (insn_width) @@ -1835,7 +1835,7 @@ disassemble_section (bfd *abfd, asection *section, void *info) if (relsize > 0) { - rel_ppstart = rel_pp = xmalloc (relsize); + rel_ppstart = rel_pp = (arelent **) xmalloc (relsize); rel_count = bfd_canonicalize_reloc (abfd, section, rel_pp, syms); if (rel_count < 0) bfd_fatal (bfd_get_filename (abfd)); @@ -1847,7 +1847,7 @@ disassemble_section (bfd *abfd, asection *section, void *info) } rel_ppend = rel_pp + rel_count; - data = xmalloc (datasize); + data = (bfd_byte *) xmalloc (datasize); bfd_get_section_contents (abfd, section, data, 0, datasize); @@ -1886,7 +1886,9 @@ disassemble_section (bfd *abfd, asection *section, void *info) /* Find the nearest symbol forwards from our current position. */ paux->require_sec = TRUE; - sym = find_symbol_for_address (section->vma + addr_offset, info, &place); + sym = (asymbol *) find_symbol_for_address (section->vma + addr_offset, + (struct disassemble_info *) info, + &place); paux->require_sec = FALSE; /* PR 9774: If the target used signed 32-bit addresses then we must make @@ -2023,7 +2025,8 @@ disassemble_data (bfd *abfd) /* We make a copy of syms to sort. We don't want to sort syms because that will screw up the relocs. */ sorted_symcount = symcount ? symcount : dynsymcount; - sorted_syms = xmalloc ((sorted_symcount + synthcount) * sizeof (asymbol *)); + sorted_syms = (asymbol **) xmalloc ((sorted_symcount + synthcount) + * sizeof (asymbol *)); memcpy (sorted_syms, symcount ? syms : dynsyms, sorted_symcount * sizeof (asymbol *)); @@ -2064,7 +2067,7 @@ disassemble_data (bfd *abfd) { struct bfd_target *xvec; - xvec = xmalloc (sizeof (struct bfd_target)); + xvec = (struct bfd_target *) xmalloc (sizeof (struct bfd_target)); memcpy (xvec, abfd->xvec, sizeof (struct bfd_target)); xvec->byteorder = endian; abfd->xvec = xvec; @@ -2112,7 +2115,7 @@ disassemble_data (bfd *abfd) if (relsize > 0) { - aux.dynrelbuf = xmalloc (relsize); + aux.dynrelbuf = (arelent **) xmalloc (relsize); aux.dynrelcount = bfd_canonicalize_dynamic_reloc (abfd, aux.dynrelbuf, dynsyms); @@ -2139,7 +2142,7 @@ load_specific_debug_section (enum dwarf_section_display_enum debug, asection *sec, void *file) { struct dwarf_section *section = &debug_displays [debug].section; - bfd *abfd = file; + bfd *abfd = (bfd *) file; bfd_boolean ret; int section_is_compressed; @@ -2151,7 +2154,7 @@ load_specific_debug_section (enum dwarf_section_display_enum debug, section->address = 0; section->size = bfd_get_section_size (sec); - section->start = xmalloc (section->size); + section->start = (unsigned char *) xmalloc (section->size); if (is_relocatable && debug_displays [debug].relocate) ret = bfd_simple_get_relocated_section_contents (abfd, @@ -2189,7 +2192,7 @@ int load_debug_section (enum dwarf_section_display_enum debug, void *file) { struct dwarf_section *section = &debug_displays [debug].section; - bfd *abfd = file; + bfd *abfd = (bfd *) file; asection *sec; /* If it is already loaded, do nothing. */ @@ -2232,7 +2235,7 @@ dump_dwarf_section (bfd *abfd, asection *section, { const char *name = bfd_get_section_name (abfd, section); const char *match; - enum dwarf_section_display_enum i; + int i; if (CONST_STRNEQ (name, ".gnu.linkonce.wi.")) match = ".debug_info"; @@ -2251,12 +2254,13 @@ dump_dwarf_section (bfd *abfd, asection *section, sec->name = sec->uncompressed_name; else sec->name = sec->compressed_name; - if (load_specific_debug_section (i, section, abfd)) + if (load_specific_debug_section ((enum dwarf_section_display_enum) i, + section, abfd)) { debug_displays [i].display (sec, abfd); if (i != info && i != abbrev) - free_debug_section (i); + free_debug_section ((enum dwarf_section_display_enum) i); } break; } @@ -2309,7 +2313,7 @@ read_section_stabs (bfd *abfd, const char *sect_name, bfd_size_type *size_ptr) } size = bfd_section_size (abfd, stabsect); - contents = xmalloc (size); + contents = (char *) xmalloc (size); if (! bfd_get_section_contents (abfd, stabsect, contents, 0, size)) { @@ -2574,7 +2578,7 @@ dump_section (bfd *abfd, asection *section, void *dummy ATTRIBUTE_UNUSED) (unsigned long) (section->filepos + start_offset)); printf ("\n"); - data = xmalloc (datasize); + data = (bfd_byte *) xmalloc (datasize); bfd_get_section_contents (abfd, section, data, 0, datasize); @@ -2865,7 +2869,7 @@ dump_relocs_in_section (bfd *abfd, return; } - relpp = xmalloc (relsize); + relpp = (arelent **) xmalloc (relsize); relcount = bfd_canonicalize_reloc (abfd, section, relpp, syms); if (relcount < 0) @@ -2904,7 +2908,7 @@ dump_dynamic_relocs (bfd *abfd) printf (" (none)\n\n"); else { - relpp = xmalloc (relsize); + relpp = (arelent **) xmalloc (relsize); relcount = bfd_canonicalize_dynamic_reloc (abfd, relpp, dynsyms); if (relcount < 0) @@ -2929,8 +2933,8 @@ add_include_path (const char *path) if (path[0] == 0) return; include_path_count++; - include_paths = xrealloc (include_paths, - include_path_count * sizeof (*include_paths)); + include_paths = (const char **) + xrealloc (include_paths, include_path_count * sizeof (*include_paths)); #ifdef HAVE_DOS_BASED_FILE_SYSTEM if (path[1] == ':' && path[2] == 0) path = concat (path, ".", (const char *) 0); @@ -3205,7 +3209,7 @@ main (int argc, char **argv) if (only_used == only_size) { only_size += 8; - only = xrealloc (only, only_size * sizeof (char *)); + only = (char **) xrealloc (only, only_size * sizeof (char *)); } only [only_used++] = optarg; break; diff --git a/binutils/prdbg.c b/binutils/prdbg.c index b1731544ce4..579215a6684 100644 --- a/binutils/prdbg.c +++ b/binutils/prdbg.c @@ -1,6 +1,6 @@ /* prdbg.c -- Print out generic debugging information. - Copyright 1995, 1996, 1999, 2002, 2003, 2004, 2005, 2006, 2007, 2008 - Free Software Foundation, Inc. + Copyright 1995, 1996, 1999, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009 Free Software Foundation, Inc. Written by Ian Lance Taylor . Tags style generation written by Salvador E. Tropea . @@ -303,7 +303,7 @@ print_debugging_info (FILE *f, void *dhandle, bfd *abfd, asymbol **syms, info.filename = NULL; info.abfd = abfd; info.syms = syms; - info.demangler = demangler; + info.demangler = (char * (*)(struct bfd *, const char *, int)) demangler; if (as_tags) { @@ -743,7 +743,7 @@ pr_function_type (void *p, int argcount, bfd_boolean varargs) /* Now the return type is on the top of the stack. */ - s = xmalloc (len); + s = (char *) xmalloc (len); LITSTRCPY (s, "(|) ("); if (argcount < 0) @@ -1317,7 +1317,7 @@ pr_class_static_member (void *p, const char *name, const char *physname, /* Add a base class to a class. */ static bfd_boolean -pr_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean virtual, +pr_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean is_virtual, enum debug_visibility visibility) { struct pr_handle *info = (struct pr_handle *) p; @@ -1343,7 +1343,7 @@ pr_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean virtual, if (! push_type (info, t)) return FALSE; - if (virtual) + if (is_virtual) { if (! prepend_type (info, "virtual ")) return FALSE; @@ -2170,7 +2170,7 @@ tg_class_static_member (void *p, const char *name, len_var = strlen (name); len_class = strlen (info->stack->next->type); - full_name = xmalloc (len_var + len_class + 3); + full_name = (char *) xmalloc (len_var + len_class + 3); if (! full_name) return FALSE; sprintf (full_name, "%s::%s", info->stack->next->type, name); @@ -2201,7 +2201,7 @@ tg_class_static_member (void *p, const char *name, static bfd_boolean tg_class_baseclass (void *p, bfd_vma bitpos ATTRIBUTE_UNUSED, - bfd_boolean virtual, enum debug_visibility visibility) + bfd_boolean is_virtual, enum debug_visibility visibility) { struct pr_handle *info = (struct pr_handle *) p; char *t; @@ -2221,7 +2221,7 @@ tg_class_baseclass (void *p, bfd_vma bitpos ATTRIBUTE_UNUSED, if (! push_type (info, t)) return FALSE; - if (virtual) + if (is_virtual) { if (! prepend_type (info, "virtual ")) return FALSE; diff --git a/binutils/readelf.c b/binutils/readelf.c index 872ec0900ce..afa7d2abe66 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -662,13 +662,15 @@ slurp_rela_relocs (FILE * file, { Elf32_External_Rela * erelas; - erelas = get_data (NULL, file, rel_offset, 1, rel_size, _("relocs")); + erelas = (Elf32_External_Rela *) get_data (NULL, file, rel_offset, 1, + rel_size, _("relocs")); if (!erelas) return 0; nrelas = rel_size / sizeof (Elf32_External_Rela); - relas = cmalloc (nrelas, sizeof (Elf_Internal_Rela)); + relas = (Elf_Internal_Rela *) cmalloc (nrelas, + sizeof (Elf_Internal_Rela)); if (relas == NULL) { @@ -690,13 +692,15 @@ slurp_rela_relocs (FILE * file, { Elf64_External_Rela * erelas; - erelas = get_data (NULL, file, rel_offset, 1, rel_size, _("relocs")); + erelas = (Elf64_External_Rela *) get_data (NULL, file, rel_offset, 1, + rel_size, _("relocs")); if (!erelas) return 0; nrelas = rel_size / sizeof (Elf64_External_Rela); - relas = cmalloc (nrelas, sizeof (Elf_Internal_Rela)); + relas = (Elf_Internal_Rela *) cmalloc (nrelas, + sizeof (Elf_Internal_Rela)); if (relas == NULL) { @@ -756,13 +760,14 @@ slurp_rel_relocs (FILE * file, { Elf32_External_Rel * erels; - erels = get_data (NULL, file, rel_offset, 1, rel_size, _("relocs")); + erels = (Elf32_External_Rel *) get_data (NULL, file, rel_offset, 1, + rel_size, _("relocs")); if (!erels) return 0; nrels = rel_size / sizeof (Elf32_External_Rel); - rels = cmalloc (nrels, sizeof (Elf_Internal_Rela)); + rels = (Elf_Internal_Rela *) cmalloc (nrels, sizeof (Elf_Internal_Rela)); if (rels == NULL) { @@ -784,13 +789,14 @@ slurp_rel_relocs (FILE * file, { Elf64_External_Rel * erels; - erels = get_data (NULL, file, rel_offset, 1, rel_size, _("relocs")); + erels = (Elf64_External_Rel *) get_data (NULL, file, rel_offset, 1, + rel_size, _("relocs")); if (!erels) return 0; nrels = rel_size / sizeof (Elf64_External_Rel); - rels = cmalloc (nrels, sizeof (Elf_Internal_Rela)); + rels = (Elf_Internal_Rela *) cmalloc (nrels, sizeof (Elf_Internal_Rela)); if (rels == NULL) { @@ -2941,7 +2947,8 @@ request_dump_bynumber (unsigned int section, dump_type type) { dump_type * new_dump_sects; - new_dump_sects = calloc (section + 1, sizeof (* dump_sects)); + new_dump_sects = (dump_type *) calloc (section + 1, + sizeof (* dump_sects)); if (new_dump_sects == NULL) error (_("Out of memory allocating dump request table.\n")); @@ -2970,7 +2977,8 @@ request_dump_byname (const char * section, dump_type type) { struct dump_list_entry * new_request; - new_request = malloc (sizeof (struct dump_list_entry)); + new_request = (struct dump_list_entry *) + malloc (sizeof (struct dump_list_entry)); if (!new_request) error (_("Out of memory allocating dump request table.\n")); @@ -3289,9 +3297,10 @@ get_32bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers) Elf_Internal_Phdr * internal; unsigned int i; - phdrs = get_data (NULL, file, elf_header.e_phoff, - elf_header.e_phentsize, elf_header.e_phnum, - _("program headers")); + phdrs = (Elf32_External_Phdr *) get_data (NULL, file, elf_header.e_phoff, + elf_header.e_phentsize, + elf_header.e_phnum, + _("program headers")); if (!phdrs) return 0; @@ -3322,9 +3331,10 @@ get_64bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers) Elf_Internal_Phdr * internal; unsigned int i; - phdrs = get_data (NULL, file, elf_header.e_phoff, - elf_header.e_phentsize, elf_header.e_phnum, - _("program headers")); + phdrs = (Elf64_External_Phdr *) get_data (NULL, file, elf_header.e_phoff, + elf_header.e_phentsize, + elf_header.e_phnum, + _("program headers")); if (!phdrs) return 0; @@ -3358,7 +3368,8 @@ get_program_headers (FILE * file) if (program_headers != NULL) return 1; - phdrs = cmalloc (elf_header.e_phnum, sizeof (Elf_Internal_Phdr)); + phdrs = (Elf_Internal_Phdr *) cmalloc (elf_header.e_phnum, + sizeof (Elf_Internal_Phdr)); if (phdrs == NULL) { @@ -3651,12 +3662,14 @@ get_32bit_section_headers (FILE * file, unsigned int num) Elf_Internal_Shdr * internal; unsigned int i; - shdrs = get_data (NULL, file, elf_header.e_shoff, - elf_header.e_shentsize, num, _("section headers")); + shdrs = (Elf32_External_Shdr *) get_data (NULL, file, elf_header.e_shoff, + elf_header.e_shentsize, num, + _("section headers")); if (!shdrs) return 0; - section_headers = cmalloc (num, sizeof (Elf_Internal_Shdr)); + section_headers = (Elf_Internal_Shdr *) cmalloc (num, + sizeof (Elf_Internal_Shdr)); if (section_headers == NULL) { @@ -3692,12 +3705,14 @@ get_64bit_section_headers (FILE * file, unsigned int num) Elf_Internal_Shdr * internal; unsigned int i; - shdrs = get_data (NULL, file, elf_header.e_shoff, - elf_header.e_shentsize, num, _("section headers")); + shdrs = (Elf64_External_Shdr *) get_data (NULL, file, elf_header.e_shoff, + elf_header.e_shentsize, num, + _("section headers")); if (!shdrs) return 0; - section_headers = cmalloc (num, sizeof (Elf_Internal_Shdr)); + section_headers = (Elf_Internal_Shdr *) cmalloc (num, + sizeof (Elf_Internal_Shdr)); if (section_headers == NULL) { @@ -3736,8 +3751,8 @@ get_32bit_elf_symbols (FILE * file, Elf_Internal_Shdr * section) Elf_Internal_Sym * psym; unsigned int j; - esyms = get_data (NULL, file, section->sh_offset, 1, section->sh_size, - _("symbols")); + esyms = (Elf32_External_Sym *) get_data (NULL, file, section->sh_offset, 1, + section->sh_size, _("symbols")); if (!esyms) return NULL; @@ -3746,8 +3761,10 @@ get_32bit_elf_symbols (FILE * file, Elf_Internal_Shdr * section) && (symtab_shndx_hdr->sh_link == (unsigned long) (section - section_headers))) { - shndx = get_data (NULL, file, symtab_shndx_hdr->sh_offset, - 1, symtab_shndx_hdr->sh_size, _("symtab shndx")); + shndx = (Elf_External_Sym_Shndx *) get_data (NULL, file, + symtab_shndx_hdr->sh_offset, + 1, symtab_shndx_hdr->sh_size, + _("symtab shndx")); if (!shndx) { free (esyms); @@ -3756,7 +3773,7 @@ get_32bit_elf_symbols (FILE * file, Elf_Internal_Shdr * section) } number = section->sh_size / section->sh_entsize; - isyms = cmalloc (number, sizeof (Elf_Internal_Sym)); + isyms = (Elf_Internal_Sym *) cmalloc (number, sizeof (Elf_Internal_Sym)); if (isyms == NULL) { @@ -3801,8 +3818,8 @@ get_64bit_elf_symbols (FILE * file, Elf_Internal_Shdr * section) Elf_Internal_Sym * psym; unsigned int j; - esyms = get_data (NULL, file, section->sh_offset, 1, section->sh_size, - _("symbols")); + esyms = (Elf64_External_Sym *) get_data (NULL, file, section->sh_offset, 1, + section->sh_size, _("symbols")); if (!esyms) return NULL; @@ -3811,8 +3828,10 @@ get_64bit_elf_symbols (FILE * file, Elf_Internal_Shdr * section) && (symtab_shndx_hdr->sh_link == (unsigned long) (section - section_headers))) { - shndx = get_data (NULL, file, symtab_shndx_hdr->sh_offset, - 1, symtab_shndx_hdr->sh_size, _("symtab shndx")); + shndx = (Elf_External_Sym_Shndx *) get_data (NULL, file, + symtab_shndx_hdr->sh_offset, + 1, symtab_shndx_hdr->sh_size, + _("symtab shndx")); if (!shndx) { free (esyms); @@ -3821,7 +3840,7 @@ get_64bit_elf_symbols (FILE * file, Elf_Internal_Shdr * section) } number = section->sh_size / section->sh_entsize; - isyms = cmalloc (number, sizeof (Elf_Internal_Sym)); + isyms = (Elf_Internal_Sym *) cmalloc (number, sizeof (Elf_Internal_Sym)); if (isyms == NULL) { @@ -4113,8 +4132,9 @@ process_section_headers (FILE * file) if (section->sh_size != 0) { - string_table = get_data (NULL, file, section->sh_offset, - 1, section->sh_size, _("string table")); + string_table = (char *) get_data (NULL, file, section->sh_offset, + 1, section->sh_size, + _("string table")); string_table_length = string_table != NULL ? section->sh_size : 0; } @@ -4218,8 +4238,9 @@ process_section_headers (FILE * file) continue; } - dynamic_strings = get_data (NULL, file, section->sh_offset, - 1, section->sh_size, _("dynamic strings")); + dynamic_strings = (char *) get_data (NULL, file, section->sh_offset, + 1, section->sh_size, + _("dynamic strings")); dynamic_strings_length = section->sh_size; } else if (section->sh_type == SHT_SYMTAB_SHNDX) @@ -4544,8 +4565,8 @@ process_section_groups (FILE * file) abort (); } - section_headers_groups = calloc (elf_header.e_shnum, - sizeof (struct group *)); + section_headers_groups = (struct group **) calloc (elf_header.e_shnum, + sizeof (struct group *)); if (section_headers_groups == NULL) { @@ -4569,7 +4590,7 @@ process_section_groups (FILE * file) return 1; } - section_groups = calloc (group_count, sizeof (struct group)); + section_groups = (struct group *) calloc (group_count, sizeof (struct group)); if (section_groups == NULL) { @@ -4648,17 +4669,18 @@ process_section_groups (FILE * file) strtab_sec = sec; if (strtab) free (strtab); - strtab = get_data (NULL, file, strtab_sec->sh_offset, - 1, strtab_sec->sh_size, - _("string table")); + strtab = (char *) get_data (NULL, file, strtab_sec->sh_offset, + 1, strtab_sec->sh_size, + _("string table")); strtab_size = strtab != NULL ? strtab_sec->sh_size : 0; } group_name = sym->st_name < strtab_size ? strtab + sym->st_name : ""; } - start = get_data (NULL, file, section->sh_offset, - 1, section->sh_size, _("section data")); + start = (unsigned char *) get_data (NULL, file, section->sh_offset, + 1, section->sh_size, + _("section data")); indices = start; size = (section->sh_size / section->sh_entsize) - 1; @@ -4721,7 +4743,7 @@ process_section_groups (FILE * file) printf (" [%5u] %s\n", entry, SECTION_NAME (sec)); } - g = xmalloc (sizeof (struct group_list)); + g = (struct group_list *) xmalloc (sizeof (struct group_list)); g->section_index = entry; g->next = group->root; group->root = g; @@ -4874,9 +4896,9 @@ process_relocs (FILE * file) { strsec = section_headers + symsec->sh_link; - strtab = get_data (NULL, file, strsec->sh_offset, - 1, strsec->sh_size, - _("string table")); + strtab = (char *) get_data (NULL, file, strsec->sh_offset, + 1, strsec->sh_size, + _("string table")); strtablen = strtab == NULL ? 0 : strsec->sh_size; } @@ -4920,15 +4942,17 @@ struct absaddr ? section_headers [(a).section].sh_addr + (a).offset \ : (a).offset) +struct ia64_unw_table_entry + { + struct absaddr start; + struct absaddr end; + struct absaddr info; + }; + struct ia64_unw_aux_info { - struct ia64_unw_table_entry - { - struct absaddr start; - struct absaddr end; - struct absaddr info; - } - *table; /* Unwind table. */ + + struct ia64_unw_table_entry *table; /* Unwind table. */ unsigned long table_len; /* Length of unwind table. */ unsigned char * info; /* Unwind info. */ unsigned long info_size; /* Size of unwind info. */ @@ -5077,11 +5101,13 @@ slurp_ia64_unwind_table (FILE * file, /* Second, build the unwind table from the contents of the unwind section: */ size = sec->sh_size; - table = get_data (NULL, file, sec->sh_offset, 1, size, _("unwind table")); + table = (unsigned char *) get_data (NULL, file, sec->sh_offset, 1, size, + _("unwind table")); if (!table) return 0; - aux->table = xcmalloc (size / (3 * eh_addr_size), sizeof (aux->table[0])); + aux->table = (struct ia64_unw_table_entry *) + xcmalloc (size / (3 * eh_addr_size), sizeof (aux->table[0])); tep = aux->table; for (tp = table; tp < table + size; ++tep) { @@ -5170,8 +5196,9 @@ ia64_process_unwind (FILE * file) aux.symtab = GET_ELF_SYMBOLS (file, sec); strsec = section_headers + sec->sh_link; - aux.strtab = get_data (NULL, file, strsec->sh_offset, - 1, strsec->sh_size, _("string table")); + aux.strtab = (char *) get_data (NULL, file, strsec->sh_offset, + 1, strsec->sh_size, + _("string table")); aux.strtab_size = aux.strtab != NULL ? strsec->sh_size : 0; } else if (sec->sh_type == SHT_IA_64_UNWIND) @@ -5253,8 +5280,9 @@ ia64_process_unwind (FILE * file) { aux.info_size = sec->sh_size; aux.info_addr = sec->sh_addr; - aux.info = get_data (NULL, file, sec->sh_offset, 1, aux.info_size, - _("unwind info")); + aux.info = (unsigned char *) get_data (NULL, file, sec->sh_offset, 1, + aux.info_size, + _("unwind info")); printf (_("\nUnwind section ")); @@ -5289,45 +5317,46 @@ ia64_process_unwind (FILE * file) return 1; } +struct hppa_unw_table_entry + { + struct absaddr start; + struct absaddr end; + unsigned int Cannot_unwind:1; /* 0 */ + unsigned int Millicode:1; /* 1 */ + unsigned int Millicode_save_sr0:1; /* 2 */ + unsigned int Region_description:2; /* 3..4 */ + unsigned int reserved1:1; /* 5 */ + unsigned int Entry_SR:1; /* 6 */ + unsigned int Entry_FR:4; /* number saved */ /* 7..10 */ + unsigned int Entry_GR:5; /* number saved */ /* 11..15 */ + unsigned int Args_stored:1; /* 16 */ + unsigned int Variable_Frame:1; /* 17 */ + unsigned int Separate_Package_Body:1; /* 18 */ + unsigned int Frame_Extension_Millicode:1; /* 19 */ + unsigned int Stack_Overflow_Check:1; /* 20 */ + unsigned int Two_Instruction_SP_Increment:1; /* 21 */ + unsigned int Ada_Region:1; /* 22 */ + unsigned int cxx_info:1; /* 23 */ + unsigned int cxx_try_catch:1; /* 24 */ + unsigned int sched_entry_seq:1; /* 25 */ + unsigned int reserved2:1; /* 26 */ + unsigned int Save_SP:1; /* 27 */ + unsigned int Save_RP:1; /* 28 */ + unsigned int Save_MRP_in_frame:1; /* 29 */ + unsigned int extn_ptr_defined:1; /* 30 */ + unsigned int Cleanup_defined:1; /* 31 */ + + unsigned int MPE_XL_interrupt_marker:1; /* 0 */ + unsigned int HP_UX_interrupt_marker:1; /* 1 */ + unsigned int Large_frame:1; /* 2 */ + unsigned int Pseudo_SP_Set:1; /* 3 */ + unsigned int reserved4:1; /* 4 */ + unsigned int Total_frame_size:27; /* 5..31 */ + }; + struct hppa_unw_aux_info { - struct hppa_unw_table_entry - { - struct absaddr start; - struct absaddr end; - unsigned int Cannot_unwind:1; /* 0 */ - unsigned int Millicode:1; /* 1 */ - unsigned int Millicode_save_sr0:1; /* 2 */ - unsigned int Region_description:2; /* 3..4 */ - unsigned int reserved1:1; /* 5 */ - unsigned int Entry_SR:1; /* 6 */ - unsigned int Entry_FR:4; /* number saved */ /* 7..10 */ - unsigned int Entry_GR:5; /* number saved */ /* 11..15 */ - unsigned int Args_stored:1; /* 16 */ - unsigned int Variable_Frame:1; /* 17 */ - unsigned int Separate_Package_Body:1; /* 18 */ - unsigned int Frame_Extension_Millicode:1; /* 19 */ - unsigned int Stack_Overflow_Check:1; /* 20 */ - unsigned int Two_Instruction_SP_Increment:1; /* 21 */ - unsigned int Ada_Region:1; /* 22 */ - unsigned int cxx_info:1; /* 23 */ - unsigned int cxx_try_catch:1; /* 24 */ - unsigned int sched_entry_seq:1; /* 25 */ - unsigned int reserved2:1; /* 26 */ - unsigned int Save_SP:1; /* 27 */ - unsigned int Save_RP:1; /* 28 */ - unsigned int Save_MRP_in_frame:1; /* 29 */ - unsigned int extn_ptr_defined:1; /* 30 */ - unsigned int Cleanup_defined:1; /* 31 */ - - unsigned int MPE_XL_interrupt_marker:1; /* 0 */ - unsigned int HP_UX_interrupt_marker:1; /* 1 */ - unsigned int Large_frame:1; /* 2 */ - unsigned int Pseudo_SP_Set:1; /* 3 */ - unsigned int reserved4:1; /* 4 */ - unsigned int Total_frame_size:27; /* 5..31 */ - } - *table; /* Unwind table. */ + struct hppa_unw_table_entry *table; /* Unwind table. */ unsigned long table_len; /* Length of unwind table. */ bfd_vma seg_base; /* Starting address of segment. */ Elf_Internal_Sym * symtab; /* The symbol table. */ @@ -5445,7 +5474,8 @@ slurp_hppa_unwind_table (FILE * file, /* Second, build the unwind table from the contents of the unwind section. */ size = sec->sh_size; - table = get_data (NULL, file, sec->sh_offset, 1, size, _("unwind table")); + table = (unsigned char *) get_data (NULL, file, sec->sh_offset, 1, size, + _("unwind table")); if (!table) return 0; @@ -5453,7 +5483,8 @@ slurp_hppa_unwind_table (FILE * file, nentries = size / unw_ent_size; size = unw_ent_size * nentries; - tep = aux->table = xcmalloc (nentries, sizeof (aux->table[0])); + tep = aux->table = (struct hppa_unw_table_entry *) + xcmalloc (nentries, sizeof (aux->table[0])); for (tp = table; tp < table + size; tp += unw_ent_size, ++tep) { @@ -5578,8 +5609,9 @@ hppa_process_unwind (FILE * file) aux.symtab = GET_ELF_SYMBOLS (file, sec); strsec = section_headers + sec->sh_link; - aux.strtab = get_data (NULL, file, strsec->sh_offset, - 1, strsec->sh_size, _("string table")); + aux.strtab = (char *) get_data (NULL, file, strsec->sh_offset, + 1, strsec->sh_size, + _("string table")); aux.strtab_size = aux.strtab != NULL ? strsec->sh_size : 0; } else if (streq (SECTION_NAME (sec), ".PARISC.unwind")) @@ -5805,8 +5837,8 @@ get_32bit_dynamic_section (FILE * file) Elf32_External_Dyn * ext; Elf_Internal_Dyn * entry; - edyn = get_data (NULL, file, dynamic_addr, 1, dynamic_size, - _("dynamic section")); + edyn = (Elf32_External_Dyn *) get_data (NULL, file, dynamic_addr, 1, + dynamic_size, _("dynamic section")); if (!edyn) return 0; @@ -5822,7 +5854,8 @@ get_32bit_dynamic_section (FILE * file) break; } - dynamic_section = cmalloc (dynamic_nent, sizeof (* entry)); + dynamic_section = (Elf_Internal_Dyn *) cmalloc (dynamic_nent, + sizeof (* entry)); if (dynamic_section == NULL) { error (_("Out of memory\n")); @@ -5850,8 +5883,8 @@ get_64bit_dynamic_section (FILE * file) Elf64_External_Dyn * ext; Elf_Internal_Dyn * entry; - edyn = get_data (NULL, file, dynamic_addr, 1, dynamic_size, - _("dynamic section")); + edyn = (Elf64_External_Dyn *) get_data (NULL, file, dynamic_addr, 1, + dynamic_size, _("dynamic section")); if (!edyn) return 0; @@ -5867,7 +5900,8 @@ get_64bit_dynamic_section (FILE * file) break; } - dynamic_section = cmalloc (dynamic_nent, sizeof (* entry)); + dynamic_section = (Elf_Internal_Dyn *) cmalloc (dynamic_nent, + sizeof (* entry)); if (dynamic_section == NULL) { error (_("Out of memory\n")); @@ -6025,8 +6059,9 @@ process_dynamic_section (FILE * file) continue; } - dynamic_strings = get_data (NULL, file, offset, 1, str_tab_len, - _("dynamic string table")); + dynamic_strings = (char *) get_data (NULL, file, offset, 1, + str_tab_len, + _("dynamic string table")); dynamic_strings_length = str_tab_len; break; } @@ -6061,12 +6096,13 @@ process_dynamic_section (FILE * file) Elf_Internal_Syminfo * syminfo; /* There is a syminfo section. Read the data. */ - extsyminfo = get_data (NULL, file, dynamic_syminfo_offset, 1, - syminsz, _("symbol information")); + extsyminfo = (Elf_External_Syminfo *) + get_data (NULL, file, dynamic_syminfo_offset, 1, syminsz, + _("symbol information")); if (!extsyminfo) return 0; - dynamic_syminfo = malloc (syminsz); + dynamic_syminfo = (Elf_Internal_Syminfo *) malloc (syminsz); if (dynamic_syminfo == NULL) { error (_("Out of memory\n")); @@ -6553,9 +6589,9 @@ process_version_sections (FILE * file) ? SECTION_NAME (section_headers + section->sh_link) : ""); - edefs = get_data (NULL, file, section->sh_offset, 1, - section->sh_size, - _("version definition section")); + edefs = (Elf_External_Verdef *) + get_data (NULL, file, section->sh_offset, 1,section->sh_size, + _("version definition section")); endbuf = (char *) edefs + section->sh_size; if (!edefs) break; @@ -6655,9 +6691,10 @@ process_version_sections (FILE * file) ? SECTION_NAME (section_headers + section->sh_link) : ""); - eneed = get_data (NULL, file, section->sh_offset, 1, - section->sh_size, - _("version need section")); + eneed = (Elf_External_Verneed *) get_data (NULL, file, + section->sh_offset, 1, + section->sh_size, + _("version need section")); endbuf = (char *) eneed + section->sh_size; if (!eneed) break; @@ -6760,8 +6797,9 @@ process_version_sections (FILE * file) string_sec = section_headers + link_section->sh_link; - strtab = get_data (NULL, file, string_sec->sh_offset, 1, - string_sec->sh_size, _("version string table")); + strtab = (char *) get_data (NULL, file, string_sec->sh_offset, 1, + string_sec->sh_size, + _("version string table")); if (!strtab) break; @@ -6777,15 +6815,16 @@ process_version_sections (FILE * file) off = offset_from_vma (file, version_info[DT_VERSIONTAGIDX (DT_VERSYM)], total * sizeof (short)); - edata = get_data (NULL, file, off, total, sizeof (short), - _("version symbol data")); + edata = (unsigned char *) get_data (NULL, file, off, total, + sizeof (short), + _("version symbol data")); if (!edata) { free (strtab); break; } - data = cmalloc (total, sizeof (short)); + data = (short unsigned int *) cmalloc (total, sizeof (short)); for (cnt = total; cnt --;) data[cnt] = byte_get (edata + cnt * sizeof (short), @@ -7138,7 +7177,7 @@ get_dynamic_data (FILE * file, unsigned int number, unsigned int ent_size) unsigned char * e_data; bfd_vma * i_data; - e_data = cmalloc (number, ent_size); + e_data = (unsigned char *) cmalloc (number, ent_size); if (e_data == NULL) { @@ -7152,7 +7191,7 @@ get_dynamic_data (FILE * file, unsigned int number, unsigned int ent_size) return NULL; } - i_data = cmalloc (number, sizeof (*i_data)); + i_data = (bfd_vma *) cmalloc (number, sizeof (*i_data)); if (i_data == NULL) { @@ -7475,8 +7514,9 @@ process_symbol_table (FILE * file) string_sec = section_headers + section->sh_link; - strtab = get_data (NULL, file, string_sec->sh_offset, - 1, string_sec->sh_size, _("string table")); + strtab = (char *) get_data (NULL, file, string_sec->sh_offset, + 1, string_sec->sh_size, + _("string table")); strtab_size = strtab != NULL ? string_sec->sh_size : 0; } @@ -7663,7 +7703,7 @@ process_symbol_table (FILE * file) (unsigned long) nbuckets); printf (_(" Length Number %% of total Coverage\n")); - lengths = calloc (nbuckets, sizeof (*lengths)); + lengths = (unsigned long *) calloc (nbuckets, sizeof (*lengths)); if (lengths == NULL) { error (_("Out of memory\n")); @@ -7679,7 +7719,7 @@ process_symbol_table (FILE * file) } } - counts = calloc (maxlength + 1, sizeof (*counts)); + counts = (unsigned long *) calloc (maxlength + 1, sizeof (*counts)); if (counts == NULL) { error (_("Out of memory\n")); @@ -7722,7 +7762,7 @@ process_symbol_table (FILE * file) unsigned long nzero_counts = 0; unsigned long nsyms = 0; - lengths = calloc (ngnubuckets, sizeof (*lengths)); + lengths = (unsigned long *) calloc (ngnubuckets, sizeof (*lengths)); if (lengths == NULL) { error (_("Out of memory\n")); @@ -7747,7 +7787,7 @@ process_symbol_table (FILE * file) nsyms += length; } - counts = calloc (maxlength + 1, sizeof (*counts)); + counts = (unsigned long *) calloc (maxlength + 1, sizeof (*counts)); if (counts == NULL) { error (_("Out of memory\n")); @@ -8287,14 +8327,14 @@ apply_relocations (void * file, if (is_rela) { - if (!slurp_rela_relocs (file, relsec->sh_offset, relsec->sh_size, - & relocs, & num_relocs)) + if (!slurp_rela_relocs ((FILE *) file, relsec->sh_offset, + relsec->sh_size, & relocs, & num_relocs)) return; } else { - if (!slurp_rel_relocs (file, relsec->sh_offset, relsec->sh_size, - & relocs, & num_relocs)) + if (!slurp_rel_relocs ((FILE *) file, relsec->sh_offset, + relsec->sh_size, & relocs, & num_relocs)) return; } @@ -8303,7 +8343,7 @@ apply_relocations (void * file, is_rela = FALSE; symsec = section_headers + relsec->sh_link; - symtab = GET_ELF_SYMBOLS (file, symsec); + symtab = GET_ELF_SYMBOLS ((FILE *) file, symsec); for (rp = relocs; rp < relocs + num_relocs; ++rp) { @@ -8430,8 +8470,8 @@ get_section_contents (Elf_Internal_Shdr * section, FILE * file) return NULL; } - return get_data (NULL, file, section->sh_offset, 1, num_bytes, - _("section contents")); + return (char *) get_data (NULL, file, section->sh_offset, 1, num_bytes, + _("section contents")); } @@ -8638,7 +8678,7 @@ uncompress_section_contents (unsigned char ** buffer, dwarf_size_type * size) strm.avail_in = compressed_size - header_size; strm.next_in = (Bytef *) compressed_buffer + header_size; strm.avail_out = uncompressed_size; - uncompressed_buffer = xmalloc (uncompressed_size); + uncompressed_buffer = (unsigned char *) xmalloc (uncompressed_size); rc = inflateInit (& strm); while (strm.avail_in > 0) @@ -8685,8 +8725,9 @@ load_specific_debug_section (enum dwarf_section_display_enum debug, snprintf (buf, sizeof (buf), _("%s section data"), section->name); section->address = sec->sh_addr; section->size = sec->sh_size; - section->start = get_data (NULL, file, sec->sh_offset, 1, - sec->sh_size, buf); + section->start = (unsigned char *) get_data (NULL, (FILE *) file, + sec->sh_offset, 1, + sec->sh_size, buf); if (section->start == NULL) return 0; @@ -8695,7 +8736,7 @@ load_specific_debug_section (enum dwarf_section_display_enum debug, return 0; if (debug_displays [debug].relocate) - apply_relocations (file, sec, section->start); + apply_relocations ((FILE *) file, sec, section->start); return 1; } @@ -8719,7 +8760,7 @@ load_debug_section (enum dwarf_section_display_enum debug, void * file) if (sec == NULL) return 0; - return load_specific_debug_section (debug, sec, file); + return load_specific_debug_section (debug, sec, (FILE *) file); } void @@ -8742,7 +8783,7 @@ display_debug_section (Elf_Internal_Shdr * section, FILE * file) char * name = SECTION_NAME (section); bfd_size_type length; int result = 1; - enum dwarf_section_display_enum i; + int i; length = section->sh_size; if (length == 0) @@ -8772,18 +8813,19 @@ display_debug_section (Elf_Internal_Shdr * section, FILE * file) int secondary = (section != find_section (name)); if (secondary) - free_debug_section (i); + free_debug_section ((enum dwarf_section_display_enum) i); if (streq (debug_displays[i].section.uncompressed_name, name)) sec->name = sec->uncompressed_name; else sec->name = sec->compressed_name; - if (load_specific_debug_section (i, section, file)) + if (load_specific_debug_section ((enum dwarf_section_display_enum) i, + section, file)) { result &= debug_displays[i].display (sec, file); if (secondary || (i != info && i != abbrev)) - free_debug_section (i); + free_debug_section ((enum dwarf_section_display_enum) i); } break; @@ -9373,8 +9415,8 @@ process_attributes (FILE * file, if (sect->sh_type != proc_type && sect->sh_type != SHT_GNU_ATTRIBUTES) continue; - contents = get_data (NULL, file, sect->sh_offset, 1, sect->sh_size, - _("attributes")); + contents = (unsigned char *) get_data (NULL, file, sect->sh_offset, 1, + sect->sh_size, _("attributes")); if (contents == NULL) continue; @@ -9636,9 +9678,10 @@ process_mips_specific (FILE * file) Elf32_External_Lib * elib; size_t cnt; - elib = get_data (NULL, file, liblist_offset, - liblistno, sizeof (Elf32_External_Lib), - _("liblist")); + elib = (Elf32_External_Lib *) get_data (NULL, file, liblist_offset, + liblistno, + sizeof (Elf32_External_Lib), + _("liblist")); if (elib) { printf ("\nSection '.liblist' contains %lu entries:\n", @@ -9724,11 +9767,12 @@ process_mips_specific (FILE * file) while (sect->sh_type != SHT_MIPS_OPTIONS) ++sect; - eopt = get_data (NULL, file, options_offset, 1, sect->sh_size, - _("options")); + eopt = (Elf_External_Options *) get_data (NULL, file, options_offset, 1, + sect->sh_size, _("options")); if (eopt) { - iopt = cmalloc ((sect->sh_size / sizeof (eopt)), sizeof (* iopt)); + iopt = (Elf_Internal_Options *) + cmalloc ((sect->sh_size / sizeof (eopt)), sizeof (* iopt)); if (iopt == NULL) { error (_("Out of memory\n")); @@ -9920,7 +9964,7 @@ process_mips_specific (FILE * file) return 0; } - iconf = cmalloc (conflictsno, sizeof (* iconf)); + iconf = (Elf32_Conflict *) cmalloc (conflictsno, sizeof (* iconf)); if (iconf == NULL) { error (_("Out of memory\n")); @@ -9931,8 +9975,9 @@ process_mips_specific (FILE * file) { Elf32_External_Conflict * econf32; - econf32 = get_data (NULL, file, conflicts_offset, - conflictsno, sizeof (* econf32), _("conflict")); + econf32 = (Elf32_External_Conflict *) + get_data (NULL, file, conflicts_offset, conflictsno, + sizeof (* econf32), _("conflict")); if (!econf32) return 0; @@ -9945,8 +9990,9 @@ process_mips_specific (FILE * file) { Elf64_External_Conflict * econf64; - econf64 = get_data (NULL, file, conflicts_offset, - conflictsno, sizeof (* econf64), _("conflict")); + econf64 = (Elf64_External_Conflict *) + get_data (NULL, file, conflicts_offset, conflictsno, + sizeof (* econf64), _("conflict")); if (!econf64) return 0; @@ -9990,7 +10036,8 @@ process_mips_specific (FILE * file) global_end = local_end + (symtabno - gotsym) * addr_size; offset = offset_from_vma (file, pltgot, global_end - pltgot); - data = get_data (NULL, file, offset, global_end - pltgot, 1, _("GOT")); + data = (unsigned char *) get_data (NULL, file, offset, + global_end - pltgot, 1, _("GOT")); printf (_("\nPrimary GOT:\n")); printf (_(" Canonical gp value: ")); print_vma (pltgot + 0x7ff0, LONG_HEX); @@ -10085,7 +10132,8 @@ process_mips_specific (FILE * file) end = mips_pltgot + (2 + count) * addr_size; offset = offset_from_vma (file, mips_pltgot, end - mips_pltgot); - data = get_data (NULL, file, offset, end - mips_pltgot, 1, _("PLT GOT")); + data = (unsigned char *) get_data (NULL, file, offset, end - mips_pltgot, + 1, _("PLT GOT")); printf (_("\nPLT GOT:\n\n")); printf (_(" Reserved entries:\n")); printf (_(" %*s %*s Purpose\n"), @@ -10153,15 +10201,17 @@ process_gnu_liblist (FILE * file) if (section->sh_link >= elf_header.e_shnum) break; - elib = get_data (NULL, file, section->sh_offset, 1, section->sh_size, - _("liblist")); + elib = (Elf32_External_Lib *) + get_data (NULL, file, section->sh_offset, 1, section->sh_size, + _("liblist")); if (elib == NULL) break; string_sec = section_headers + section->sh_link; - strtab = get_data (NULL, file, string_sec->sh_offset, 1, - string_sec->sh_size, _("liblist string table")); + strtab = (char *) get_data (NULL, file, string_sec->sh_offset, 1, + string_sec->sh_size, + _("liblist string table")); strtab_size = string_sec->sh_size; if (strtab == NULL @@ -10405,7 +10455,8 @@ process_corefile_note_segment (FILE * file, bfd_vma offset, bfd_vma length) if (length <= 0) return 0; - pnotes = get_data (NULL, file, offset, 1, length, _("notes")); + pnotes = (Elf_External_Note *) get_data (NULL, file, offset, 1, length, + _("notes")); if (!pnotes) return 0; @@ -10447,7 +10498,7 @@ process_corefile_note_segment (FILE * file, bfd_vma offset, bfd_vma length) namesz. */ if (inote.namedata[inote.namesz] != '\0') { - temp = malloc (inote.namesz + 1); + temp = (char *) malloc (inote.namesz + 1); if (temp == NULL) { @@ -10822,7 +10873,7 @@ adjust_relative_path (char * file_name, char * name, int name_len) archive is located. */ if (IS_ABSOLUTE_PATH (name) || base_name == file_name) { - member_file_name = malloc (name_len + 1); + member_file_name = (char *) malloc (name_len + 1); if (member_file_name == NULL) { error (_("Out of memory\n")); @@ -10836,7 +10887,7 @@ adjust_relative_path (char * file_name, char * name, int name_len) /* Concatenate the path components of the archive file name to the relative path name from the extended name table. */ size_t prefix_len = base_name - file_name; - member_file_name = malloc (prefix_len + name_len + 1); + member_file_name = (char *) malloc (prefix_len + name_len + 1); if (member_file_name == NULL) { error (_("Out of memory\n")); @@ -10946,7 +10997,8 @@ setup_archive (struct archive_info * arch, char * file_name, FILE * file, file_name, arch->index_num); return 1; } - index_buffer = malloc (arch->index_num * SIZEOF_AR_INDEX_NUMBERS); + index_buffer = (unsigned char *) + malloc (arch->index_num * SIZEOF_AR_INDEX_NUMBERS); if (index_buffer == NULL) { error (_("Out of memory whilst trying to read archive symbol index\n")); @@ -10962,7 +11014,8 @@ setup_archive (struct archive_info * arch, char * file_name, FILE * file, size -= arch->index_num * SIZEOF_AR_INDEX_NUMBERS; /* Convert the index numbers into the host's numeric format. */ - arch->index_array = malloc (arch->index_num * sizeof (* arch->index_array)); + arch->index_array = (long unsigned int *) + malloc (arch->index_num * sizeof (* arch->index_array)); if (arch->index_array == NULL) { free (index_buffer); @@ -10981,7 +11034,7 @@ setup_archive (struct archive_info * arch, char * file_name, FILE * file, error (_("%s: the archive has an index but no symbols\n"), file_name); return 1; } - arch->sym_table = malloc (size); + arch->sym_table = (char *) malloc (size); arch->sym_size = size; if (arch->sym_table == NULL) { @@ -11023,7 +11076,7 @@ setup_archive (struct archive_info * arch, char * file_name, FILE * file, arch->longnames_size = strtoul (arch->arhdr.ar_size, NULL, 10); arch->next_arhdr_offset += sizeof arch->arhdr + arch->longnames_size; - arch->longnames = malloc (arch->longnames_size); + arch->longnames = (char *) malloc (arch->longnames_size); if (arch->longnames == NULL) { error (_("Out of memory reading long symbol names in archive\n")); @@ -11195,7 +11248,7 @@ make_qualified_name (struct archive_info * arch, if (arch->is_thin_archive && arch->nested_member_origin != 0) len += strlen (nested_arch->file_name) + 2; - name = malloc (len); + name = (char *) malloc (len); if (name == NULL) { error (_("Out of memory\n")); @@ -11530,7 +11583,8 @@ main (int argc, char ** argv) if (num_dump_sects > 0) { /* Make a copy of the dump_sects array. */ - cmdline_dump_sects = malloc (num_dump_sects * sizeof (* dump_sects)); + cmdline_dump_sects = (dump_type *) + malloc (num_dump_sects * sizeof (* dump_sects)); if (cmdline_dump_sects == NULL) error (_("Out of memory allocating dump request table.\n")); else diff --git a/binutils/size.c b/binutils/size.c index 415fee1011f..0937de514e1 100644 --- a/binutils/size.c +++ b/binutils/size.c @@ -1,6 +1,6 @@ /* size.c -- report size of various sections of an executable file. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -273,7 +273,7 @@ calculate_common_size (bfd *abfd) if (storage < 0) bfd_fatal (bfd_get_filename (abfd)); if (storage) - syms = xmalloc (storage); + syms = (asymbol **) xmalloc (storage); symcount = bfd_canonicalize_symtab (abfd, syms); if (symcount < 0) diff --git a/binutils/stabs.c b/binutils/stabs.c index b40a0955fd4..c2bb26615de 100644 --- a/binutils/stabs.c +++ b/binutils/stabs.c @@ -1,6 +1,6 @@ /* stabs.c -- Parse stabs debugging information Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of GNU Binutils. @@ -1142,7 +1142,7 @@ parse_stab_string (void *dhandle, struct stab_handle *info, int stabtype, store the slot used if the type is being defined. */ static debug_type -parse_stab_type (void *dhandle, struct stab_handle *info, const char *typename, const char **pp, debug_type **slotp) +parse_stab_type (void *dhandle, struct stab_handle *info, const char *type_name, const char **pp, debug_type **slotp) { const char *orig; int typenums[2]; @@ -1306,9 +1306,9 @@ parse_stab_type (void *dhandle, struct stab_handle *info, const char *typename, fleep:T20=xsfleep: which define structures in terms of themselves. We need to tell the caller to avoid building a circular structure. */ - if (typename != NULL - && strncmp (typename, *pp, p - *pp) == 0 - && typename[p - *pp] == '\0') + if (type_name != NULL + && strncmp (type_name, *pp, p - *pp) == 0 + && type_name[p - *pp] == '\0') info->self_crossref = TRUE; dtype = stab_find_tagged_type (dhandle, info, *pp, p - *pp, code); @@ -1539,7 +1539,7 @@ parse_stab_type (void *dhandle, struct stab_handle *info, const char *typename, case 'r': /* Range type. */ - dtype = parse_stab_range_type (dhandle, info, typename, pp, typenums); + dtype = parse_stab_range_type (dhandle, info, type_name, pp, typenums); break; case 'b': @@ -1561,7 +1561,7 @@ parse_stab_type (void *dhandle, struct stab_handle *info, const char *typename, case 's': case 'u': /* Struct or union type. */ - dtype = parse_stab_struct_type (dhandle, info, typename, pp, + dtype = parse_stab_struct_type (dhandle, info, type_name, pp, descriptor == 's', typenums); break; @@ -1651,7 +1651,7 @@ parse_stab_type_number (const char **pp, int *typenums) /* Parse a range type. */ static debug_type -parse_stab_range_type (void *dhandle, struct stab_handle *info, const char *typename, const char **pp, const int *typenums) +parse_stab_range_type (void *dhandle, struct stab_handle *info, const char *type_name, const char **pp, const int *typenums) { const char *orig; int rangenums[2]; @@ -1750,11 +1750,11 @@ parse_stab_range_type (void *dhandle, struct stab_handle *info, const char *type long long int:t6=r1;0;-1; long long unsigned int:t7=r1;0;-1; We hack here to handle this reasonably. */ - if (typename != NULL) + if (type_name != NULL) { - if (strcmp (typename, "long long int") == 0) + if (strcmp (type_name, "long long int") == 0) return debug_make_int_type (dhandle, 8, FALSE); - else if (strcmp (typename, "long long unsigned int") == 0) + else if (strcmp (type_name, "long long unsigned int") == 0) return debug_make_int_type (dhandle, 8, TRUE); } /* FIXME: The size here really depends upon the target. */ @@ -2117,7 +2117,7 @@ parse_stab_baseclasses (void *dhandle, struct stab_handle *info, for (i = 0; i < c; i++) { - bfd_boolean virtual; + bfd_boolean is_virtual; enum debug_visibility visibility; bfd_vma bitpos; debug_type type; @@ -2125,14 +2125,14 @@ parse_stab_baseclasses (void *dhandle, struct stab_handle *info, switch (**pp) { case '0': - virtual = FALSE; + is_virtual = FALSE; break; case '1': - virtual = TRUE; + is_virtual = TRUE; break; default: warn_stab (orig, _("unknown virtual character for baseclass")); - virtual = FALSE; + is_virtual = FALSE; break; } ++*pp; @@ -2171,7 +2171,7 @@ parse_stab_baseclasses (void *dhandle, struct stab_handle *info, if (type == DEBUG_TYPE_NULL) return FALSE; - classes[i] = debug_make_baseclass (dhandle, type, bitpos, virtual, + classes[i] = debug_make_baseclass (dhandle, type, bitpos, is_virtual, visibility); if (classes[i] == DEBUG_BASECLASS_NULL) return FALSE; @@ -2296,7 +2296,7 @@ parse_stab_cpp_abbrev (void *dhandle, struct stab_handle *info, int cpp_abbrev; debug_type context; const char *name; - const char *typename; + const char *type_name; debug_type type; bfd_vma bitpos; @@ -2332,13 +2332,13 @@ parse_stab_cpp_abbrev (void *dhandle, struct stab_handle *info, break; case 'b': /* $vb -- a virtual bsomethingorother */ - typename = debug_get_type_name (dhandle, context); - if (typename == NULL) + type_name = debug_get_type_name (dhandle, context); + if (type_name == NULL) { warn_stab (orig, _("unnamed $vb type")); - typename = "FOO"; + type_name = "FOO"; } - name = concat ("_vb$", typename, (const char *) NULL); + name = concat ("_vb$", type_name, (const char *) NULL); break; default: warn_stab (orig, _("unrecognized C++ abbreviation")); diff --git a/binutils/strings.c b/binutils/strings.c index 06fd8e995b7..dc2d8f24219 100644 --- a/binutils/strings.c +++ b/binutils/strings.c @@ -362,7 +362,7 @@ strings_a_section (bfd *abfd, asection *sect, void *arg) got_a_section = TRUE; print_strings (filename_and_sizep->filename, NULL, sect->filepos, - 0, sectsize, mem); + 0, sectsize, (char *) mem); } free (mem); diff --git a/binutils/wrstabs.c b/binutils/wrstabs.c index abbc6ad87db..027cad273a0 100644 --- a/binutils/wrstabs.c +++ b/binutils/wrstabs.c @@ -1,6 +1,6 @@ /* wrstabs.c -- Output stabs debugging information - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007 - Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, + 2007, 2009 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of GNU Binutils. @@ -1545,7 +1545,7 @@ stab_class_static_member (void *p, const char *name, const char *physname, /* Add a base class to the class on the type stack. */ static bfd_boolean -stab_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean virtual, +stab_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean is_virtual, enum debug_visibility visibility) { struct stab_write_handle *info = (struct stab_write_handle *) p; @@ -1561,7 +1561,7 @@ stab_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean virtual, /* Build the base class specifier. */ buf = (char *) xmalloc (strlen (s) + 25); - buf[0] = virtual ? '1' : '0'; + buf[0] = is_virtual ? '1' : '0'; switch (visibility) { default: