[PATCH 05/13] sim/m32r: fix unused variable warning on non-Linux hosts
Andrew Burgess
aburgess@redhat.com
Mon Aug 17 15:36:56 GMT 2026
Simon Marchi <simon.marchi@efficios.com> 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 <aburgess@redhat.com>
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
More information about the Binutils
mailing list