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

Resolve some default error warnings #7191

Conversation

bob80905
Copy link
Collaborator

DxilContainerValidation.cpp has some int / bool comparisons that cause default error warnings in some of the private builds.
This needs to be addressed. This PR changes the comparisons by converting the numerical expressions into the appropriate boolean, then comparing the booleans.

@bob80905 bob80905 requested a review from a team as a code owner March 11, 2025 00:22
Copy link
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

@bob80905 bob80905 merged commit a2979e7 into microsoft:main Mar 11, 2025
13 checks passed
bob80905 added a commit to bob80905/DirectXShaderCompiler that referenced this pull request Mar 12, 2025
DxilContainerValidation.cpp has some int / bool comparisons that cause
default error warnings in some of the private builds.
This needs to be addressed. This PR changes the comparisons by
converting the numerical expressions into the appropriate boolean, then
comparing the booleans.
bob80905 added a commit to bob80905/DirectXShaderCompiler that referenced this pull request Mar 12, 2025
DxilContainerValidation.cpp has some int / bool comparisons that cause
default error warnings in some of the private builds.
This needs to be addressed. This PR changes the comparisons by
converting the numerical expressions into the appropriate boolean, then
comparing the booleans.
else
Mismatch |= PSVSE0->SemanticKind != static_cast<uint8_t>(SE.GetKind());
Mismatch |= PSVSE0->SemanticKind != static_cast<uint8_t>(SE.GetKind()) == 0
Copy link
Contributor

@tex3d tex3d Mar 12, 2025

Choose a reason for hiding this comment

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

This change was unnecessary, plus it scares me a bit how we would be dependent on a left to right order of evaluating the comparison operations without parentheses to enforce the correct order (and the final comparison is basically (bool) == (int)).

Also, we could use != 0 everywhere instead of == 0 ? false : true. That would be keeping with most of the other similar code elsewhere in this file, and it's easier to read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants