Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: [PATCH 09/18] sim/bpf: remove unused bpf_program_section variable
       [not found] ` <20261019193231.1708375-10-simon.marchi@efficios.com>
@ 2026-10-19 19:35   ` Simon Marchi
  2026-10-20 10:59     ` Jose E. Marchesi
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2026-10-19 19:35 UTC (permalink / raw)
  To: binutils, gdb-patches

Adding gdb-patches@.

On 10/19/26 3:28 PM, Simon Marchi wrote:
> Building the BPF simulator with a recent clang fails with:
> 
>     /home/smarchi/src/binutils-gdb/sim/bpf/bpf-sim.c:367:14: error: variable 'bpf_program_section' set but not used [-Werror,-Wunused-but-set-global]
> 
> The --bpf-set-program option stores its argument in this variable, but
> nothing ever reads it, the feature was never implemented.  Remove the
> variable.
> 
> Change-Id: I71edbed055a82fb65a2acecbc38477e3ded80d6a
> ---
>  sim/bpf/bpf-sim.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/sim/bpf/bpf-sim.c b/sim/bpf/bpf-sim.c
> index 9cb272a240e5..34f78c91bc30 100644
> --- a/sim/bpf/bpf-sim.c
> +++ b/sim/bpf/bpf-sim.c
> @@ -362,10 +362,6 @@ bpf_pc_set (sim_cpu *cpu, sim_cia pc)
>  
>  static int64_t skb_data_offset;
>  
> -/* String with the name of the section containing the BPF program to
> -   run.  */
> -static char *bpf_program_section = NULL;
> -
>  \f
>  /***** Handle BPF-specific command line options.  *****/
>  
> @@ -416,7 +412,6 @@ bpf_option_handler (SIM_DESC sd, sim_cpu *cpu ATTRIBUTE_UNUSED, int opt,
>      case OPTION_BPF_SET_PROGRAM:
>        /* XXX: check that the section exists and tell the user about a
>           new start_address.  */
> -      bpf_program_section = xstrdup (arg);
>        break;
>  
>      case OPTION_BPF_SKB_DATA_OFFSET:
> -- 
> 2.56.0
> 

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

* Re: [PATCH 10/18] sim/erc32: fix -Wunused-but-set-global errors
       [not found] ` <20261019193231.1708375-11-simon.marchi@efficios.com>
@ 2026-10-19 19:36   ` Simon Marchi
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2026-10-19 19:36 UTC (permalink / raw)
  To: binutils, gdb-patches

Adding gdb-patches@.

On 10/19/26 3:28 PM, Simon Marchi wrote:
> Building the erc32 simulator with a recent clang fails with:
> 
>     /home/smarchi/src/binutils-gdb/sim/erc32/erc32.c:159:19: error: variable 'mec_icr' set but not used [-Werror,-Wunused-but-set-global]
>     /home/smarchi/src/binutils-gdb/sim/erc32/erc32.c:165:19: error: variable 'posted_irq' set but not used [-Werror,-Wunused-but-set-global]
>     /home/smarchi/src/binutils-gdb/sim/erc32/erc32.c:247:19: error: variable 'uarta_data' set but not used [-Werror,-Wunused-but-set-global]
> 
> mec_icr and posted_irq are only ever set to 0 in mec_reset.  Remove
> them.
> 
> uarta_data and uartb_data are only read when FAST_UART is not defined,
> but the simulator is build with FAST_UART by default.  Mark them
> ATTRIBUTE_UNUSED, like functions uart_rx, uarta_tx and uartb_tx, which
> are in the same situation.
> 
> Change-Id: I56d04a1141f05a9e1a66984a68c390a36ad9b0a1
> ---
>  sim/erc32/erc32.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/sim/erc32/erc32.c b/sim/erc32/erc32.c
> index 4e9b645d1f3a..f3d9b49b9807 100644
> --- a/sim/erc32/erc32.c
> +++ b/sim/erc32/erc32.c
> @@ -156,13 +156,11 @@ static uint32_t   mec_ffar;
>  static uint32_t   mec_ipr;
>  static uint32_t   mec_imr;
>  static uint32_t   mec_isr;
> -static uint32_t   mec_icr;
>  static uint32_t   mec_ifr;
>  static uint32_t   mec_mcr;	/* MEC control register */
>  static uint32_t   mec_memcfg;	/* Memory control register */
>  static uint32_t   mec_wcr;	/* MEC waitstate register */
>  static uint32_t   mec_iocr;	/* MEC IO control register */
> -static uint32_t   posted_irq;
>  static uint32_t   mec_ersr;	/* MEC error and status register */
>  static uint32_t   mec_tcr;	/* MEC test comtrol register */
>  
> @@ -244,7 +242,7 @@ static int      f1open = 0, f2open = 0;
>  
>  static char     uarta_sreg, uarta_hreg, uartb_sreg, uartb_hreg;
>  static uint32_t   uart_stat_reg;
> -static uint32_t   uarta_data, uartb_data;
> +ATTRIBUTE_UNUSED static uint32_t uarta_data, uartb_data;
>  
>  #ifdef ERA
>  int era = 0;
> @@ -504,7 +502,6 @@ mec_reset(void)
>      mec_ipr = 0;
>      mec_imr = 0x7ffe;
>      mec_isr = 0;
> -    mec_icr = 0;
>      mec_ifr = 0;
>      mec_memcfg = 0x10000;
>      mec_wcr = -1;
> @@ -515,7 +512,6 @@ mec_reset(void)
>      decode_wcr();
>      decode_mcr();
>  
> -    posted_irq = 0;
>      wnuma = wnumb = 0;
>      anum = aind = bnum = bind = 0;
>  
> -- 
> 2.56.0
> 


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

* Re: [PATCH 11/18] sim/m68hc11: remove unused current_insn_size variable
       [not found] ` <20261019193231.1708375-12-simon.marchi@efficios.com>
