From 1a2984b786850d9b74103e4a7038b9a56f615eb1 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Tue, 12 Oct 2021 14:56:11 +0200 Subject: [PATCH] cpu/native: fix build with gcc 11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the following warning with GCC 11.2: cpu/native/include/native_internal.h:153:13: error: variably modified ‘__isr_stack’ at file scope 153 | extern char __isr_stack[SIGSTKSZ]; | ^~~~~~~~~~~ cpu/native/include/native_internal.h:154:13: error: variably modified ‘__end_stack’ at file scope 154 | extern char __end_stack[SIGSTKSZ]; --- cpu/native/include/native_internal.h | 4 ++-- cpu/native/native_cpu.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpu/native/include/native_internal.h b/cpu/native/include/native_internal.h index 7a2a8c3885..bee8fccdfc 100644 --- a/cpu/native/include/native_internal.h +++ b/cpu/native/include/native_internal.h @@ -150,8 +150,8 @@ extern volatile int _native_sigpend; extern volatile int _native_in_isr; extern volatile int _native_in_syscall; -extern char __isr_stack[SIGSTKSZ]; -extern char __end_stack[SIGSTKSZ]; +extern char __isr_stack[]; +extern char __end_stack[]; extern ucontext_t native_isr_context; extern ucontext_t end_context; extern ucontext_t *_native_cur_ctx, *_native_isr_ctx; diff --git a/cpu/native/native_cpu.c b/cpu/native/native_cpu.c index 5fb6241628..e4c02fd52a 100644 --- a/cpu/native/native_cpu.c +++ b/cpu/native/native_cpu.c @@ -170,7 +170,7 @@ void cpu_switch_context_exit(void) irq_disable(); _native_in_isr = 1; native_isr_context.uc_stack.ss_sp = __isr_stack; - native_isr_context.uc_stack.ss_size = sizeof(__isr_stack); + native_isr_context.uc_stack.ss_size = SIGSTKSZ; native_isr_context.uc_stack.ss_flags = 0; makecontext(&native_isr_context, isr_cpu_switch_context_exit, 0); if (setcontext(&native_isr_context) == -1) {