Skip to main content

IAR Embedded Workbench for RX 5.20

MISRAC2012-Rule-17.11

In this section:
Synopsis

(Advisory) A function that never returns should be declared with a _Noreturn function specifier.

Enabled by default

No

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Found a function expected to have _Noreturn function specifier.

Coding standards
MISRA C:2012 Rule-17.10

(Required) A function declared with a _Noreturn function specifier shall have void return type

Code examples

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

#include <stdint.h>

typedef int32_t (*pfn_i)(void);
extern int32_t func1 ( void ); /* Note: A function */
pfn_i pfn2 = func1; /* Non-compliant */

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

#include <stdint.h>

typedef int32_t (*pfn_i)(void);
extern int32_t func1 ( void ); /* Note: A function */
pfn_i pfn1 = &func1; /* Compliant */