public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Enze Li <enze.li@hotmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] gdbserver: remove unused variable
Date: Mon, 11 Jul 2022 20:53:48 +0800	[thread overview]
Message-ID: <OS3P286MB215299E847319BF8463FE138F0879@OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM> (raw)

When building with clang 15, I got this error:

  CXX    server.o
server.cc:2985:10: error: variable 'new_argc' set but not used [-Werror,-Wunused-but-set-variable]
  int i, new_argc;
             ^
Remove the unused variable to eliminate the error.

Tested by rebuilding on x86_64-linux with clang 15.
---
 gdbserver/server.cc | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index f9c02a9c6dac..c619206d5d2d 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -2982,14 +2982,10 @@ handle_v_run (char *own_buf)
   char *p, *next_p;
   std::vector<char *> new_argv;
   char *new_program_name = NULL;
-  int i, new_argc;
+  int i;
 
-  new_argc = 0;
   for (p = own_buf + strlen ("vRun;"); p && *p; p = strchr (p, ';'))
-    {
-      p++;
-      new_argc++;
-    }
+    p++;
 
   for (i = 0, p = own_buf + strlen ("vRun;"); *p; p = next_p, ++i)
     {
-- 
2.30.2


             reply	other threads:[~2022-07-11 12:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-11 12:53 Enze Li [this message]
2022-07-11 13:52 ` Luis Machado
2022-07-11 15:38 ` Andrew Burgess
2022-07-13 12:13   ` Enze Li
2022-07-13 15:37 ` Pedro Alves

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=OS3P286MB215299E847319BF8463FE138F0879@OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM \
    --to=enze.li@hotmail.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).