Skip to main content

IAR Embedded Workbench for RISC-V 3.40

MISRAC2004-20.7

In this section:
Synopsis

(Required) The setjmp macro and the longjmp function shall not be used.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Detected use of setjmp.h. This check is identical to MISRAC++2008-17-0-5, MISRAC2012-Rule-21.4.

Coding standards
CERT ERR34-CPP

Do not use longjmp

MISRA C:2004 20.7

(Required) The setjmp macro and the longjmp function shall not be used.

MISRA C:2012 Rule-21.4

(Required) The standard header file <setjmp.h> shall not be used

MISRA C++ 2008 17-0-5

(Required) The setjmp macro and the longjmp function shall not be used.

Code examples

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

#include <setjmp.h>

jmp_buf ex;

void example(void) {
  setjmp(ex);
}

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

void example(void) {
}