Skip to contentSkip to conversation

xen/arm: traps: Fix MISRA C 2012 Rule 8.4 violation

PATCH In review Xenia Ragiadakou 3 participants 3 messages Jul 6, 2022 – Jul 14, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xen/arm: traps: Fix MISRA C 2012 Rule 8.4 violation

Add the function prototype of show_stack() in <asm/processor.h> header file so that it is visible before its definition in traps.c.

Although show_stack() is referenced only in traps.c, it is declared with external linkage because, during development, it is often called also by other files for debugging purposes. Declaring it static would increase development effort. Add appropriate comment

---
Changes in v2:
- add a new line after show_stack() to make obvious to which set of functions the comment is referring to.

 xen/arch/arm/include/asm/processor.h | 3 +++
 1 file changed, 3 insertions(+)
xen/arch/arm/include/asm/processor.h +3 -0
index 4188ec6bfb..55f56b33bc 100644
@@ -558,7 +558,10 @@ extern register_t __cpu_logical_map[];
 void panic_PAR(uint64_t par);
 
 void show_execution_state(const struct cpu_user_regs *regs);
+/* Debugging functions are declared with external linkage to aid development. */
 void show_registers(const struct cpu_user_regs *regs);
+void show_stack(const struct cpu_user_regs *regs);
+
 //#define dump_execution_state() run_in_exception_handler(show_execution_state)
 #define dump_execution_state() WARN()
 
Signature · 1 line
2.34.1
Acked-by on v2 1/1
#1 lore raw
Quoted 9 lines · Xenia Ragiadakou

Add the function prototype of show_stack() in <asm/processor.h> header file so that it is visible before its definition in traps.c.

Although show_stack() is referenced only in traps.c, it is declared with external linkage because, during development, it is often called also by other files for debugging purposes. Declaring it static would increase development effort. Add appropriate comment

Quoted 26 lines

---
Changes in v2:
- add a new line after show_stack() to make obvious to which set of functions the comment is referring to.

 xen/arch/arm/include/asm/processor.h | 3 +++
 1 file changed, 3 insertions(+)
xen/arch/arm/include/asm/processor.h +3 -0
index 4188ec6bfb..55f56b33bc 100644
@@ -558,7 +558,10 @@ extern register_t __cpu_logical_map[];
 void panic_PAR(uint64_t par);
 
 void show_execution_state(const struct cpu_user_regs *regs);
+/* Debugging functions are declared with external linkage to aid development. */
 void show_registers(const struct cpu_user_regs *regs);
+void show_stack(const struct cpu_user_regs *regs);
+
 //#define dump_execution_state() run_in_exception_handler(show_execution_state)
 #define dump_execution_state() WARN()
 
Signature · 1 line
2.34.1
#2 lore raw
Quoted 4 lines · Stefano Stabellini
Quoted 3 lines · Xenia Ragiadakou

Add the function prototype of show_stack() in <asm/processor.h> header file so that it is visible before its definition in traps.c.

Quoted 8 lines
Quoted 6 lines

Although show_stack() is referenced only in traps.c, it is declared with external linkage because, during development, it is often called also by other files for debugging purposes. Declaring it static would increase development effort. Add appropriate comment

Committed.

Cheers,

Signature · 1 line
Julien Grall