`RULE-8-13`: Consider possible macro false positives

Open
#775 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp
Domain
devtools

Research direction

Start with the RULE-8-13 query and the macro expansion example in this issue. Determine whether generated variables should be reported, whether the macro or its instantiations are the reporting point, and what behavior should apply across different instantiations before defining completion criteria.

Written by the indexing model from the issue text.

Description

Difficulty-High false positive/false negative Impact-Low Standard-MISRA-C
Affected rules
  • RULE-8-13
Description

Should we flag variables generated from macro expansions as missing const?

Some considerations:

  • Should we flag the macro itself, as that's where const would need to be added?
  • If so, should we only flag if the variable could be const in all instantiations of the macro?
Example
#define FOO int x = 0;

..
int f() {
  FOO; // NON_COMPLIANT?
  return x;
}
Dominant language
CodeQL
Stars
227
Forks
82
Avg merge
6d 7h
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/codeql-coding-standards

All issues in github/codeql-coding-standards

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.