`A15-4-4`: Functions that allocate are considered non-throwing

Open
#662 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
devtools

Research direction

Start with rules/A15-4-4/MissingNoExcept.ql and the A15-4-4 example in the issue, then inspect how the generated MissingNoExcept.bqrs result treats string.append. Done means the rule no longer suggests noexcept for functions whose calls may implicitly throw std::bad_alloc, while preserving the existing behavior for genuinely non-throwing functions.

Written by the indexing model from the issue text.

Description

Difficulty-Medium false positive/false negative Impact-Medium Standard-AUTOSAR user-report
Affected rules
  • A15-4-4
Description

A15-4-4/MissingNoExcept.ql flags functions which are not noexcept when no exception is explicitly thrown by them (or the functions they call). Unfortunately, this doesn't take into a account the fact that std::bad_alloc can be implicitly thrown by functions which allocate.

Example
void AppendTo(std::string& string) {
  // rules/A15-4-4/MissingNoExcept.bqrs:
  //   Function AppendTo could be declared noexcept(true).
  static_cast<void>(string.append("foo"));
}
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.