xen/keyhandler: add missing noreturn attribute
PATCH v2 1/3 xen/keyhandler: add missing noreturn attribute
From: Nicola Vetrini <[email protected]>
Function reboot_machine' does not return, but lacks the noreturn' attribute.
Functions that never return should be declared with a `noreturn' attribute.
The lack of `noreturn' causes a violation of MISRA C Rule 17.11 (not currently accepted in Xen), and also Rule 2.1: "A project shall not contain unreachable code". Depending on the compiler used and the compiler optimization used, the lack of `noreturn' might lead to the presence of unreachable code.
No functional change.
---
Changes in v2:
- improved commit message
---
Cc: Andrew Cooper <[email protected]>
Cc: Anthony PERARD <[email protected]>
Cc: Michal Orzel <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Roger Pau Monné <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Nicola Vetrini <[email protected]>
Cc: Federico Serafini <[email protected]>
Cc: Bertrand Marquis <[email protected]>
--- xen/common/keyhandler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/common/keyhandler.c +1 -1
@@ -251,7 +251,7 @@ static void cf_check dump_hwdom_registers(unsigned char key) } } -static void cf_check reboot_machine(unsigned char key, bool unused) +static void noreturn cf_check reboot_machine(unsigned char key, bool unused) {printk ("'%c' pressed -> rebooting machine\n" , key);machine_restart (0 );
--
2.25.1
PATCH v2 2/3 xen/arm: add missing noreturn attributes
From: Nicola Vetrini <[email protected]>
The marked functions never return to their caller, but lack the `noreturn' attribute.
Functions that never return should be declared with a `noreturn' attribute.
The lack of `noreturn' causes a violation of MISRA C Rule 17.11 (not currently accepted in Xen), and also Rule 2.1: "A project shall not contain unreachable code". Depending on the compiler used and the compiler optimization used, the lack of `noreturn' might lead to the presence of unreachable code.
No functional change.
---
Changes in v2:
- improved commit message
---
Cc: Andrew Cooper <[email protected]>
Cc: Anthony PERARD <[email protected]>
Cc: Michal Orzel <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Roger Pau Monné <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Nicola Vetrini <[email protected]>
Cc: Federico Serafini <[email protected]>
Cc: Bertrand Marquis <[email protected]>
--- xen/arch/arm/efi/efi-boot.h | 2 +- xen/arch/arm/include/asm/arm64/traps.h | 2 +- xen/arch/arm/include/asm/processor.h | 2 +- xen/arch/arm/setup.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
xen/arch/arm/efi/efi-boot.h +1 -1
@@ -934,7 +934,7 @@ static void __init efi_arch_blexit(void) efi_bs->FreePool (memmap); } -static void __init efi_arch_halt (void ) +static void noreturn__init efi_arch_halt (void ) {stop_cpu (); }
xen/arch/arm/include/asm/arm64/traps.h +1 -1
@@ -6,7 +6,7 @@ void inject_undef64_exception(struct cpu_user_regs *regs);void do_sysreg (struct cpu_user_regs *regs,const union hsr hsr); -void do_bad_mode (struct cpu_user_regs *regs,int reason); +void noreturndo_bad_mode (struct cpu_user_regs *regs,int reason);#endif /* __ASM_ARM64_TRAPS__ */ /*
xen/arch/arm/include/asm/processor.h +1 -1
@@ -571,7 +571,7 @@ extern register_t __cpu_logical_map[];#endif #ifndef __ASSEMBLY__ -void panic_PAR (uint64_t par); +void noreturnpanic_PAR (uint64_t par);/* Debugging functions are declared with external linkage to aid development. */ void show_registers (const struct cpu_user_regs *regs);
xen/arch/arm/setup.c +1 -1
@@ -63,7 +63,7 @@ bool __read_mostly acpi_disabled;domid_t __read_mostly max_init_domid; -static __used void init_done (void ) +static __used void noreturninit_done (void ) {int rc;
--
2.25.1
PATCH v2 3/3 xen/x86: add missing noreturn attributes
From: Nicola Vetrini <[email protected]>
The marked functions never return to their caller, but lack the `noreturn' attribute.
Functions that never return should be declared with a `noreturn' attribute.
The lack of `noreturn' causes a violation of MISRA C Rule 17.11 (not currently accepted in Xen), and also Rule 2.1: "A project shall not contain unreachable code". Depending on the compiler used and the compiler optimization used, the lack of `noreturn' might lead to the presence of unreachable code.
No functional change.
---
Changes in v2:
- improved commit message
---
Cc: Andrew Cooper <[email protected]>
Cc: Anthony PERARD <[email protected]>
Cc: Michal Orzel <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Roger Pau Monné <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Nicola Vetrini <[email protected]>
Cc: Federico Serafini <[email protected]>
Cc: Bertrand Marquis <[email protected]>
--- xen/arch/x86/cpu/mcheck/mce.c | 3 ++- xen/arch/x86/efi/efi-boot.h | 2 +- xen/arch/x86/smp.c | 2 +- xen/arch/x86/traps.c | 2 +- xen/arch/x86/x86_64/traps.c | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-)
xen/arch/x86/cpu/mcheck/mce.c +2 -1
@@ -79,7 +79,8 @@ static int __init cf_check mce_set_verbosity(const char *str)custom_param ("mce_verbosity" , mce_set_verbosity);/* Handle unconfigured int18 (should never happen) */ -static void cf_check unexpected_machine_check(const struct cpu_user_regs *regs) +static void noreturn cf_check +unexpected_machine_check (const struct cpu_user_regs *regs) {console_force_unlock ();printk ("Unexpected Machine Check Exception\n" );
xen/arch/x86/efi/efi-boot.h +1 -1
@@ -769,7 +769,7 @@ static void __init efi_arch_blexit(void) efi_bs->FreePages (ucode.addr,PFN_UP (ucode.size)); } -static void __init efi_arch_halt (void ) +static void noreturn__init efi_arch_halt (void ) {local_irq_disable ();for ( ; ; )
xen/arch/x86/smp.c +1 -1
@@ -343,7 +343,7 @@ void __stop_this_cpu(void)cpumask_clear_cpu (smp_processor_id (), &cpu_online_map); } -static void cf_check stop_this_cpu(void *dummy) +static void noreturn cf_check stop_this_cpu(void *dummy) {const bool *stop_aps = dummy;
xen/arch/x86/traps.c +1 -1
@@ -805,7 +805,7 @@ void fatal_trap(const struct cpu_user_regs *regs, bool show_remote) (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT"); } -void asmlinkage do_unhandled_trap(struct cpu_user_regs *regs) +void asmlinkage noreturn do_unhandled_trap(struct cpu_user_regs *regs) {fatal_trap (regs, false); }
xen/arch/x86/x86_64/traps.c +1 -1
@@ -293,7 +293,7 @@ void show_page_walk(unsigned long addr) l1_table_offset(addr), l1e_get_intpte(l1e), pfn); } -void asmlinkage do_double_fault(struct cpu_user_regs *regs) +void asmlinkage noreturn do_double_fault(struct cpu_user_regs *regs) {unsigned int cpu;struct extra_state state;
--
2.25.1
Re: [PATCH v2 3/3] xen/x86: add missing noreturn attributes
Quoted 14 lines · On Fri, 6 Jun 2025, [email protected] wrote:
From: Nicola Vetrini <[email protected]>
The marked functions never return to their caller, but lack the `noreturn' attribute.
Functions that never return should be declared with a `noreturn' attribute.
The lack of `noreturn' causes a violation of MISRA C Rule 17.11 (not currently accepted in Xen), and also Rule 2.1: "A project shall not contain unreachable code". Depending on the compiler used and the compiler optimization used, the lack of `noreturn' might lead to the presence of unreachable code.
Quoted 4 lines
No functional change.
Signed-off-by Nicola Vetrini <[email protected]>Signed-off-by Victor Lira <[email protected]>
Re: [PATCH v2 3/3] xen/x86: add missing noreturn attributes
In reply to [email protected]Quoted 14 lines · On Fri, Jun 06, 2025 at 02:27:09PM -0700, [email protected] wrote:
From: Nicola Vetrini <[email protected]>
The marked functions never return to their caller, but lack the `noreturn' attribute.
Functions that never return should be declared with a `noreturn' attribute.
The lack of `noreturn' causes a violation of MISRA C Rule 17.11 (not currently accepted in Xen), and also Rule 2.1: "A project shall not contain unreachable code". Depending on the compiler used and the compiler optimization used, the lack of `noreturn' might lead to the presence of unreachable code.
Quoted 4 lines
No functional change.
Signed-off-by Nicola Vetrini <[email protected]>Signed-off-by Victor Lira <[email protected]>
One question below.
Quoted 80 lines
---
Changes in v2:
- improved commit message
---
Cc: Andrew Cooper <[email protected]>
Cc: Anthony PERARD <[email protected]>
Cc: Michal Orzel <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Roger Pau Monné <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Nicola Vetrini <[email protected]>
Cc: Federico Serafini <[email protected]>
Cc: Bertrand Marquis <[email protected]>--- xen/arch/x86/cpu/mcheck/mce.c | 3 ++- xen/arch/x86/efi/efi-boot.h | 2 +- xen/arch/x86/smp.c | 2 +- xen/arch/x86/traps.c | 2 +- xen/arch/x86/x86_64/traps.c | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-)xen/arch/x86/cpu/mcheck/mce.c +2
-1@@ -79,7 +79,8 @@ static int __init cf_check mce_set_verbosity(const char *str)custom_param ("mce_verbosity" , mce_set_verbosity);/* Handle unconfigured int18 (should never happen) */ -static void cf_check unexpected_machine_check(const struct cpu_user_regs *regs) +static void noreturn cf_check +unexpected_machine_check (const struct cpu_user_regs *regs) {console_force_unlock ();printk ("Unexpected Machine Check Exception\n" );xen/arch/x86/efi/efi-boot.h +1
-1@@ -769,7 +769,7 @@ static void __init efi_arch_blexit(void) efi_bs->FreePages (ucode.addr,PFN_UP (ucode.size)); } -static void __init efi_arch_halt (void ) +static void noreturn__init efi_arch_halt (void ) {local_irq_disable ();for ( ; ; )xen/arch/x86/smp.c +1
-1@@ -343,7 +343,7 @@ void __stop_this_cpu(void)cpumask_clear_cpu (smp_processor_id (), &cpu_online_map); } -static void cf_check stop_this_cpu(void *dummy) +static void noreturn cf_check stop_this_cpu(void *dummy) {const bool *stop_aps = dummy;xen/arch/x86/traps.c +1
-1@@ -805,7 +805,7 @@ void fatal_trap(const struct cpu_user_regs *regs, bool show_remote) (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT"); } -void asmlinkage do_unhandled_trap(struct cpu_user_regs *regs) +void asmlinkage noreturn do_unhandled_trap(struct cpu_user_regs *regs) {fatal_trap (regs, false); }xen/arch/x86/x86_64/traps.c +0
-0
xen/arch/x86/x86_64/traps.c void show_page_walk(unsigned long addr) · line 296
Quoted 5 lines
xen/arch/x86/x86_64/traps.c +1
-1@@ -293,7 +293,7 @@ void show_page_walk(unsigned long addr) l1_table_offset(addr), l1e_get_intpte(l1e), pfn); } -void asmlinkage do_double_fault(struct cpu_user_regs *regs) +void asmlinkage noreturn do_double_fault(struct cpu_user_regs *regs)
Does noreturn matter for functions called from assembly (asmlinkage ones)? In that case the hint is not useful for code generation, since it's hand written assembly already? (it's arguably useful for the developer writing the code)
Might be worth mentioning in the commit message if the above is accurate. For example by adding to the commit message: "noreturn is not relevant for functions called from assembly, but can be used as a hint for the developers writing the code".
Thanks, Roger.
Re: [PATCH v2 3/3] xen/x86: add missing noreturn attributes
Quoted 120 lines · Roger Pau Monné
Quoted 14 lines · On Fri, Jun 06, 2025 at 02:27:09PM -0700, [email protected] wrote:
From: Nicola Vetrini <[email protected]>
The marked functions never return to their caller, but lack the `noreturn' attribute.
Functions that never return should be declared with a `noreturn' attribute.
The lack of `noreturn' causes a violation of MISRA C Rule 17.11 (not currently accepted in Xen), and also Rule 2.1: "A project shall not contain unreachable code". Depending on the compiler used and the compiler optimization used, the lack of `noreturn' might lead to the presence of unreachable code.
Quoted 4 lines
No functional change.
Signed-off-by Nicola Vetrini <[email protected]>Signed-off-by Victor Lira <[email protected]>Acked-by Roger Pau Monné <[email protected]>One question below.
Quoted 85 lines
---
Changes in v2:
- improved commit message
---
Cc: Andrew Cooper <[email protected]>
Cc: Anthony PERARD <[email protected]>
Cc: Michal Orzel <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Roger Pau Monné <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Nicola Vetrini <[email protected]>
Cc: Federico Serafini <[email protected]>
Cc: Bertrand Marquis <[email protected]>--- xen/arch/x86/cpu/mcheck/mce.c | 3 ++- xen/arch/x86/efi/efi-boot.h | 2 +- xen/arch/x86/smp.c | 2 +- xen/arch/x86/traps.c | 2 +- xen/arch/x86/x86_64/traps.c | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-)xen/arch/x86/cpu/mcheck/mce.c +2
-1@@ -79,7 +79,8 @@ static int __init cf_check mce_set_verbosity(const char *str) custom_param("mce_verbosity", mce_set_verbosity);/* Handle unconfigured int18 (should never happen) */ -static void cf_check unexpected_machine_check(const struct cpu_user_regs *regs) +static void noreturn cf_check +unexpected_machine_check (const struct cpu_user_regs *regs) {console_force_unlock(); printk("Unexpected Machine Check Exception\n");xen/arch/x86/efi/efi-boot.h +1
-1@@ -769,7 +769,7 @@ static void __init efi_arch_blexit(void) efi_bs->FreePages (ucode.addr,PFN_UP (ucode.size)); } -static void __init efi_arch_halt (void ) +static void noreturn__init efi_arch_halt (void ) {local_irq_disable ();for ( ; ; )xen/arch/x86/smp.c +1
-1@@ -343,7 +343,7 @@ void __stop_this_cpu(void)cpumask_clear_cpu (smp_processor_id (), &cpu_online_map); } -static void cf_check stop_this_cpu(void *dummy) +static void noreturn cf_check stop_this_cpu(void *dummy) {const bool *stop_aps = dummy;xen/arch/x86/traps.c +1
-1@@ -805,7 +805,7 @@ void fatal_trap(const struct cpu_user_regs *regs, bool show_remote) (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT"); } -void asmlinkage do_unhandled_trap(struct cpu_user_regs *regs) +void asmlinkage noreturn do_unhandled_trap(struct cpu_user_regs *regs){ fatal_trap(regs, false);}
xen/arch/x86/x86_64/traps.c +0
-0xen/arch/x86/x86_64/traps.c void show_page_walk(unsigned long addr) · line 296
Quoted 5 lines
xen/arch/x86/x86_64/traps.c +1
-1@@ -293,7 +293,7 @@ void show_page_walk(unsigned long addr) l1_table_offset(addr), l1e_get_intpte(l1e), pfn); } -void asmlinkage do_double_fault(struct cpu_user_regs *regs) +void asmlinkage noreturn do_double_fault(struct cpu_user_regs *regs)Does noreturn matter for functions called from assembly (asmlinkage ones)? In that case the hint is not useful for code generation, since it's hand written assembly already? (it's arguably useful for the developer writing the code)
Quoted 5 lines
Might be worth mentioning in the commit message if the above is accurate. For example by adding to the commit message: "noreturn is not relevant for functions called from assembly, but can be used as a hint for the developers writing the code".
Yes, it is relevant because the rule considers only the single function, not the context where it is called (that is orders of magnitude more difficult to check automatically). For my part, I'm ok with your suggestion.
Quoted 1 line
Thanks, Roger.
Signature · 4 lines
Nicola Vetrini, B.Sc. Software Engineer BUGSENG (https://bugseng.com) LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
Re: [PATCH v2 3/3] xen/x86: add missing noreturn attributes
Quoted 128 lines · Nicola Vetrini
Quoted 121 lines · Roger Pau Monné
Quoted 14 lines · On Fri, Jun 06, 2025 at 02:27:09PM -0700, [email protected] wrote:
From: Nicola Vetrini <[email protected]>
The marked functions never return to their caller, but lack the `noreturn' attribute.
Functions that never return should be declared with a `noreturn' attribute.
The lack of `noreturn' causes a violation of MISRA C Rule 17.11 (not currently accepted in Xen), and also Rule 2.1: "A project shall not contain unreachable code". Depending on the compiler used and the compiler optimization used, the lack of `noreturn' might lead to the presence of unreachable code.
Quoted 4 lines
No functional change.
Signed-off-by Nicola Vetrini <[email protected]>Signed-off-by Victor Lira <[email protected]>Acked-by Roger Pau Monné <[email protected]>One question below.
Quoted 86 lines
---
Changes in v2:
- improved commit message
---
Cc: Andrew Cooper <[email protected]>
Cc: Anthony PERARD <[email protected]>
Cc: Michal Orzel <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Roger Pau Monné <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Nicola Vetrini <[email protected]>
Cc: Federico Serafini <[email protected]>
Cc: Bertrand Marquis <[email protected]>--- xen/arch/x86/cpu/mcheck/mce.c | 3 ++- xen/arch/x86/efi/efi-boot.h | 2 +- xen/arch/x86/smp.c | 2 +- xen/arch/x86/traps.c | 2 +- xen/arch/x86/x86_64/traps.c | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-)xen/arch/x86/cpu/mcheck/mce.c +2
-1@@ -79,7 +79,8 @@ static int __init cf_check mce_set_verbosity(const char *str) custom_param("mce_verbosity", mce_set_verbosity);/* Handle unconfigured int18 (should never happen) */ -static void cf_check unexpected_machine_check(const struct cpu_user_regs *regs) +static void noreturn cf_check +unexpected_machine_check (const struct cpu_user_regs *regs) {console_force_unlock(); printk("Unexpected Machine Check Exception\n");xen/arch/x86/efi/efi-boot.h +1
-1@@ -769,7 +769,7 @@ static void __init efi_arch_blexit(void) efi_bs->FreePages (ucode.addr,PFN_UP (ucode.size)); } -static void __init efi_arch_halt (void ) +static void noreturn__init efi_arch_halt (void ) {local_irq_disable ();for ( ; ; )xen/arch/x86/smp.c +1
-1@@ -343,7 +343,7 @@ void __stop_this_cpu(void)cpumask_clear_cpu (smp_processor_id (), &cpu_online_map); } -static void cf_check stop_this_cpu(void *dummy) +static void noreturn cf_check stop_this_cpu(void *dummy) {const bool *stop_aps = dummy;xen/arch/x86/traps.c +1
-1@@ -805,7 +805,7 @@ void fatal_trap(const struct cpu_user_regs *regs, bool show_remote) (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT"); } -void asmlinkage do_unhandled_trap(struct cpu_user_regs *regs) +void asmlinkage noreturn do_unhandled_trap(struct cpu_user_regs *regs){ fatal_trap(regs, false);}
xen/arch/x86/x86_64/traps.c +0
-0xen/arch/x86/x86_64/traps.c void show_page_walk(unsigned long addr) · line 296
Quoted 5 lines
xen/arch/x86/x86_64/traps.c +1
-1@@ -293,7 +293,7 @@ void show_page_walk(unsigned long addr) l1_table_offset(addr), l1e_get_intpte(l1e), pfn); } -void asmlinkage do_double_fault(struct cpu_user_regs *regs) +void asmlinkage noreturn do_double_fault(struct cpu_user_regs *regs)Does noreturn matter for functions called from assembly (asmlinkage ones)? In that case the hint is not useful for code generation, since it's hand written assembly already? (it's arguably useful for the developer writing the code)
Quoted 5 lines
Might be worth mentioning in the commit message if the above is accurate. For example by adding to the commit message: "noreturn is not relevant for functions called from assembly, but can be used as a hint for the developers writing the code".
Quoted 3 lines
Yes, it is relevant because the rule considers only the single function, not the context where it is called (that is orders of magnitude more difficult to check automatically). For my part, I'm ok with your suggestion.
Thanks, so if my understanding is correct the usage of the noreturn attribute together with asmlinkage is only for the benefit of the analysis tools, as from a code generation perspective it makes no difference.
Roger.
Re: [PATCH v2 3/3] xen/x86: add missing noreturn attributes
In reply to Nicola VetriniQuoted 37 lines · Nicola Vetrini
Quoted 31 lines · Roger Pau Monné
Quoted 19 lines · On Fri, Jun 06, 2025 at 02:27:09PM -0700, [email protected] wrote:
xen/arch/x86/traps.c +1
-1@@ -805,7 +805,7 @@ void fatal_trap(const struct cpu_user_regs *regs, bool show_remote) (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT"); } -void asmlinkage do_unhandled_trap(struct cpu_user_regs *regs) +void asmlinkage noreturn do_unhandled_trap(struct cpu_user_regs *regs){ fatal_trap(regs, false);}
xen/arch/x86/x86_64/traps.c +0
-0xen/arch/x86/x86_64/traps.c void show_page_walk(unsigned long addr) · line 296
Quoted 5 lines
xen/arch/x86/x86_64/traps.c +1
-1@@ -293,7 +293,7 @@ void show_page_walk(unsigned long addr) l1_table_offset(addr), l1e_get_intpte(l1e), pfn); } -void asmlinkage do_double_fault(struct cpu_user_regs *regs) +void asmlinkage noreturn do_double_fault(struct cpu_user_regs *regs)Does noreturn matter for functions called from assembly (asmlinkage ones)? In that case the hint is not useful for code generation, since it's hand written assembly already? (it's arguably useful for the developer writing the code)
Quoted 4 lines
Might be worth mentioning in the commit message if the above is accurate. For example by adding to the commit message: "noreturn is not relevant for functions called from assembly, but can be used as a hint for the developers writing the code".
Quoted 4 lines
Yes, it is relevant because the rule considers only the single function, not the context where it is called (that is orders of magnitude more difficult to check automatically). For my part, I'm ok with your suggestion.
Right. In fact for non-static functions the attribute normally would go on the declaration. The need to have it on the definition in the two cases above is an aspect that may also want to go into the amended description.
Jan
Re: [PATCH v2 2/3] xen/arm: add missing noreturn attributes
In reply to [email protected]Quoted 14 lines · On Fri, 6 Jun 2025, [email protected] wrote:
From: Nicola Vetrini <[email protected]>
The marked functions never return to their caller, but lack the `noreturn' attribute.
Functions that never return should be declared with a `noreturn' attribute.
The lack of `noreturn' causes a violation of MISRA C Rule 17.11 (not currently accepted in Xen), and also Rule 2.1: "A project shall not contain unreachable code". Depending on the compiler used and the compiler optimization used, the lack of `noreturn' might lead to the presence of unreachable code.
Quoted 4 lines
No functional change.
Signed-off-by Nicola Vetrini <[email protected]>Signed-off-by Victor Lira <[email protected]>
Quoted 5 lines · On 06.06.2025 23:27, [email protected] wrote:
From: Nicola Vetrini <[email protected]>
Function
reboot_machine' does not return, but lacks thenoreturn' attribute.
Quoted 8 lines
Functions that never return should be declared with a `noreturn' attribute.
The lack of `noreturn' causes a violation of MISRA C Rule 17.11 (not currently accepted in Xen), and also Rule 2.1: "A project shall not contain unreachable code". Depending on the compiler used and the compiler optimization used, the lack of `noreturn' might lead to the presence of unreachable code.
I continue to be unhappy about this: I still fail to see how this "might" could materialize in the specific case here. My earlier request for commit message improvement was specifically about making the description match the particular case, not to add further general wording. That said, if others feel like ack-ing this in this form, so be it.
Jan
Quoted 14 lines · On Fri, 6 Jun 2025, [email protected] wrote:
From: Nicola Vetrini <[email protected]>
Function
reboot_machine' does not return, but lacks thenoreturn' attribute.Functions that never return should be declared with a `noreturn' attribute.
The lack of `noreturn' causes a violation of MISRA C Rule 17.11 (not currently accepted in Xen), and also Rule 2.1: "A project shall not contain unreachable code". Depending on the compiler used and the compiler optimization used, the lack of `noreturn' might lead to the presence of unreachable code.
Quoted 4 lines
No functional change.
Signed-off-by Nicola Vetrini <[email protected]>Signed-off-by Victor Lira <[email protected]>