@ 2026-10-19 19:36   ` Simon Marchi
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2026-10-19 19:36 UTC (permalink / raw)
  To: binutils, gdb-patches

Adding gdb-patches@.

On 10/19/26 3:28 PM, Simon Marchi wrote:
> Building the m68hc11 simulator with a recent clang fails with:
> 
>     /home/smarchi/src/binutils-gdb/sim/m68hc11/gencode.c:1143:12: error: variable 'current_insn_size' set but not used [-Werror,-Wunused-but-set-global]
> 
> The only read of current_insn_size is an instruction size consistency
> check, which has been disabled with "#if 0" since commit 81e09ed8322b
> ("Improve HC11 simulator to support HC12", 2001-05-20).  Remove the
> variable, the code computing it, and the disabled check.
> 
> Change-Id: Ibd7ee5ac16d5511d40a9ddcc175a94dcbc387b2b
> ---
>  sim/m68hc11/gencode.c | 41 -----------------------------------------
>  1 file changed, 41 deletions(-)
> 
> diff --git a/sim/m68hc11/gencode.c b/sim/m68hc11/gencode.c
> index 248005a9dd84..822c90ef9a5e 100644
> --- a/sim/m68hc11/gencode.c
> +++ b/sim/m68hc11/gencode.c
> @@ -1140,7 +1140,6 @@ static struct m6811_opcode_def m6812_page2_opcodes[] = {
>  
>  
>  static int indent_level = 2;
> -static int current_insn_size = 0;
>  
>  /* Fatal error message and exit.  This method is called when an inconsistency
>     is detected in the generation table.	 */
> @@ -1344,7 +1343,6 @@ gen_fetch_operands (FILE *fp, int col,
>  	    fatal_error (opcode, "Wrong use of '*', 'addr' already used");
>  	  
>  	  addr_set = 1;
> -	  current_insn_size += 1;
>  	  print (fp, col, "addr = (uint16_t) cpu_fetch8 (cpu);");
>  	  print (fp, col, "%s%s = memory_read%s (cpu, addr);",
>  		 vars[cur_var], operand_size, operand_size);
> @@ -1357,25 +1355,21 @@ gen_fetch_operands (FILE *fp, int col,
>  	  addr_set = 1;
>  	  if (strncmp (operands, "(x)", 3) == 0)
>  	    {
> -	      current_insn_size += 1;
>  	      print (fp, col, "addr = cpu_get_x (cpu) + (uint16_t) cpu_fetch8 (cpu);");
>  	      operands += 3;
>  	    }
>  	  else if (strncmp (operands, "(y)", 3) == 0)
>  	    {
> -	      current_insn_size += 1;
>  	      print (fp, col, "addr = cpu_get_y (cpu) + (uint16_t) cpu_fetch8 (cpu);");
>  	      operands += 3;
>  	    }
>  	  else if (strncmp (operands, "()", 2) == 0)
>  	    {
> -	      current_insn_size += 2;
>  	      print (fp, col, "addr = cpu_fetch16 (cpu);");
>  	      operands += 2;
>  	    }
>  	  else if (strncmp (operands, "[]", 2) == 0)
>  	    {
> -	      current_insn_size += 1;
>  	      print (fp, col, "addr = cpu_get_indexed_operand_addr (cpu, 0);");
>  	      operands += 2;
>  	    }
> @@ -1395,7 +1389,6 @@ gen_fetch_operands (FILE *fp, int col,
>  	  if (strncmp (operands, "x)", 2) == 0)
>  	    {
>  	      addr_set = 1;
> -	      current_insn_size += 1;
>  	      print (fp, col, "addr = cpu_get_x (cpu) + (uint16_t) cpu_fetch8 (cpu);");
>  	      print (fp, col, "%s%s = memory_read%s (cpu, addr);",
>  		     vars[cur_var], operand_size, operand_size);
> @@ -1404,7 +1397,6 @@ gen_fetch_operands (FILE *fp, int col,
>  	  else if (strncmp (operands, "y)", 2) == 0)
>  	    {
>  	      addr_set = 1;
> -	      current_insn_size += 1;
>  	      print (fp, col, "addr = cpu_get_y (cpu) + (uint16_t) cpu_fetch8 (cpu);");
>  	      print (fp, col, "%s%s = memory_read%s (cpu, addr);",
>  		     vars[cur_var], operand_size, operand_size);
> @@ -1413,7 +1405,6 @@ gen_fetch_operands (FILE *fp, int col,
>  	  else if (strncmp (operands, ")", 1) == 0)
>  	    {
>  	      addr_set = 1;
> -	      current_insn_size += 2;
>  	      print (fp, col, "addr = cpu_fetch16 (cpu);");
>  	      print (fp, col, "%s%s = memory_read%s (cpu, addr);",
>  		     vars[cur_var], operand_size, operand_size);
> @@ -1421,7 +1412,6 @@ gen_fetch_operands (FILE *fp, int col,
>  	    }
>  	  else if (strncmp (operands, "@)", 2) == 0)
>  	    {
> -	      current_insn_size += 2;
>  	      print (fp, col, "addr = cpu_fetch16 (cpu);");
>  	      print (fp, col, "%s%s = memory_read%s (cpu, addr);",
>  		     vars[cur_var], operand_size, operand_size);
> @@ -1451,7 +1441,6 @@ gen_fetch_operands (FILE *fp, int col,
>  	  if (strncmp (operands, "]", 1) == 0)
>  	    {
>  	      addr_set = 1;
> -	      current_insn_size += 1;
>  	      print (fp, col, "addr = cpu_get_indexed_operand_addr (cpu,0);");
>  	      print (fp, col, "%s%s = memory_read%s (cpu, addr);",
>  		     vars[cur_var], operand_size, operand_size);
> @@ -1461,7 +1450,6 @@ gen_fetch_operands (FILE *fp, int col,
>  	 removed because it may be that there is a typo in strncmp test below.  */
>  	  else if (strncmp (operands, "]", 1) == 0)
>  	    {
> -	      current_insn_size += 1;
>  	      print (fp, col, "%s%s = cpu_get_indexed_operand%s (cpu,0);",
>  		     vars[cur_var], operand_size, operand_size);
>  	      operands += 1;
> @@ -1482,7 +1470,6 @@ gen_fetch_operands (FILE *fp, int col,
>  	  
>  	  if (strncmp (operands, "}", 1) == 0)
>  	    {
> -	      current_insn_size += 1;
>  	      print (fp, col, "%s%s = cpu_get_indexed_operand%s (cpu, 1);",
>  		     vars[cur_var], operand_size, operand_size);
>  	      operands += 1;
> @@ -1525,7 +1512,6 @@ gen_fetch_operands (FILE *fp, int col,
>  	    fatal_error (opcode, "Wrong use of 'r'");
>  
>  	  addr_set = 1;
> -	  current_insn_size += 1;
>  	  print (fp, col, "addr = cpu_fetch_relbranch (cpu);");
>  	  break;
>  
> @@ -1534,19 +1520,10 @@ gen_fetch_operands (FILE *fp, int col,
>  	    fatal_error (opcode, "Wrong use of 'R'");
>  
>  	  addr_set = 1;
> -	  current_insn_size += 2;
>  	  print (fp, col, "addr = cpu_fetch_relbranch16 (cpu);");
>  	  break;
>  
>  	case '#':
> -	  if (strcmp (operand_size, "8") == 0)
> -	    {
> -	      current_insn_size += 1;
> -	    }
> -	  else
> -	    {
> -	      current_insn_size += 2;
> -	    }
>  	  print (fp, col, "%s%s = cpu_fetch%s (cpu);", vars[cur_var],
>  		 operand_size, operand_size);
>  	  break;
> @@ -1655,7 +1632,6 @@ gen_save_result (FILE *fp, int col,
>      case '*':
>        if (addr_set == 0)
>  	{
> -	  current_insn_size += 1;
>  	  print (fp, col, "addr = (uint16_t) cpu_fetch8 (cpu);");
>  	}
>        result_size = operand_size;
> @@ -1668,7 +1644,6 @@ gen_save_result (FILE *fp, int col,
>  	{
>  	  if (addr_set == 0)
>  	    {
> -	      current_insn_size += 1;
>  	      print (fp, col, "addr = cpu_get_x (cpu) + cpu_fetch8 (cpu);");
>  	    }
>  	  print (fp, col, "memory_write%s (cpu, addr, dst%s);",
> @@ -1680,7 +1655,6 @@ gen_save_result (FILE *fp, int col,
>  	{
>  	  if (addr_set == 0)
>  	    {
> -	      current_insn_size += 1;
>  	      print (fp, col, "addr = cpu_get_y (cpu) + cpu_fetch8 (cpu);");
>  	    }
>  	  print (fp, col, "memory_write%s (cpu, addr, dst%s);",
> @@ -1692,7 +1666,6 @@ gen_save_result (FILE *fp, int col,
>  	{
>  	  if (addr_set == 0)
>  	    {
> -	      current_insn_size += 2;
>  	      print (fp, col, "addr = cpu_fetch16 (cpu);");
>  	    }
>  	  print (fp, col, "memory_write%s (cpu, addr, dst%s);",
> @@ -1719,7 +1692,6 @@ gen_save_result (FILE *fp, int col,
>  	{
>  	  if (addr_set == 0)
>  	    {
> -	      current_insn_size += 1;
>  	      print (fp, col, "addr = cpu_get_indexed_operand_addr (cpu,0);");
>  	    }
>  	  print (fp, col, "memory_write%s (cpu, addr, dst%s);",
> @@ -1736,7 +1708,6 @@ gen_save_result (FILE *fp, int col,
>      case '{':
>        if (strncmp (operands, "}", 1) == 0)
>  	{
> -	  current_insn_size += 1;
>  	  print (fp, col, "addr = cpu_get_indexed_operand_addr (cpu, 1);");
>  	  print (fp, col, "memory_write%s (cpu, addr, dst%s);",
>  		 operand_size, operand_size);
> @@ -1880,11 +1851,7 @@ gen_interpreter_for_table (FILE *fp, int col,
>  			   const char *cycles_table_name)
>  {
>    int i;
> -  int init_size;
>  
> -  init_size = table == m6811_page1_opcodes
> -    || table == m6812_page1_opcodes? 1 : 2;
> -  
>    /* Get the opcode and dispatch directly.  */
>    print (fp, col, "op = cpu_fetch8 (cpu);");
>    print (fp, col, "cpu_add_cycles (cpu, %s[op]);", cycles_table_name);
> @@ -1899,15 +1866,7 @@ gen_interpreter_for_table (FILE *fp, int col,
>        if (i > 0 && table[i].insn_code == table[i - 1].insn_code)
>  	continue;
>  
> -      current_insn_size = init_size;
>        gen_interp (fp, col, &table[i]);
> -#if 0
> -      if (current_insn_size != table[i].insn_size)
> -	{
> -	  fatal_error (&table[i], "Insn size %ld inconsistent with %ld",
> -		       current_insn_size, table[i].insn_size);
> -	}
> -#endif
>      }
>  
>    print (fp, col, "default:\n");
> -- 
> 2.56.0
> 


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

* Re: [PATCH 09/18] sim/bpf: remove unused bpf_program_section variable
  2026-10-19 19:35   ` [PATCH 09/18] sim/bpf: remove unused bpf_program_section variable Simon Marchi
