MISRAC++2023-9.6.4
In this section:
Synopsis
(Required) A function declared with the [[noreturn]] attribute shall not return
Enabled by default
Yes
Severity/Certainty
Low/High

Full description
A function with a [[noreturn]] function specifier returns. This check is identical to MISRAC2012-Rule-17.9.
Coding standards
- MISRA C:2012 Rule-17.9
(Mandatory) A function declared with a _Noreturn function specifier shall not return to its caller
Code examples
The following code example fails the check and will give a warning:
[[noreturn]]
void example () { /* Non-compliant */
return;
}
The following code example passes the check and will not give a warning about this issue:
[[noreturn]]
void example () {
abort(); // Compliant - no return from abort().
}