From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27091 invoked by alias); 15 Mar 2013 17:32:31 -0000 Received: (qmail 27083 invoked by uid 22791); 15 Mar 2013 17:32:29 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from multi.imgtec.com (HELO multi.imgtec.com) (194.200.65.239) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 15 Mar 2013 17:32:20 +0000 From: "Steve Ellcey " Date: Fri, 15 Mar 2013 17:37:00 -0000 To: Subject: [patch, simulator] Fix sim_command_completer arguments. User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-ID: <2642b17f-5e3b-41b2-a985-ffcaa9220e95@BAMAIL02.ba.imgtec.org> X-SEF-Processed: 7_3_0_01181__2013_03_15_17_32_08 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-03/txt/msg00678.txt.bz2 My build of gdb and sim have recently started failing with: /local/home/sellcey/nightly2/src/gdb/gdb/remote-sim.c: In function '_initialize_remote_sim': /local/home/sellcey/nightly2/src/gdb/gdb/remote-sim.c:1323: error: passing argument 2 of 'set_cmd_completer' from incompatible pointer type /local/home/sellcey/nightly2/src/gdb/gdb/command.h:161: note: expected 'struct VEC_char_ptr * (*)(struct cmd_list_element *, const char *, const char *)' but argument is of type 'struct VEC_char_ptr * (*)(struct cmd_list_element *, char *, char *)' I didn't see any change in gdb/sim that might be causing this but I am building with the latest (ToT) GCC and I think a change there might have caused GCC to start catching this discrepency in argument types. I would like to fix it by adding the 'const' modifier to the sim_command_completer text and word arguments so that its argument types match filename_completer, expression_completer, etc. Tested by building gdb and sim on mips-mti-elf. I didn't test all the platforms that I modified but unless I made a typo there shouldn't be any problems. OK to checkin? Steve Ellcey sellcey@mips.com gdb directory ChangeLog: 2013-03-15 Steve Ellcey * remote-sim.c (sim_command_completer): Make char arguments const. include directory ChangeLog: 2013-03-15 Steve Ellcey * remote-sim.c (sim_command_completer): Make char arguments const. sim directory ChangeLog: 2013-03-15 Steve Ellcey * arm/wrapper.c (sim_complete_command): Make char arguments const. * avr/interp.c (sim_complete_command): Ditto. * common/sim-options.c (sim_complete_command): Ditto. * cr16/interp.c (sim_complete_command): Ditto. * erc32/interf.c (sim_complete_command): Ditto. * m32c/gdb-if.c (sim_complete_command): Ditto. * microblaze/interp.c (sim_complete_command): Ditto. * ppc/sim_calls.c (sim_complete_command): Ditto. * rl78/gdb-if.c (sim_complete_command): Ditto. * rx/gdb-if.c (sim_complete_command): Ditto. * sh/interp.c (sim_complete_command): Ditto. Diffs for all three directories: diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 860eaf3..a578bbc 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -1196,7 +1196,8 @@ simulator_command (char *args, int from_tty) } static VEC (char_ptr) * -sim_command_completer (struct cmd_list_element *ignore, char *text, char *word) +sim_command_completer (struct cmd_list_element *ignore, const char *text, + const char *word) { struct sim_inferior_data *sim_data; char **tmp; diff --git a/include/gdb/remote-sim.h b/include/gdb/remote-sim.h index 43c22eb..113030c 100644 --- a/include/gdb/remote-sim.h +++ b/include/gdb/remote-sim.h @@ -278,7 +278,7 @@ void sim_do_command (SIM_DESC sd, char *cmd); /* Complete a command based on the available sim commands. Returns an array of possible matches. */ -char **sim_complete_command (SIM_DESC sd, char *text, char *word); +char **sim_complete_command (SIM_DESC sd, const char *text, const char *word); #ifdef __cplusplus } diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c index 7f794a3..a4b7683 100644 --- a/sim/arm/wrapper.c +++ b/sim/arm/wrapper.c @@ -945,7 +945,7 @@ sim_set_callbacks (ptr) } char ** -sim_complete_command (SIM_DESC sd, char *text, char *word) +sim_complete_command (SIM_DESC sd, const char *text, const char *word) { return NULL; } diff --git a/sim/avr/interp.c b/sim/avr/interp.c index a5212e7..23fc8dc 100644 --- a/sim/avr/interp.c +++ b/sim/avr/interp.c @@ -1855,7 +1855,7 @@ sim_set_callbacks (host_callback *ptr) } char ** -sim_complete_command (SIM_DESC sd, char *text, char *word) +sim_complete_command (SIM_DESC sd, const char *text, const char *word) { return NULL; } diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c index 73f84fb..fdc05a4 100644 --- a/sim/common/sim-options.c +++ b/sim/common/sim-options.c @@ -950,7 +950,7 @@ complete_option_list (char **ret, size_t *cnt, const struct option_list *ol, completed is stored in @word. Trailing text of @word is not. */ char ** -sim_complete_command (SIM_DESC sd, char *text, char *word) +sim_complete_command (SIM_DESC sd, const char *text, const char *word) { char **ret = NULL; size_t cnt = 1; diff --git a/sim/cr16/interp.c b/sim/cr16/interp.c index 2caffc2..3af58f6 100644 --- a/sim/cr16/interp.c +++ b/sim/cr16/interp.c @@ -1553,7 +1553,7 @@ sim_store_register (sd, rn, memory, length) } char ** -sim_complete_command (SIM_DESC sd, char *text, char *word) +sim_complete_command (SIM_DESC sd, const char *text, const char *word) { return NULL; } diff --git a/sim/erc32/interf.c b/sim/erc32/interf.c index 1ec02be..e2db44e 100644 --- a/sim/erc32/interf.c +++ b/sim/erc32/interf.c @@ -485,7 +485,7 @@ sim_do_command(sd, cmd) } char ** -sim_complete_command (SIM_DESC sd, char *text, char *word) +sim_complete_command (SIM_DESC sd, const char *text, const char *word) { return NULL; } diff --git a/sim/m32c/gdb-if.c b/sim/m32c/gdb-if.c index d02d24e..83e9f1e 100644 --- a/sim/m32c/gdb-if.c +++ b/sim/m32c/gdb-if.c @@ -704,7 +704,7 @@ sim_do_command (SIM_DESC sd, char *cmd) } char ** -sim_complete_command (SIM_DESC sd, char *text, char *word) +sim_complete_command (SIM_DESC sd, const char *text, const char *word) { return NULL; } diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c index d09327d..72a4593 100644 --- a/sim/microblaze/interp.c +++ b/sim/microblaze/interp.c @@ -1090,7 +1090,7 @@ sim_set_callbacks (host_callback *ptr) } char ** -sim_complete_command (SIM_DESC sd, char *text, char *word) +sim_complete_command (SIM_DESC sd, const char *text, const char *word) { return NULL; } diff --git a/sim/ppc/sim_calls.c b/sim/ppc/sim_calls.c index a4ceb3f..a3ebba0 100644 --- a/sim/ppc/sim_calls.c +++ b/sim/ppc/sim_calls.c @@ -259,7 +259,7 @@ sim_do_command (SIM_DESC sd, char *cmd) } char ** -sim_complete_command (SIM_DESC sd, char *text, char *word) +sim_complete_command (SIM_DESC sd, const char *text, const char *word) { return NULL; } diff --git a/sim/rl78/gdb-if.c b/sim/rl78/gdb-if.c index 0c131a1..04d4f0e 100644 --- a/sim/rl78/gdb-if.c +++ b/sim/rl78/gdb-if.c @@ -567,7 +567,7 @@ sim_do_command (SIM_DESC sd, char *cmd) /* Stub for command completion. */ char ** -sim_complete_command (SIM_DESC sd, char *text, char *word) +sim_complete_command (SIM_DESC sd, const char *text, const char *word) { return NULL; } diff --git a/sim/rx/gdb-if.c b/sim/rx/gdb-if.c index 248fdca..2e41b09 100644 --- a/sim/rx/gdb-if.c +++ b/sim/rx/gdb-if.c @@ -864,7 +864,7 @@ sim_do_command (SIM_DESC sd, char *cmd) } char ** -sim_complete_command (SIM_DESC sd, char *text, char *word) +sim_complete_command (SIM_DESC sd, const char *text, const char *word) { return NULL; } diff --git a/sim/sh/interp.c b/sim/sh/interp.c index e9313c7..4b2ca7e 100644 --- a/sim/sh/interp.c +++ b/sim/sh/interp.c @@ -2789,7 +2789,7 @@ sim_set_callbacks (p) } char ** -sim_complete_command (SIM_DESC sd, char *text, char *word) +sim_complete_command (SIM_DESC sd, const char *text, const char *word) { return NULL; }