Repository navigation
[linux-port] Add missing case statements - #222
Conversation
|
✅ Build DirectXShaderCompiler 1.0.100 completed (commit 4b2c5d6f49 by @pow2clk) |
There was a problem hiding this comment.
This is a change in behavior. Is it the right behavior? I don't know...
There was a problem hiding this comment.
These are processor specific types. Unless dxil runs on PPC or x86 (it doesn't does it?) it shouldn't be hit. Even if it does, I doubt it'd use these optimizations.
There was a problem hiding this comment.
Changes behavior .... It does look like a reasonable change though.
There was a problem hiding this comment.
do we need these 3 case statements now that we have added the default below?
There was a problem hiding this comment.
change in behavior: These cases used to hit llvm_unreachable, but now hit false. Is this the correct behavior?
There was a problem hiding this comment.
change in behavior: These cases used to hit llvm_unreachable, but now hit false. Is this the correct behavior?
There was a problem hiding this comment.
these types can't be function declarations. So returning false seems correct.
There was a problem hiding this comment.
Not sure about this one... they should probably actually implement these cases? >.<
There was a problem hiding this comment.
This function is for generating DWARF data for debugging purposes. I don't think any HLSL debuggers use that format. Do they?
|
These are the tricky ones. Every bug I ran into developing this was due to this kind of changed behavior. I'll look at these more closely and maybe split them up further to better drill down which can safely be resolved with a default: break;, which should be errors, and which should have actual implementations. |
9466403 to
e5b8bec
Compare
|
I've audited all the case and default statements I added. I've added comments explaining the default statements. I removed any that were less certain so they can be addressed in a later change with more scrutiny. |
There was a problem hiding this comment.
This conditional and switch is a duplicate of the previous. It depends on the same variables for the result and changes none of them. So the repetition accomplishes nothing.
|
✅ Build DirectXShaderCompiler 1.0.164 completed (commit bea6fbdcb1 by @pow2clk) |
pow2clk
left a comment
There was a problem hiding this comment.
Now I've investigated the issues further, I can respond belatedly to your review comments.
There was a problem hiding this comment.
these types can't be function declarations. So returning false seems correct.
There was a problem hiding this comment.
This function is for generating DWARF data for debugging purposes. I don't think any HLSL debuggers use that format. Do they?
There was a problem hiding this comment.
I think in some cases (where the case matches, but the if condition inside the case isn't true), AssignOpt used to be executed, but now won't.
There was a problem hiding this comment.
Yeah. it looks like you're right. I'll move it back out and make it a break.
When switching over an enum value, the ideal is to include a case for every possibly value. Where possible, that's what this change does to silence warnings and also to provide space to properly handle every possible input and throw a warning should a new one be added. In some cases, it's not practical to list every input. In these cases, putting a default that doesn't change the behavior, but let's the compiler know that the behavior is intended. Fixes 133 clang and 8108(!) gcc warnings. Contributes to google#206
|
✅ Build DirectXShaderCompiler 1.0.169 completed (commit 1ca3546e17 by @pow2clk) |
|
Bots passing. |
When switching over an enum value, the ideal is to include a case
for every possibly value. Where possible, that's what this change
does to silence warnings and also to provide space to properly
handle every possible input and throw a warning should a new one
be added. In some cases, it's not practical to list every input.
In these cases, putting a default that doesn't change the behavior,
but let's the compiler know that the behavior is intended.
Fixes 133 clang and 8108(!) gcc warnings.
Contributes to #206