bfd_get_filename
This macro says: /* Cast from const char * to char * so that caller can assign to a char * without a warning. */ I reckon that isn't such a good idea since it can result in char* variables where const char* is appropriate. Not very many places need the char* cast. bfd/ * aout-target.h (object_p): Formatting. * bfd-in.h (bfd_get_filename): Don't cast to char*. * corefile.c (generic_core_file_matches_executable_p): Constify variables and remove cast. * bfd-in2.h: Regenerate. binutils/ * nm.c (print_object_filename_bsd, print_object_filename_sysv), (print_object_filename_posix, print_archive_filename_bsd), (print_archive_filename_sysv, print_archive_filename_posix), (print_archive_member_bsd, print_archive_member_sysv), (print_archive_member_posix): Constify parameter. (struct output_fns <print_object_filename, print_archive_filename>), (<print_archive_member>): Likewise. * objcopy.c (copy_archive): Add cast for make_tempdir. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_search_needed): Constify variable. * emultempl/pe.em (gld_${EMULATION_NAME}_after_open): Likewise. * emultempl/pep.em (gld_${EMULATION_NAME}_after_open): Likewise. gdb/ * coffread.c (coff_symfile_read): Constify filename variable. * dbxread.c (dbx_symfile_init, coffstab_build_psymtabs), (elfstab_build_psymtabs, stabsect_build_psymtabs): Likewise. * gdb_bfd.c (gdb_bfd_close_or_warn): Likewise. * solib.c (reload_shared_libraries_1): Likewise. * symfile.c (reread_symbols): Likewise. * solib-aix.c (solib_aix_bfd_open): Add cast for xfree of filename. * solib-darwin.c (darwin_bfd_open): Likewise. * symfile-mem.c (symbol_file_add_from_memory): Likewise. sim/cris/ * sim-if.c (sim_open): Constify filename variable.
This commit is contained in:
parent
6ade8373c9
commit
b16c44debc
23 changed files with 87 additions and 49 deletions
|
@ -77,15 +77,15 @@ struct extended_symbol_info
|
|||
(sym->elfinfo ? sym->elfinfo->internal_elf_sym.st_size: sym->ssize)
|
||||
|
||||
/* The output formatting functions. */
|
||||
static void print_object_filename_bsd (char *);
|
||||
static void print_object_filename_sysv (char *);
|
||||
static void print_object_filename_posix (char *);
|
||||
static void print_archive_filename_bsd (char *);
|
||||
static void print_archive_filename_sysv (char *);
|
||||
static void print_archive_filename_posix (char *);
|
||||
static void print_archive_member_bsd (char *, const char *);
|
||||
static void print_archive_member_sysv (char *, const char *);
|
||||
static void print_archive_member_posix (char *, const char *);
|
||||
static void print_object_filename_bsd (const char *);
|
||||
static void print_object_filename_sysv (const char *);
|
||||
static void print_object_filename_posix (const char *);
|
||||
static void print_archive_filename_bsd (const char *);
|
||||
static void print_archive_filename_sysv (const char *);
|
||||
static void print_archive_filename_posix (const char *);
|
||||
static void print_archive_member_bsd (const char *, const char *);
|
||||
static void print_archive_member_sysv (const char *, const char *);
|
||||
static void print_archive_member_posix (const char *, const char *);
|
||||
static void print_symbol_filename_bsd (bfd *, bfd *);
|
||||
static void print_symbol_filename_sysv (bfd *, bfd *);
|
||||
static void print_symbol_filename_posix (bfd *, bfd *);
|
||||
|
@ -98,13 +98,13 @@ static void print_symbol_info_posix (struct extended_symbol_info *, bfd *);
|
|||
struct output_fns
|
||||
{
|
||||
/* Print the name of an object file given on the command line. */
|
||||
void (*print_object_filename) (char *);
|
||||
void (*print_object_filename) (const char *);
|
||||
|
||||
/* Print the name of an archive file given on the command line. */
|
||||
void (*print_archive_filename) (char *);
|
||||
void (*print_archive_filename) (const char *);
|
||||
|
||||
/* Print the name of an archive member file. */
|
||||
void (*print_archive_member) (char *, const char *);
|
||||
void (*print_archive_member) (const char *, const char *);
|
||||
|
||||
/* Print the name of the file (and archive, if there is one)
|
||||
containing a symbol. */
|
||||
|
@ -1357,14 +1357,14 @@ display_file (char *filename)
|
|||
/* Print the name of an object file given on the command line. */
|
||||
|
||||
static void
|
||||
print_object_filename_bsd (char *filename)
|
||||
print_object_filename_bsd (const char *filename)
|
||||
{
|
||||
if (filename_per_file && !filename_per_symbol)
|
||||
printf ("\n%s:\n", filename);
|
||||
}
|
||||
|
||||
static void
|
||||
print_object_filename_sysv (char *filename)
|
||||
print_object_filename_sysv (const char *filename)
|
||||
{
|
||||
if (undefined_only)
|
||||
printf (_("\n\nUndefined symbols from %s:\n\n"), filename);
|
||||
|
@ -1379,7 +1379,7 @@ Name Value Class Type Size
|
|||
}
|
||||
|
||||
static void
|
||||
print_object_filename_posix (char *filename)
|
||||
print_object_filename_posix (const char *filename)
|
||||
{
|
||||
if (filename_per_file && !filename_per_symbol)
|
||||
printf ("%s:\n", filename);
|
||||
|
@ -1388,26 +1388,26 @@ print_object_filename_posix (char *filename)
|
|||
/* Print the name of an archive file given on the command line. */
|
||||
|
||||
static void
|
||||
print_archive_filename_bsd (char *filename)
|
||||
print_archive_filename_bsd (const char *filename)
|
||||
{
|
||||
if (filename_per_file)
|
||||
printf ("\n%s:\n", filename);
|
||||
}
|
||||
|
||||
static void
|
||||
print_archive_filename_sysv (char *filename ATTRIBUTE_UNUSED)
|
||||
print_archive_filename_sysv (const char *filename ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
print_archive_filename_posix (char *filename ATTRIBUTE_UNUSED)
|
||||
print_archive_filename_posix (const char *filename ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
/* Print the name of an archive member file. */
|
||||
|
||||
static void
|
||||
print_archive_member_bsd (char *archive ATTRIBUTE_UNUSED,
|
||||
print_archive_member_bsd (const char *archive ATTRIBUTE_UNUSED,
|
||||
const char *filename)
|
||||
{
|
||||
if (!filename_per_symbol)
|
||||
|
@ -1415,7 +1415,7 @@ print_archive_member_bsd (char *archive ATTRIBUTE_UNUSED,
|
|||
}
|
||||
|
||||
static void
|
||||
print_archive_member_sysv (char *archive, const char *filename)
|
||||
print_archive_member_sysv (const char *archive, const char *filename)
|
||||
{
|
||||
if (undefined_only)
|
||||
printf (_("\n\nUndefined symbols from %s[%s]:\n\n"), archive, filename);
|
||||
|
@ -1430,7 +1430,7 @@ Name Value Class Type Size
|
|||
}
|
||||
|
||||
static void
|
||||
print_archive_member_posix (char *archive, const char *filename)
|
||||
print_archive_member_posix (const char *archive, const char *filename)
|
||||
{
|
||||
if (!filename_per_symbol)
|
||||
printf ("%s[%s]:\n", archive, filename);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue