Skip to content
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

C++: Support more "noreturn" attributes in DefaultOptions #18510

Merged
merged 5 commits into from
Jan 16, 2025

Conversation

jketema
Copy link
Contributor

@jketema jketema commented Jan 16, 2025

Pull Request checklist

All query authors

Internal query authors only

  • Autofixes generated based on these changes are valid, only needed if this PR makes significant changes to .ql, .qll, or .qhelp files. See the documentation (internal access required).
  • Changes are validated at scale (internal access required).
  • Adding a new query? Consider also adding the query to autofix.

@github-actions github-actions bot added the C++ label Jan 16, 2025
@jketema jketema added the no-change-note-required This PR does not need a change note label Jan 16, 2025
@jketema jketema removed the no-change-note-required This PR does not need a change note label Jan 16, 2025
@jketema jketema marked this pull request as ready for review January 16, 2025 12:13
@Copilot Copilot bot review requested due to automatic review settings January 16, 2025 12:13
@jketema jketema requested a review from a team as a code owner January 16, 2025 12:13

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 4 changed files in this pull request and generated no comments.

Files not reviewed (3)
  • cpp/ql/lib/DefaultOptions.qll: Language not supported
  • cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/test.c: Language not supported
  • cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/test.cpp: Language not supported

Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more

f18(); // GOOD
}

[[___Noreturn__]] void f20();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's going on with __Noreturn__ (in the change note), ___Noreturn__ (here, with the extra _), and the predicate itself (which list neither)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be with just two _, well spotted. Let me temporarily put this back in draft and fix this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wrong. It should be three _ as a prefix and two as a suffix, so it's just the change note that's incorrect. See: https://en.cppreference.com/w/c/language/attributes/noreturn. Note that the lower case version just has two _ both as prefix and as suffix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The predicate itself does not list ___Noreturn__, as the frontend strips off two of the _ in the prefix and also strips off the __ suffix. So, those do not end up in the database.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, they've made this unnecessarily fiddly!

@jketema jketema marked this pull request as draft January 16, 2025 16:42
@jketema jketema marked this pull request as ready for review January 16, 2025 16:56
@jketema jketema merged commit e6eaf5e into github:main Jan 16, 2025
15 checks passed
@jketema jketema deleted the noreturn branch January 16, 2025 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants