From ee9c5c6416405eba98f52d3e712ee695c52b626a Mon Sep 17 00:00:00 2001 From: Jean-Pierre De Jesus DIAZ Date: Thu, 31 Oct 2024 16:49:27 +0100 Subject: [PATCH] SFT-4357: Fix -Werror=dangling-pointer. Due to the update to Ubuntu 24.04 on the CI it causes this warning to be emitted, and as a result the build fails. This code takes the pointer of a variable on the stack to measure the stack usage. * py/stackctrl.c: Disable -Wdangling-pointer warning. --- py/stackctrl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/py/stackctrl.c b/py/stackctrl.c index c2f3adb5e..394b40639 100644 --- a/py/stackctrl.c +++ b/py/stackctrl.c @@ -29,6 +29,7 @@ void mp_stack_ctrl_init(void) { volatile int stack_dummy; +#pragma GCC diagnostic warning "-Wdangling-pointer" MP_STATE_THREAD(stack_top) = (char *)&stack_dummy; } @@ -39,6 +40,7 @@ void mp_stack_set_top(void *top) { mp_uint_t mp_stack_usage(void) { // Assumes descending stack volatile int stack_dummy; +#pragma GCC diagnostic warning "-Wdangling-pointer" return MP_STATE_THREAD(stack_top) - (char *)&stack_dummy; }