Skip to main content

IAR Embedded Workbench for RISC-V 3.40

MISRAC2012-Rule-21.1

In this section:
Synopsis

(Required) #define and #undef shall not be used on a reserved identifier or reserved macro name

Enabled by default

Yes

Severity/Certainty

Low/Low

lowlow.png
Full description

Detected a #define or #undef of a reserved identifier in the standard library. This check is identical to MISRAC2004-20.1, MISRAC++2008-17-0-1.

Coding standards
MISRA C:2004 20.1

(Required) Reserved identifiers, macros, and functions in the standard library shall not be defined, redefined, or undefined.

MISRA C:2012 Rule-21.1

(Required) #define and #undef shall not be used on a reserved identifier or reserved macro name

MISRA C++ 2008 17-0-1

(Required) Reserved identifiers, macros and functions in the standard library shall not be defined, redefined or undefined.

Code examples

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

#define __TIME__ 11111111 /* Non-compliant */

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

#define A(x) (x) /* Compliant */