Re: [PATCH 05/13] sim/m32r: fix unused variable warning on non-Linux hosts

Andrew Burgess <[email protected]>
Newsgroups gmane.comp.gdb.patches,gmane.comp.gnu.binutils
Message-ID <[email protected]>
Simon Marchi <[email protected]> writes:

> When building on macOS, I get:
>
>     /Users/smarchi/src/binutils-gdb/sim/m32r/traps.c:191:18: error: unused variable 'cb' [-Werror,-Wunused-variable]
>       191 |   host_callback *cb = STATE_CALLBACK (sd);
>           |                  ^~
>
> All the uses of `cb' in m32r_trap are inside the TRAP_LINUX_SYSCALL
> case, which is guarded by `#ifdef __linux__'.  Move the declaration
> inside that case, so that it only exists where it is used.

Approved-By: Andrew Burgess <[email protected]>

Thanks,
Andrew

>
> Change-Id: I609850daf7fa60d92856988dffe7e314eb1d8a30
> ---
>  sim/m32r/traps.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sim/m32r/traps.c b/sim/m32r/traps.c
> index 7b98b2453972..bb82ae80e2aa 100644
> --- a/sim/m32r/traps.c
> +++ b/sim/m32r/traps.c
> @@ -188,7 +188,6 @@ USI
>  m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num)
>  {
>    SIM_DESC sd = CPU_STATE (current_cpu);
> -  host_callback *cb = STATE_CALLBACK (sd);
>  
>    if (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT)
>      goto case_default;
> @@ -217,6 +216,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num)
>  #ifdef __linux__
>      case TRAP_LINUX_SYSCALL:
>        {
> +	host_callback *cb = STATE_CALLBACK (sd);
>  	CB_SYSCALL s;
>  	unsigned int func, arg1, arg2, arg3, arg4, arg5, arg6, arg7;
>  	int result, errcode;
> -- 
> 2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.