From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Subject: [PATCH] sim: constify watchpoint interrupt names
Date: Mon, 29 Mar 2010 21:49:00 -0000 [thread overview]
Message-ID: <1269899363-10054-1-git-send-email-vapier@gentoo.org> (raw)
GCC issues warnings because const strings like "foo" are passed as char*.
sim-watch.c: In function 'watchpoint_type_to_str':
sim-watch.c:120: warning: return discards qualifiers from pointer target type
sim-watch.c:122: warning: return discards qualifiers from pointer target type
sim-watch.c:124: warning: return discards qualifiers from pointer target type
sim-watch.c:127: warning: return discards qualifiers from pointer target type
sim-watch.c: In function 'interrupt_nr_to_str':
sim-watch.c:138: warning: return discards qualifiers from pointer target type
sim-watch.c:140: warning: return discards qualifiers from pointer target type
sim-watch.c: At top level:
sim-watch.c:385: warning: initialization discards qualifiers from pointer target type
sim-watch.c: In function 'sim_watchpoint_install':
sim-watch.c:430: warning: initialization discards qualifiers from pointer target type
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
2010-03-29 Mike Frysinger <vapier@gentoo.org>
* sim-watch.c (watchpoint_type_to_str): Add const to return.
(interrupt_nr_to_str): Likewise.
(default_interrupt_names): Add const to pointer type.
(sim_watchpoint_install): Add const to prefix.
* sim-watch.h (struct _sim_watchpoints): Add const to interrupt_names.
sim/common/sim-watch.c | 8 ++++----
sim/common/sim-watch.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/sim/common/sim-watch.c b/sim/common/sim-watch.c
index df8e1b8..17125af 100644
--- a/sim/common/sim-watch.c
+++ b/sim/common/sim-watch.c
@@ -109,7 +109,7 @@ do_watchpoint_delete (SIM_DESC sd,
return status;
}
-static char *
+static const char *
watchpoint_type_to_str (SIM_DESC sd,
watchpoint_type type)
{
@@ -128,7 +128,7 @@ watchpoint_type_to_str (SIM_DESC sd,
return NULL;
}
-static char *
+static const char *
interrupt_nr_to_str (SIM_DESC sd,
int interrupt_nr)
{
@@ -381,7 +381,7 @@ static const OPTION watchpoint_options[] =
{ {NULL, no_argument, NULL, 0}, '\0', NULL, NULL, NULL }
};
-static char *default_interrupt_names[] = { "int", 0, };
+static const char *default_interrupt_names[] = { "int", 0, };
@@ -425,7 +425,7 @@ sim_watchpoint_install (SIM_DESC sd)
/* adjust first few entries so that they contain real
documentation, the first entry includes a list of actions. */
{
- char *prefix =
+ const char *prefix =
"Watch the simulator, take ACTION in COUNT cycles (`+' for every COUNT cycles), ACTION is";
char *doc;
int len = strlen (prefix) + 1;
diff --git a/sim/common/sim-watch.h b/sim/common/sim-watch.h
index 65be89f..2945f8d 100644
--- a/sim/common/sim-watch.h
+++ b/sim/common/sim-watch.h
@@ -63,7 +63,7 @@ typedef struct _sim_watchpoints {
/* FIXME: can this be done better? Look at the PPC's interrupt
mechanism and table for a rough idea of where it will go next */
int nr_interrupts;
- char **interrupt_names;
+ const char **interrupt_names;
/* active watchpoints */
int last_point_nr;
--
1.7.0.2
next reply other threads:[~2010-03-29 21:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-29 21:49 Mike Frysinger [this message]
2010-03-30 16:19 ` Tom Tromey
2010-03-30 22:53 ` Hans-Peter Nilsson
2010-03-30 23:07 ` Mike Frysinger
2010-03-30 23:21 ` Hans-Peter Nilsson
2010-03-30 23:42 ` Mike Frysinger
2010-03-31 1:20 ` Doug Evans
2010-03-31 1:46 ` Hans-Peter Nilsson
2010-03-31 3:42 ` Mike Frysinger
2010-03-31 23:43 ` Doug Evans
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1269899363-10054-1-git-send-email-vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox