Skip to content

[NFC] Fix unused variable warning#7877

Merged
damyanp merged 1 commit into
microsoft:mainfrom
damyanp:warnings
Nov 5, 2025
Merged

[NFC] Fix unused variable warning#7877
damyanp merged 1 commit into
microsoft:mainfrom
damyanp:warnings

Conversation

@damyanp
Copy link
Copy Markdown
Member

@damyanp damyanp commented Nov 5, 2025

DataSize is only used in a DXASSERT, which is compile out in some configurations resulting in a unused variable warning. This change adds a [[maybe_unused]] attribute to suppress that warning.

DataSize is only used in a DXASSERT, which is compile out in some configurations resulting in a unused variable warning. This change adds a [[maybe_unused]] attribute to suppress that warning.
@damyanp damyanp changed the title [nfc] Fix unused variable warning [NFC] Fix unused variable warning Nov 5, 2025
// enough space.
const size_t NumElements = TestData.size();
const size_t DataSize = sizeof(T) * NumElements;
[[maybe_unused]] const size_t DataSize = sizeof(T) * NumElements;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could also just replace the use of DataSize with 'sizeof(T) * NumElements instead.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That cascades a bit because there's a comment talking about DataSize above that would also need to be updated. Having the separate named variable is nice and self documenting.

Copy link
Copy Markdown
Contributor

@alsepkow alsepkow left a comment

Choose a reason for hiding this comment

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

lgtm

@damyanp damyanp merged commit facd05a into microsoft:main Nov 5, 2025
14 checks passed
@github-project-automation github-project-automation Bot moved this from New to Done in HLSL Roadmap Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants