github / codeql-coding-standards

This repository contains CodeQL queries and libraries which support various Coding Standards.
MIT License
129 stars 59 forks source link

`RULE-5-4`: Ignore macros defined on different compilation paths #768

Closed lcartey closed 1 month ago

lcartey commented 1 month ago

Affected rules

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:

Example

#ifdef FOO
#define X 1 // COMPLIANT
#else
#define X 2 // COMPLIANT
#endif