public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb: constify remote files_info
@ 2010-04-10 20:52 Mike Frysinger
  2010-04-12 15:00 ` Joel Brobecker
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2010-04-10 20:52 UTC (permalink / raw)
  To: gdb-patches

The sim and m32r remote targets declare a local "file" variable and only
assign const strings to it before passing it to a printf() func.  So add
const markings to avoid gcc warnings like:
gdb/remote-sim.c: In function 'gdbsim_files_info':
gdb/remote-sim.c:789: warning: initialization discards qualifiers
	from pointer target type

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
2010-04-10  Mike Frysinger  <vapier@gentoo.org>

	* remote-m32r-sdi.c (m32r_files_info): Add const to local "file" var.
	* remote-sim.c (gdbsim_files_info): Likewise.

 gdb/remote-m32r-sdi.c |    2 +-
 gdb/remote-sim.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index be6a564..a74075b 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -1020,7 +1020,7 @@ m32r_prepare_to_store (struct regcache *regcache)
 static void
 m32r_files_info (struct target_ops *target)
 {
-  char *file = "nothing";
+  const char *file = "nothing";
 
   if (exec_bfd)
     {
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 9f1adc7..53f3109 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -793,7 +793,7 @@ gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
 static void
 gdbsim_files_info (struct target_ops *target)
 {
-  char *file = "nothing";
+  const char *file = "nothing";
 
   if (exec_bfd)
     file = bfd_get_filename (exec_bfd);
-- 
1.7.0.2

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gdb: constify remote files_info
  2010-04-10 20:52 [PATCH] gdb: constify remote files_info Mike Frysinger
@ 2010-04-12 15:00 ` Joel Brobecker
  0 siblings, 0 replies; 3+ messages in thread
From: Joel Brobecker @ 2010-04-12 15:00 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: gdb-patches

> 2010-04-10  Mike Frysinger  <vapier@gentoo.org>
> 
> 	* remote-m32r-sdi.c (m32r_files_info): Add const to local "file" var.
> 	* remote-sim.c (gdbsim_files_info): Likewise.

This is OK.

Thank you,
-- 
Joel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] gdb: constify remote files_info
@ 2010-04-10 21:58 Mike Frysinger
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2010-04-10 21:58 UTC (permalink / raw)
  To: gdb-patches

The sim and m32r remote targets declare a local "file" variable and only
assign const strings to it before passing it to a printf() func.  So add
const markings to avoid gcc warnings like:
gdb/remote-sim.c: In function 'gdbsim_files_info':
gdb/remote-sim.c:789: warning: initialization discards qualifiers
	from pointer target type

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
2010-04-10  Mike Frysinger  <vapier@gentoo.org>

	* remote-m32r-sdi.c (m32r_files_info): Add const to local "file" var.
	* remote-sim.c (gdbsim_files_info): Likewise.

 gdb/remote-m32r-sdi.c |    2 +-
 gdb/remote-sim.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index be6a564..a74075b 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -1020,7 +1020,7 @@ m32r_prepare_to_store (struct regcache *regcache)
 static void
 m32r_files_info (struct target_ops *target)
 {
-  char *file = "nothing";
+  const char *file = "nothing";
 
   if (exec_bfd)
     {
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 9f1adc7..53f3109 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -793,7 +793,7 @@ gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
 static void
 gdbsim_files_info (struct target_ops *target)
 {
-  char *file = "nothing";
+  const char *file = "nothing";
 
   if (exec_bfd)
     file = bfd_get_filename (exec_bfd);
-- 
1.7.0.2

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-04-12 15:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-10 20:52 [PATCH] gdb: constify remote files_info Mike Frysinger
2010-04-12 15:00 ` Joel Brobecker
2010-04-10 21:58 Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).