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

Silence clang-tidy "unused variable" warnings #1438

Merged
merged 1 commit into from
Oct 2, 2024
Merged

Conversation

dunhor
Copy link
Member

@dunhor dunhor commented Oct 2, 2024

Clang-tidy (and I'm pretty sure just Clang in general since this is a Clang diagnostic) warns that these variables are unused. This happens because the single threaded collections types use the following lock guard type:

struct nop_lock_guard {};

I could also fix this issue by adding a destructor to the type, however that may have consequences on code-gen. This seemed to be the less risky change with the tradeoff of touching more lines.

@sylveon
Copy link
Contributor

sylveon commented Oct 2, 2024

Would doing struct [[nodiscard]] nop_lock_guard {}; silence the warning as well?

@dunhor
Copy link
Member Author

dunhor commented Oct 2, 2024

Would doing struct [[nodiscard]] nop_lock_guard {}; silence the warning as well?

Looks like no: https://godbolt.org/z/YY9vEqh4s

@dunhor dunhor merged commit f9ec198 into master Oct 2, 2024
75 checks passed
@dunhor dunhor deleted the dunhor/tidyfix branch October 2, 2024 22:15
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.

4 participants