From d1113110f336997ff73f892b5bdae54074efe2e1 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Mon, 20 Mar 2023 19:53:46 +0100 Subject: [PATCH] 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. --- arch/arm/include/armv7-m/irq.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/include/armv7-m/irq.h b/arch/arm/include/armv7-m/irq.h index 10bc465615..a3e467e3c5 100644 --- a/arch/arm/include/armv7-m/irq.h +++ b/arch/arm/include/armv7-m/irq.h @@ -359,6 +359,9 @@ static inline void raisebasepri(uint32_t basepri) * 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__ ( "\tmrs %0, primask\n" @@ -368,6 +371,7 @@ static inline void raisebasepri(uint32_t basepri) : "+r" (primask) : "r" (basepri) : "memory"); +#pragma GCC diagnostic pop } #else # define raisebasepri(b) setbasepri(b);