@ 2026-10-20 10:59     ` Jose E. Marchesi
  2026-10-21 13:30       ` Simon Marchi
  0 siblings, 1 reply; 5+ messages in thread
From: Jose E. Marchesi @ 2026-10-20 10:59 UTC (permalink / raw)
  To: Simon Marchi; +Cc: binutils, gdb-patches


Hi Simon.

FWIW the change LGTM.
Thanks.

> Adding gdb-patches@.
>
> On 10/19/26 3:28 PM, Simon Marchi wrote:
>> Building the BPF simulator with a recent clang fails with:
>> 
>>     /home/smarchi/src/binutils-gdb/sim/bpf/bpf-sim.c:367:14: error: variable 'bpf_program_section' set but not used [-Werror,-Wunused-but-set-global]
>> 
>> The --bpf-set-program option stores its argument in this variable, but
>> nothing ever reads it, the feature was never implemented.  Remove the
>> variable.
>> 
>> Change-Id: I71edbed055a82fb65a2acecbc38477e3ded80d6a
>> ---
>>  sim/bpf/bpf-sim.c | 5 -----
>>  1 file changed, 5 deletions(-)
>> 
>> diff --git a/sim/bpf/bpf-sim.c b/sim/bpf/bpf-sim.c
>> index 9cb272a240e5..34f78c91bc30 100644
>> --- a/sim/bpf/bpf-sim.c
>> +++ b/sim/bpf/bpf-sim.c
>> @@ -362,10 +362,6 @@ bpf_pc_set (sim_cpu *cpu, sim_cia pc)
>>  
>>  static int64_t skb_data_offset;
>>  
>> -/* String with the name of the section containing the BPF program to
>> -   run.  */
>> -static char *bpf_program_section = NULL;
>> -
>>  \f
>>  /***** Handle BPF-specific command line options.  *****/
>>  
>> @@ -416,7 +412,6 @@ bpf_option_handler (SIM_DESC sd, sim_cpu *cpu ATTRIBUTE_UNUSED, int opt,
>>      case OPTION_BPF_SET_PROGRAM:
>>        /* XXX: check that the section exists and tell the user about a
>>           new start_address.  */
>> -      bpf_program_section = xstrdup (arg);
>>        break;
>>  
>>      case OPTION_BPF_SKB_DATA_OFFSET:
>> -- 
>> 2.56.0
>> 

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

* Re: [PATCH 09/18] sim/bpf: remove unused bpf_program_section variable
  2026-10-20 10:59     ` Jose E. Marchesi
@ 2026-10-21 13:30       ` Simon Marchi
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2026-10-21 13:30 UTC (permalink / raw)
  To: Jose E. Marchesi; +Cc: binutils, gdb-patches

On 10/21/26 6:37 AM, Jose E. Marchesi wrote:
> 
> Hi Simon.
> 
> FWIW the change LGTM.
> Thanks.

Thanks, I pushed this single patch.

Simon

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

end of thread, other threads:[~2026-10-21 13:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20261019193231.1708375-1-simon.marchi@efficios.com>
     [not found] ` <20261019193231.1708375-10-simon.marchi@efficios.com>
2026-10-19 19:35   ` [PATCH 09/18] sim/bpf: remove unused bpf_program_section variable Simon Marchi
2026-10-20 10:59     ` Jose E. Marchesi
2026-10-21 13:30       ` Simon Marchi
     [not found] ` <20261019193231.1708375-11-simon.marchi@efficios.com>
2026-10-19 19:36   ` [PATCH 10/18] sim/erc32: fix -Wunused-but-set-global errors Simon Marchi
     [not found] ` <20261019193231.1708375-12-simon.marchi@efficios.com>
2026-10-19 19:36   ` [PATCH 11/18] sim/m68hc11: remove unused current_insn_size variable Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox