rspec/rules/S1761/cfamily/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

43 lines
1.2 KiB
Plaintext

== Why is this an issue?
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
[source,cpp]
----
#undef __LINE__
----
== Resources
* MISRA C:2004, 20.1 - Reserved identifiers, macros and functions in the standard library shall not be defined, redefined, or undefined
* MISRA {cpp}: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
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Remove this XXX directive
'''
== Comments And Links
(visible only on this page)
=== is related to: S979
endif::env-github,rspecator-view[]