8000 Silence clang-tidy "unused variable" warnings by dunhor · Pull Request #1438 · microsoft/cppwinrt · GitHub
[go: up one dir, main page]

Skip to content

Silence clang-tidy "unused variable" warnings#1438

Merged
dunhor merged 1 commit intomasterfrom
dunhor/tidyfix
Oct 2, 2024
Merged

Silence clang-tidy "unused variable" warnings#1438
dunhor merged 1 commit intomasterfrom
dunhor/tidyfix

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
@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

0