From fb32b4f7005ef8f1bde02394b58b5c5eda9cbf10 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 5 Apr 2017 19:21:35 +0100 Subject: -Wwrite-strings: gdbserver's 'port' parsing -Wwrite-strings flags this assignment as requiring a cast: port = STDIO_CONNECTION_NAME; because 'port' is a "char *", and STDIO_CONNECTION_NAME is a string literal. gdb/gdbserver/ChangeLog: 2017-04-05 Pedro Alves * remote-utils.c (remote_prepare, remote_open): Constify. * remote-utils.h (remote_prepare, remote_open): Constify. * server.c (captured_main): Constify 'port' handling. --- gdb/gdbserver/server.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'gdb/gdbserver/server.c') diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 4bc7f71..51f6a28 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -3511,7 +3511,8 @@ captured_main (int argc, char *argv[]) { int bad_attach; int pid; - char *arg_end, *port; + char *arg_end; + const char *port = NULL; char **next_arg = &argv[1]; volatile int multi_mode = 0; volatile int attach = 0; @@ -3608,7 +3609,8 @@ captured_main (int argc, char *argv[]) { /* "-" specifies a stdio connection and is a form of port specification. */ - *next_arg = STDIO_CONNECTION_NAME; + port = STDIO_CONNECTION_NAME; + next_arg++; break; } else if (strcmp (*next_arg, "--disable-randomization") == 0) @@ -3627,8 +3629,11 @@ captured_main (int argc, char *argv[]) continue; } - port = *next_arg; - next_arg++; + if (port == NULL) + { + port = *next_arg; + next_arg++; + } if (port == NULL || (!attach && !multi_mode && *next_arg == NULL)) { gdbserver_usage (stderr); -- cgit v1.1