From b16c44debcf8a446e94e161e328169f5c8d5d811 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 6 Sep 2019 12:07:05 +0930 Subject: 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 ), (): 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. --- sim/cris/ChangeLog | 4 ++++ sim/cris/sim-if.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'sim') diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog index 5e26f3d..d37fc8f 100644 --- a/sim/cris/ChangeLog +++ b/sim/cris/ChangeLog @@ -1,3 +1,7 @@ +2019-09-06 Alan Modra + + * sim-if.c (sim_open): Constify filename variable. + 2018-12-06 Andrew Burgess * Makefile.in: Replace uses of CGEN_CPU_DIR with CPU_DIR, and diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c index 054cce5..1a5d421 100644 --- a/sim/cris/sim-if.c +++ b/sim/cris/sim-if.c @@ -746,7 +746,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd, specified. */ if (abfd != NULL && !cris_bare_iron) { - char *name = bfd_get_filename (abfd); + const char *name = bfd_get_filename (abfd); char **my_environ = GET_ENVIRON (); /* We use these maps to give the same behavior as the old xsim simulator. */ -- cgit v1.1