Macros defined on different compilation paths do not fall afoul of this rule - the first macro must be defined in the same compilation to trigger the rule. We should consider:
Conditional includes
Conditional macro assignment e.g. macros defined in different branches of a #ifdef/#elsif.
Macros defined inside an #ifndef <MACRO_NAME> check for the same name.
Example
#ifdef FOO
#define X 1 // COMPLIANT
#else
#define X 2 // COMPLIANT
#endif
Affected rules
RULE-5-4
Description
Macros defined on different compilation paths do not fall afoul of this rule - the first macro must be defined in the same compilation to trigger the rule. We should consider:
#ifdef
/#elsif
.#ifndef <MACRO_NAME>
check for the same name.Example