aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-04-05 19:21:34 +0100
committerPedro Alves <palves@redhat.com>2017-04-05 19:21:34 +0100
commit7a1149643d8621541025e2c70e6391e901c8c7ef (patch)
tree0e9b2b60dcb66d50bc41dec2201a1223693bd42c /gdb/target.c
parent69bbf465237819bd7bf2a21a682d695273b3c8cb (diff)
-Wwrite-strings: Constify target_pid_to_str and target_thread_extra_thread_info
-Wwrite-strings flagged a missing cast for example here: static char * ravenscar_extra_thread_info (struct target_ops *self, struct thread_info *tp) { return "Ravenscar task"; Since callers are not supposed to free the string returned by these methods, change the methods' signature to return const strings. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * aix-thread.c (aix_thread_pid_to_str) (aix_thread_extra_thread_info): Constify. * bsd-kvm.c (bsd_kvm_pid_to_str): Constify. * bsd-uthread.c (bsd_uthread_extra_thread_info) (bsd_uthread_pid_to_str): Constify. * corelow.c (core_pid_to_str): Constify. * darwin-nat.c (darwin_pid_to_str): Constify. * fbsd-nat.c (fbsd_pid_to_str): Constify. * fbsd-tdep.c (fbsd_core_pid_to_str, gdbarch_core_pid_to_str): Constify. * gnu-nat.c (gnu_pid_to_str): Constify. * go32-nat.c (go32_pid_to_str): Constify. * i386-cygwin-tdep.c (i386_windows_core_pid_to_str): Constify. * inf-ptrace.c (inf_ptrace_pid_to_str): Constify. * inferior.c (inferior_pid_to_str): Constify. * linux-nat.c (linux_nat_pid_to_str): Constify. * linux-tdep.c (linux_core_pid_to_str): Constify. * linux-thread-db.c (thread_db_pid_to_str) (thread_db_extra_thread_info): Constify. * nto-tdep.c (nto_extra_thread_info): Constify. * nto-tdep.h (nto_extra_thread_info): Constify. * obsd-nat.c (obsd_pid_to_str): Constify. * procfs.c (procfs_pid_to_str): Constify. * ravenscar-thread.c (ravenscar_extra_thread_info) (ravenscar_pid_to_str): Constify. * remote-sim.c (gdbsim_pid_to_str): Constify. * remote.c (remote_threads_extra_info, remote_pid_to_str): Constify. * sol-thread.c (solaris_pid_to_str): Constify. * sol2-tdep.c (sol2_core_pid_to_str): Constify. * sol2-tdep.h (sol2_core_pid_to_str): Constify. * target.c (default_pid_to_str, target_pid_to_str) (normal_pid_to_str, default_pid_to_str): Constify. * target.h (target_ops::to_pid_to_str) (target_ops::to_extra_thread_info): Constify. (target_pid_to_str, normal_pid_to_str): Constify. * windows-nat.c (windows_pid_to_str): Constify. * gdbarch.sh (core_pid_to_str): Constify. * target-delegates.c: Regenerate. * gdbarch.h, gdbarch.c: Regenerate.
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 7c286ab6bf..fd9181ee30 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -103,7 +103,7 @@ static int dummy_find_memory_regions (struct target_ops *self,
static char *dummy_make_corefile_notes (struct target_ops *self,
bfd *ignore1, int *ignore2);
-static char *default_pid_to_str (struct target_ops *ops, ptid_t ptid);
+static const char *default_pid_to_str (struct target_ops *ops, ptid_t ptid);
static enum exec_direction_kind default_execution_direction
(struct target_ops *self);
@@ -2303,7 +2303,7 @@ default_target_wait (struct target_ops *ops,
return minus_one_ptid;
}
-char *
+const char *
target_pid_to_str (ptid_t ptid)
{
return (*current_target.to_pid_to_str) (&current_target, ptid);
@@ -3344,7 +3344,7 @@ generic_mourn_inferior (void)
/* Convert a normal process ID to a string. Returns the string in a
static buffer. */
-char *
+const char *
normal_pid_to_str (ptid_t ptid)
{
static char buf[32];
@@ -3353,7 +3353,7 @@ normal_pid_to_str (ptid_t ptid)
return buf;
}
-static char *
+static const char *
default_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
return normal_pid_to_str (ptid);