Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Silence clang-tidy "unused variable" warnings#1438

Merged
dunhor merged 1 commit intomastermicrosoft/cppwinrt:masterfrom
dunhor/tidyfixmicrosoft/cppwinrt:dunhor/tidyfixCopy head branch name to clipboard
Oct 2, 2024
Merged

Silence clang-tidy "unused variable" warnings#1438
dunhor merged 1 commit intomastermicrosoft/cppwinrt:masterfrom
dunhor/tidyfixmicrosoft/cppwinrt:dunhor/tidyfixCopy head branch name to clipboard

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.