Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lcartey opened this issue Oct 21, 2024 · 0 comments · Fixed by #769
Closed

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

lcartey opened this issue Oct 21, 2024 · 0 comments · Fixed by #769
Assignees
Labels
Difficulty-Medium A false positive or false negative report which is expected to take 1-5 days effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-High

Comments

@lcartey
Copy link
Collaborator

lcartey commented Oct 21, 2024

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:

  • 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
@lcartey lcartey added Difficulty-Medium A false positive or false negative report which is expected to take 1-5 days effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-High labels Oct 21, 2024
@lcartey lcartey self-assigned this Oct 21, 2024
@lcartey lcartey moved this from Reported to Ready for review in Coding Standards Public Development Board Oct 21, 2024
@github-project-automation github-project-automation bot moved this from Ready for review to Done in Coding Standards Public Development Board Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty-Medium A false positive or false negative report which is expected to take 1-5 days effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-High
Projects
1 participant