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

enabled and mitigated readability-const-return-type clang-tidy warnings #5644

Merged
merged 1 commit into from
Nov 24, 2023

Conversation

firewave
Copy link
Collaborator

@firewave firewave commented Nov 9, 2023

No description provided.

@firewave
Copy link
Collaborator Author

firewave commented Nov 9, 2023

Still need to file upstream tickets about the false positive and lacking context:

/home/runner/work/cppcheck/cppcheck/lib/utils.h:39:5: error: return type 'typename pair<const int, const Variable *>::first_type' (aka 'const int') is 'const'-qualified at the top level, which may reduce code readability without improving const correctness [readability-const-return-type,-warnings-as-errors]
   39 |     typename Pair::first_type operator()(const Pair& p) const {
      |     ^

@firewave firewave marked this pull request as ready for review November 9, 2023 11:15
@@ -772,6 +772,7 @@ void ProjectFileDialog::addSingleSuppression(const Suppressions::Suppression &su
void ProjectFileDialog::setSuppressions(const QList<Suppressions::Suppression> &suppressions)
{
mUI->mListSuppressions->clear();
// NOLINTNEXTLINE(readability-const-return-type) - neeeds to be a copy since it might be a reference to mSuppressions
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this really related?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What do you mean?

Copy link
Collaborator

Choose a reason for hiding this comment

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

There is no return type on that line, so what does clang-tidy warn about?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. Maybe yet another false positive in this check. Although it is a valid warning and possibly even a false negative on our side.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds like the NOLINT should be for performance-unnecessary-copy-initialization?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If it would report that warning and we would not suppress it correctly the CI would fail.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, but unmatched NOLINTs don't seem to cause a warning: llvm/llvm-project#69674

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah - this is unrelated. Will revert.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@firewave firewave marked this pull request as draft November 9, 2023 12:14
@firewave
Copy link
Collaborator Author

I filed llvm/llvm-project#73270 about the missing context.

@firewave firewave marked this pull request as ready for review November 24, 2023 00:27
@chrchr-github chrchr-github merged commit 86bb7c9 into danmar:main Nov 24, 2023
68 checks passed
@firewave firewave deleted the tidy-const-return branch November 24, 2023 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants