public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] gdb/csky-tdep.c: fix -Wunused-but-set-variable error
@ 2021-12-03 21:30 Simon Marchi
  2021-12-03 21:30 ` [PATCH 2/2] gdb/microblaze-tdep.c: fix -Wunused-but-set-variable Simon Marchi
  2021-12-03 21:31 ` [PATCH 1/2] gdb/csky-tdep.c: fix -Wunused-but-set-variable error Simon Marchi
  0 siblings, 2 replies; 3+ messages in thread
From: Simon Marchi @ 2021-12-03 21:30 UTC (permalink / raw)
  To: gdb

Fix these, seen when building with clang 14:

      CXX    csky-tdep.o
    /home/simark/src/binutils-gdb/gdb/csky-tdep.c:332:7: error: variable 'need_dummy_stack' set but not used [-Werror,-Wunused-but-set-variable]
      int need_dummy_stack = 0;
          ^
    /home/simark/src/binutils-gdb/gdb/csky-tdep.c:805:12: error: variable 'offset' set but not used [-Werror,-Wunused-but-set-variable]
                  int offset = 0;
                      ^

Change-Id: I6703bcb50e83c50083f716f4084ef6aa30d659c4
---
 gdb/csky-tdep.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c
index 0b073fb6f629..3f591445aca4 100644
--- a/gdb/csky-tdep.c
+++ b/gdb/csky-tdep.c
@@ -329,7 +329,6 @@ csky_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   int argnum;
   int argreg = CSKY_ABI_A0_REGNUM;
   int last_arg_regnum = CSKY_ABI_LAST_ARG_REGNUM;
-  int need_dummy_stack = 0;
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   std::vector<stack_item> stack_items;
 
@@ -399,7 +398,6 @@ csky_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 		{
 		  /* The argument should be pushed onto the dummy stack.  */
 		  stack_items.emplace_back (4, val);
-		  need_dummy_stack += 4;
 		}
 	      len -= partial_len;
 	      val += partial_len;
