-
Type:
Code Smell Detection
-
Status: Active
-
Resolution: Unresolved
-
Labels:
-
Message:Remove this XXX directive
-
Default Severity:Critical
-
Impact:High
-
Likelihood:Low
-
Default Quality Profiles:Sonar way, MISRA C++ 2008 recommended
-
Covered Languages:C, C++, Objective-C
-
Remediation Function:Constant/Issue
-
Constant Cost:10min
-
MISRA C 2004:20.1
-
MISRA C 2012:21.1
-
MISRA C++ 2008:17-0-1
-
PC-Lint:136, 1136
The standard, predefined macros, such as _FILE and LINE_, are primarily intended for use by the implementation, and changing them could result in undefined behavior.
This rule checks that the following predefined macros are not defined, undefined, or redefined: assert, errno, _FILE, LINE, TIME, DATE, TIMESTAMP, COUNTER, INCLUDE_LEVEL, BASE_FILE_, and _Pragma.
Noncompliant Code Example
#undef __LINE__
See
- MISRA C:2004, 20.1 - Reserved identifiers, macros and functions in the standard library shall not be defined, redefined, or undefined
- MISRA C++:2008, 17-0-1 - Reserved identifiers, macros and functions in the standard library shall not be defined, redefined, or undefined
- MISRA C:2012, 21.1 - #define and #undef shall not be used on a reserved identifier or reserved macro name