Skip to content

Commit

Permalink
SFT-4357: Fix -Werror=dangling-pointer.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jeandudey committed Oct 31, 2024
1 parent 726b2a1 commit ee9c5c6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions py/stackctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down

0 comments on commit ee9c5c6

Please sign in to comment.