armv7-m irq: avoid uninitialized warning/error

arm-none-eabi-gcc 12.2.0 gives the following warnings:
error: 'primask' is used uninitialized
error: 'primask' may be used uninitialized

We use Werror and the file is indirectly included in different
places. I suggest telling the compiler to ignore these warnings
since primask is initialized on the first assembly line.

This is the only problem I encountered so far when upgrading the compiler.
This commit is contained in:
Matthias Grob 2023-03-20 19:53:46 +01:00 committed by David Sidrane
parent 5d53c8299e
commit d1113110f3

View File

@ -359,6 +359,9 @@ static inline void raisebasepri(uint32_t basepri)
* effect of unconditionally re-enabling interrupts. * effect of unconditionally re-enabling interrupts.
*/ */
#pragma GCC diagnostic push /* primask is initialized in ASM */
#pragma GCC diagnostic ignored "-Wuninitialized"
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
__asm__ __volatile__ __asm__ __volatile__
( (
"\tmrs %0, primask\n" "\tmrs %0, primask\n"
@ -368,6 +371,7 @@ static inline void raisebasepri(uint32_t basepri)
: "+r" (primask) : "+r" (primask)
: "r" (basepri) : "r" (basepri)
: "memory"); : "memory");
#pragma GCC diagnostic pop
} }
#else #else
# define raisebasepri(b) setbasepri(b); # define raisebasepri(b) setbasepri(b);