* [PATCH 5/9] constify remote-m32r-sdi.c
2015-03-20 16:56 [PATCH 0/9] minor constification Yao Qi
@ 2015-03-20 16:56 ` Yao Qi
2015-03-20 16:56 ` [PATCH 2/9] constify gdbserver/server.c Yao Qi
` (8 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Yao Qi @ 2015-03-20 16:56 UTC (permalink / raw)
To: gdb-patches
From: Pedro Alves <palves@redhat.com>
gdb:
2015-03-20 Pedro Alves <palves@redhat.com>
* remote-m32r-sdi.c (m32r_open): Make "port_str" const.
---
gdb/remote-m32r-sdi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index f7ea0b8..01cb5b6 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -362,7 +362,8 @@ m32r_open (const char *args, int from_tty)
{
struct hostent *host_ent;
struct sockaddr_in server_addr;
- char *port_str, hostname[256];
+ char hostname[256];
+ const char *port_str;
int port;
int i, n;
int yes = 1;
--
1.9.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/9] constify gdbserver/server.c
2015-03-20 16:56 [PATCH 0/9] minor constification Yao Qi
2015-03-20 16:56 ` [PATCH 5/9] constify remote-m32r-sdi.c Yao Qi
@ 2015-03-20 16:56 ` Yao Qi
2015-03-20 16:56 ` [PATCH 7/9] constify tui/tui-io.c Yao Qi
` (7 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Yao Qi @ 2015-03-20 16:56 UTC (permalink / raw)
To: gdb-patches
From: Pedro Alves <palves@redhat.com>
gdb/gdbserver/
2015-03-20 Pedro Alves <palves@redhat.com>
* server.c (handle_general_set): Make "req_str" const.
---
gdb/gdbserver/server.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 08dbb60..96b31b8 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -591,7 +591,7 @@ handle_general_set (char *own_buf)
{
char *mode = own_buf + 9;
int req = -1;
- char *req_str;
+ const char *req_str;
if (strcmp (mode, "0") == 0)
req = 0;
--
1.9.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 7/9] constify tui/tui-io.c
2015-03-20 16:56 [PATCH 0/9] minor constification Yao Qi
2015-03-20 16:56 ` [PATCH 5/9] constify remote-m32r-sdi.c Yao Qi
2015-03-20 16:56 ` [PATCH 2/9] constify gdbserver/server.c Yao Qi
@ 2015-03-20 16:56 ` Yao Qi
2015-03-20 16:57 ` [PATCH 8/9] constify set_breakpoint_condition Yao Qi
` (6 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Yao Qi @ 2015-03-20 16:56 UTC (permalink / raw)
To: gdb-patches
From: Pedro Alves <palves@redhat.com>
gdb:
2015-03-20 Pedro Alves <palves@redhat.com>
* tui/tui-io.c (tui_expand_tabs): Make "s1" const.
---
gdb/tui/tui-io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index a8af9b6..c8b8567 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -692,7 +692,7 @@ tui_expand_tabs (const char *string, int col)
/* 2. Copy the original string while replacing TABs with spaces. */
for (s = string; s; )
{
- char *s1 = strpbrk (s, "\t");
+ const char *s1 = strpbrk (s, "\t");
if (s1)
{
if (s1 > s)
--
1.9.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 8/9] constify set_breakpoint_condition
2015-03-20 16:56 [PATCH 0/9] minor constification Yao Qi
` (2 preceding siblings ...)
2015-03-20 16:56 ` [PATCH 7/9] constify tui/tui-io.c Yao Qi
@ 2015-03-20 16:57 ` Yao Qi
2015-03-20 16:57 ` [PATCH 4/9] constify nto-tdep.c Yao Qi
` (5 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Yao Qi @ 2015-03-20 16:57 UTC (permalink / raw)
To: gdb-patches
From: Pedro Alves <palves@redhat.com>
gdb:
2015-03-20 Pedro Alves <palves@redhat.com>
* breakpoint.c (set_breakpoint_condition): Make argument "exp" const.
* breakpoint.h (set_breakpoint_condition): Update declaration.
---
gdb/breakpoint.c | 2 +-
gdb/breakpoint.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 0c000f2..13c8949 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -957,7 +957,7 @@ get_first_locp_gte_addr (CORE_ADDR address)
}
void
-set_breakpoint_condition (struct breakpoint *b, char *exp,
+set_breakpoint_condition (struct breakpoint *b, const char *exp,
int from_tty)
{
xfree (b->cond_string);
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index b85939a..562a6b6 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1525,7 +1525,7 @@ extern int breakpoints_should_be_inserted_now (void);
extern void breakpoint_retire_moribund (void);
/* Set break condition of breakpoint B to EXP. */
-extern void set_breakpoint_condition (struct breakpoint *b, char *exp,
+extern void set_breakpoint_condition (struct breakpoint *b, const char *exp,
int from_tty);
/* Checks if we are catching syscalls or not.
--
1.9.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 4/9] constify nto-tdep.c
2015-03-20 16:56 [PATCH 0/9] minor constification Yao Qi
` (3 preceding siblings ...)
2015-03-20 16:57 ` [PATCH 8/9] constify set_breakpoint_condition Yao Qi
@ 2015-03-20 16:57 ` Yao Qi
2015-03-20 16:57 ` [PATCH 9/9] constify i386-sol2-tdep.c and machoread.c Yao Qi
` (4 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Yao Qi @ 2015-03-20 16:57 UTC (permalink / raw)
To: gdb-patches
From: Pedro Alves <palves@redhat.com>
/home/pedro/gdb/mygit/src/gdb/nto-tdep.c: In function âint nto_find_and_open_solib(char*, unsigned int, char**)â:
/home/pedro/gdb/mygit/src/gdb/nto-tdep.c:111:14: error: invalid conversion from âconst char*â to âchar*â [-fpermissive]
endian = gdbarch_byte_order (target_gdbarch ())
^
/home/pedro/gdb/mygit/src/gdb/nto-tdep.c: In function âvoid nto_init_solib_absolute_prefix()â:
/home/pedro/gdb/mygit/src/gdb/nto-tdep.c:170:14: error: invalid conversion from âconst char*â to âchar*â [-fpermissive]
endian = gdbarch_byte_order (target_gdbarch ())
^
gdb
2015-03-20 Pedro Alves <palves@redhat.com>
* nto-tdep.c (nto_find_and_open_solib): Make "endian" const.
(nto_init_solib_absolute_prefix): Likewise.
---
gdb/nto-tdep.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index 93c230c..ba3c845 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -84,7 +84,8 @@ nto_map_arch_to_cputype (const char *arch)
int
nto_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname)
{
- char *buf, *arch_path, *nto_root, *endian;
+ char *buf, *arch_path, *nto_root;
+ const char *endian;
const char *base;
const char *arch;
int arch_len, len, ret;
@@ -147,7 +148,8 @@ void
nto_init_solib_absolute_prefix (void)
{
char buf[PATH_MAX * 2], arch_path[PATH_MAX];
- char *nto_root, *endian;
+ char *nto_root;
+ const char *endian;
const char *arch;
nto_root = nto_target ();
--
1.9.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 9/9] constify i386-sol2-tdep.c and machoread.c
2015-03-20 16:56 [PATCH 0/9] minor constification Yao Qi
` (4 preceding siblings ...)
2015-03-20 16:57 ` [PATCH 4/9] constify nto-tdep.c Yao Qi
@ 2015-03-20 16:57 ` Yao Qi
2015-03-20 16:57 ` [PATCH 6/9] constify xcoffread.c Yao Qi
` (3 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Yao Qi @ 2015-03-20 16:57 UTC (permalink / raw)
To: gdb-patches
From: Pedro Alves <palves@redhat.com>
/home/pedro/gdb/mygit/src/gdb/i386-sol2-tdep.c: In function âconst char* i386_sol2_static_transform_name(const char*)â:
/home/pedro/gdb/mygit/src/gdb/i386-sol2-tdep.c:93:29: error: invalid conversion from âconst char*â to âchar*â [-fpermissive]
p = strrchr (name, '.');
^
gdb:
2015-03-20 Pedro Alves <palves@redhat.com>
* i386-sol2-tdep.c (i386_sol2_static_transform_name): Move "p" to
inner block and make it const.
* machoread.c (get_archive_prefix_len): Make "lparen" const.
---
gdb/i386-sol2-tdep.c | 3 ++-
gdb/machoread.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/gdb/i386-sol2-tdep.c b/gdb/i386-sol2-tdep.c
index af783df..59f9be7 100644
--- a/gdb/i386-sol2-tdep.c
+++ b/gdb/i386-sol2-tdep.c
@@ -80,9 +80,10 @@ i386_sol2_mcontext_addr (struct frame_info *this_frame)
static const char *
i386_sol2_static_transform_name (const char *name)
{
- char *p;
if (name[0] == '.')
{
+ const char *p;
+
/* For file-local statics there will be a period, a bunch of
junk (the contents of which match a string given in the
N_OPT), a period and the name. For function-local statics
diff --git a/gdb/machoread.c b/gdb/machoread.c
index 831bbcb..675155e 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -343,7 +343,7 @@ macho_symtab_read (struct objfile *objfile,
static int
get_archive_prefix_len (const char *name)
{
- char *lparen;
+ const char *lparen;
int name_len = strlen (name);
if (name_len == 0 || name[name_len - 1] != ')')
--
1.9.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 6/9] constify xcoffread.c
2015-03-20 16:56 [PATCH 0/9] minor constification Yao Qi
` (5 preceding siblings ...)
2015-03-20 16:57 ` [PATCH 9/9] constify i386-sol2-tdep.c and machoread.c Yao Qi
@ 2015-03-20 16:57 ` Yao Qi
2015-03-20 16:57 ` [PATCH 1/9] constify sparc-sol2-tdep.c and spu-tdep.c Yao Qi
` (2 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Yao Qi @ 2015-03-20 16:57 UTC (permalink / raw)
To: gdb-patches
From: Pedro Alves <palves@redhat.com>
/home/pedro/gdb/mygit/src/gdb/xcoffread.c: In function âvoid scan_xcoff_symtab(objfile*)â:
/home/pedro/gdb/mygit/src/gdb/xcoffread.c:2644:33: error: invalid conversion from âconst char*â to âchar*â [-fpermissive]
p = strchr (namestring, ':');
^
gdb:
2015-03-20 Pedro Alves <palves@redhat.com>
* xcoffread.c (scan_xcoff_symtab): Make "p" and "q" const.
---
gdb/xcoffread.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 3cb6eda..9571ac8 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -2636,7 +2636,7 @@ scan_xcoff_symtab (struct objfile *objfile)
case C_DECL:
case C_STSYM:
{
- char *p;
+ const char *p;
swap_sym (&symbol, &main_aux[0], &namestring, &sraw_symbol,
&ssymnum, objfile);
@@ -2763,7 +2763,7 @@ scan_xcoff_symtab (struct objfile *objfile)
Accept either. */
while (*p && *p != ';' && *p != ',')
{
- char *q;
+ const char *q;
/* Check for and handle cretinous dbx symbol name
continuation! */
--
1.9.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/9] constify sparc-sol2-tdep.c and spu-tdep.c
2015-03-20 16:56 [PATCH 0/9] minor constification Yao Qi
` (6 preceding siblings ...)
2015-03-20 16:57 ` [PATCH 6/9] constify xcoffread.c Yao Qi
@ 2015-03-20 16:57 ` Yao Qi
2015-03-20 16:57 ` [PATCH 3/9] constify gdbserver/tracepoint.c Yao Qi
2015-03-20 17:05 ` [PATCH 0/9] minor constification Pedro Alves
9 siblings, 0 replies; 12+ messages in thread
From: Yao Qi @ 2015-03-20 16:57 UTC (permalink / raw)
To: gdb-patches
From: Pedro Alves <palves@redhat.com>
/home/pedro/gdb/mygit/src/gdb/sparc-sol2-tdep.c: In function âconst char* sparc_sol2_static_transform_name(const char*)â:
/home/pedro/gdb/mygit/src/gdb/sparc-sol2-tdep.c:247:35: error: invalid conversion from âconst char*â to âchar*â [-fpermissive]
char *p = strrchr (name, '.');
^
gdb:
2015-03-20 Pedro Alves <palves@redhat.com>
* sparc-sol2-tdep.c (sparc_sol2_static_transform_name): Make "p" const.
* spu-tdep.c (spu_gdbarch_init): Make "name" const.
---
gdb/sparc-sol2-tdep.c | 2 +-
gdb/spu-tdep.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/sparc-sol2-tdep.c b/gdb/sparc-sol2-tdep.c
index 1aabe76..5afe308 100644
--- a/gdb/sparc-sol2-tdep.c
+++ b/gdb/sparc-sol2-tdep.c
@@ -244,7 +244,7 @@ sparc_sol2_static_transform_name (const char *name)
if (name[0] == '$')
{
- char *p = strrchr (name, '.');
+ const char *p = strrchr (name, '.');
if (p)
return p + 1;
}
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 36ad312..6ccb679 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -2698,7 +2698,7 @@ spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
This assumes the filename convention employed by solib-spu.c. */
else if (info.abfd)
{
- char *name = strrchr (info.abfd->filename, '@');
+ const char *name = strrchr (info.abfd->filename, '@');
if (name)
sscanf (name, "@0x%*x <%d>", &id);
}
--
1.9.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/9] constify gdbserver/tracepoint.c
2015-03-20 16:56 [PATCH 0/9] minor constification Yao Qi
` (7 preceding siblings ...)
2015-03-20 16:57 ` [PATCH 1/9] constify sparc-sol2-tdep.c and spu-tdep.c Yao Qi
@ 2015-03-20 16:57 ` Yao Qi
2015-03-20 17:05 ` [PATCH 0/9] minor constification Pedro Alves
9 siblings, 0 replies; 12+ messages in thread
From: Yao Qi @ 2015-03-20 16:57 UTC (permalink / raw)
To: gdb-patches
From: Pedro Alves <palves@redhat.com>
gdb/gdbserver/tracepoint.c:3647:7: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
gdb/gdbserver/tracepoint.c:3652:7: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
gdb/gdbserver/tracepoint.c:3657:7: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
gdb/gdbserver
2015-03-20 Pedro Alves <palves@redhat.com>
* tracepoint.c (cmd_qtstatus): Make "str" const.
---
gdb/gdbserver/tracepoint.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 42b27c0..3ce9580 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -3615,7 +3615,8 @@ static void
cmd_qtstatus (char *packet)
{
char *stop_reason_rsp = NULL;
- char *buf1, *buf2, *buf3, *str;
+ char *buf1, *buf2, *buf3;
+ const char *str;
int slen;
/* Translate the plain text of the notes back into hex for
--
1.9.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/9] minor constification
2015-03-20 16:56 [PATCH 0/9] minor constification Yao Qi
` (8 preceding siblings ...)
2015-03-20 16:57 ` [PATCH 3/9] constify gdbserver/tracepoint.c Yao Qi
@ 2015-03-20 17:05 ` Pedro Alves
2015-03-20 17:44 ` Yao Qi
9 siblings, 1 reply; 12+ messages in thread
From: Pedro Alves @ 2015-03-20 17:05 UTC (permalink / raw)
To: Yao Qi, gdb-patches
On 03/20/2015 04:56 PM, Yao Qi wrote:
> From: Yao Qi <yao.qi@linaro.org>
>
> Hi,
> I have some cycles on the Friday afternoon, and am able to give some
> help on c++ conversion project. This patch set includes some commits
> from
> https://github.com/palves/gdb/commits/palves/cxx-conversion-attempt-part-2-no-fpermissive
> I add the ChangeLog and commit logs for them. These patches are
> straightforward.
>
> I rebuild GDB with all targets enabled.
>
That is so awesome! Many thanks for doing this.
All looks good to me. :-)
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 12+ messages in thread