@@ -802,21 +800,18 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
 	  else if (CSKY_32_IS_PUSH (insn))
 	    {
 	      /* Push for 32_bit.  */
-	      int offset = 0;
 	      if (CSKY_32_IS_PUSH_R29 (insn))
 		{
 		  stacksize += 4;
 		  register_offsets[29] = stacksize;
 		  if (csky_debug)
 		    print_savedreg_msg (29, register_offsets, false);
-		  offset += 4;
 		}
 	      if (CSKY_32_PUSH_LIST2 (insn))
 		{
 		  int num = CSKY_32_PUSH_LIST2 (insn);
 		  int tmp = 0;
 		  stacksize += num * 4;
-		  offset += num * 4;
 		  if (csky_debug)
 		    {
 		      fprintf_unfiltered (gdb_stdlog,
@@ -842,14 +837,12 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
 		  register_offsets[15] = stacksize;
 		  if (csky_debug)
 		    print_savedreg_msg (15, register_offsets, false);
-		  offset += 4;
 		}
 	      if (CSKY_32_PUSH_LIST1 (insn))
 		{
 		  int num = CSKY_32_PUSH_LIST1 (insn);
 		  int tmp = 0;
 		  stacksize += num * 4;
-		  offset += num * 4;
 		  if (csky_debug)
 		    {
 		      fprintf_unfiltered (gdb_stdlog,
-- 
2.33.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] gdb/microblaze-tdep.c: fix -Wunused-but-set-variable
  2021-12-03 21:30 [PATCH 1/2] gdb/csky-tdep.c: fix -Wunused-but-set-variable error Simon Marchi
@ 2021-12-03 21:30 ` Simon Marchi
  2021-12-03 21:31 ` [PATCH 1/2] gdb/csky-tdep.c: fix -Wunused-but-set-variable error Simon Marchi
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2021-12-03 21:30 UTC (permalink / raw)
  To: gdb

Fix this, seen when building with clang 14:

      CXX    microblaze-tdep.o
    /home/simark/src/binutils-gdb/gdb/microblaze-tdep.c:207:7: error: variable 'flags' set but not used [-Werror,-Wunused-but-set-variable]
      int flags = 0;
          ^

Change-Id: I59f726ed33e924912748bc475b6fd9a9394fc0d0
---
 gdb/microblaze-tdep.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 5309da58cc29..e50f50d2b8c2 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -204,7 +204,6 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
   unsigned long insn;
   int rd, ra, rb, imm;
   enum microblaze_instr op;
-  int flags = 0;
   int save_hidden_pointer_found = 0;
   int non_stack_instruction_found = 0;
 
@@ -303,8 +302,6 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
 	{
 	  /* We have a frame pointer.  Note the register which is 
 	     acting as the frame pointer.  */
-	  flags |= MICROBLAZE_MY_FRAME_IN_FP;
-	  flags &= ~MICROBLAZE_MY_FRAME_IN_SP;
 	  cache->fp_regnum = rd;
 	  microblaze_debug ("Found a frame pointer: r%d\n", cache->fp_regnum);
 	  save_hidden_pointer_found = 0;
-- 
2.33.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] gdb/csky-tdep.c: fix -Wunused-but-set-variable error
  2021-12-03 21:30 [PATCH 1/2] gdb/csky-tdep.c: fix -Wunused-but-set-variable error Simon Marchi
  2021-12-03 21:30 ` [PATCH 2/2] gdb/microblaze-tdep.c: fix -Wunused-but-set-variable Simon Marchi
@ 2021-12-03 21:31 ` Simon Marchi
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2021-12-03 21:31 UTC (permalink / raw)
  To: gdb

Sorry, wrong list :(.  Please ignore.


On 2021-12-03 16:30, Simon Marchi wrote:
> Fix these, seen when building with clang 14:
> 
>       CXX    csky-tdep.o
>     /home/simark/src/binutils-gdb/gdb/csky-tdep.c:332:7: error: variable 'need_dummy_stack' set but not used [-Werror,-Wunused-but-set-variable]
>       int need_dummy_stack = 0;
>           ^
>     /home/simark/src/binutils-gdb/gdb/csky-tdep.c:805:12: error: variable 'offset' set but not used [-Werror,-Wunused-but-set-variable]
>                   int offset = 0;
>                       ^
> 
> Change-Id: I6703bcb50e83c50083f716f4084ef6aa30d659c4
> ---
>  gdb/csky-tdep.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c
> index 0b073fb6f629..3f591445aca4 100644
> --- a/gdb/csky-tdep.c
> +++ b/gdb/csky-tdep.c
> @@ -329,7 +329,6 @@ csky_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
>    int argnum;
>    int argreg = CSKY_ABI_A0_REGNUM;
>    int last_arg_regnum = CSKY_ABI_LAST_ARG_REGNUM;
> -  int need_dummy_stack = 0;
>    enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
>    std::vector<stack_item> stack_items;
>  
> @@ -399,7 +398,6 @@ csky_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
>  		{
>  		  /* The argument should be pushed onto the dummy stack.  */
>  		  stack_items.emplace_back (4, val);
> -		  need_dummy_stack += 4;
>  		}
>  	      len -= partial_len;
>  	      val += partial_len;
> @@ -802,21 +800,18 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
>  	  else if (CSKY_32_IS_PUSH (insn))
>  	    {
>  	      /* Push for 32_bit.  */
> -	      int offset = 0;
>  	      if (CSKY_32_IS_PUSH_R29 (insn))
>  		{
>  		  stacksize += 4;
>  		  register_offsets[29] = stacksize;
>  		  if (csky_debug)
>  		    print_savedreg_msg (29, register_offsets, false);
> -		  offset += 4;
>  		}
>  	      if (CSKY_32_PUSH_LIST2 (insn))
>  		{
>  		  int num = CSKY_32_PUSH_LIST2 (insn);
>  		  int tmp = 0;
>  		  stacksize += num * 4;
> -		  offset += num * 4;
>  		  if (csky_debug)
>  		    {
>  		      fprintf_unfiltered (gdb_stdlog,
> @@ -842,14 +837,12 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
>  		  register_offsets[15] = stacksize;
>  		  if (csky_debug)
>  		    print_savedreg_msg (15, register_offsets, false);
> -		  offset += 4;
>  		}
>  	      if (CSKY_32_PUSH_LIST1 (insn))
>  		{
>  		  int num = CSKY_32_PUSH_LIST1 (insn);
>  		  int tmp = 0;
>  		  stacksize += num * 4;
> -		  offset += num * 4;
>  		  if (csky_debug)
>  		    {
>  		      fprintf_unfiltered (gdb_stdlog,
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-03 21:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-03 21:30 [PATCH 1/2] gdb/csky-tdep.c: fix -Wunused-but-set-variable error Simon Marchi
2021-12-03 21:30 ` [PATCH 2/2] gdb/microblaze-tdep.c: fix -Wunused-but-set-variable Simon Marchi
2021-12-03 21:31 ` [PATCH 1/2] gdb/csky-tdep.c: fix -Wunused-but-set-variable error Simon Marchi

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).