This is an automated email from the ASF dual-hosted git repository.
davids5 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new d1113110f3 armv7-m irq: avoid uninitialized warning/error
d1113110f3 is described below
commit d1113110f336997ff73f892b5bdae54074efe2e1
Author: Matthias Grob <[email protected]>
AuthorDate: Mon Mar 20 19:53:46 2023 +0100
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);