Skip to main content

IAR Embedded Workbench for RL78 5.20

MISRAC2012-Rule-17.9

In this section:
Synopsis

(Mandatory) A function declared with a _Noreturn function specifier shall not return to its caller.

Enabled by default

No

Severity/Certainty

Low/High

lowhigh.png
Full description

A function with a _Noreturn function specifier returns. This check is identical to MISRAC++2023-9.6.4.

Coding standards
MISRA C:2012 Rule-17.9

(Mandatory) A function declared with a _Noreturn function specifier shall not return to its caller

MISRA C++ 2023 9.6.4

(Required) A function declared with the [[noreturn]] attribute shall not return

Code examples

The following code example fails the check and will give a warning:

_Noreturn void a ( void ) { return; } /* Non-compliant  */

The following code example passes the check and will not give a warning about this issue:

_Noreturn void c ( void ) { abort(); } /* Compliant - no return from abort(). */