-
Notifications
You must be signed in to change notification settings - Fork 692
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
[CLANG_CL] Fix clang-cl warnings #5660
Conversation
Add -Wno used for clang in linux build. Fix -Wimplicit-fallthrough -Wconstant-logical-operand (Thanks patch from Chris) -Wunused-function -Wunused-variable -Wtrigraphs Still more warnings to be fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lot of good changes here. I'm curious why these are getting found iteratively instead of all at once. I think we had a previous bunch of changes along these lines.
I do have a few requests. Let me know if you're unsure if something can be left out or not.
{ L"filename2.fx", STGTY_STREAM, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, 0, 0, GUID_NULL, 0, 0 } | ||
}; | ||
unsigned testCount = (unsigned)_countof(items); | ||
STATSTG items[] = {{const_cast<wchar_t *>(L"filename.hlsl"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unfortunate that the filename in STATSTG isn't const. I don't imagine any of the usages will change that string. If they do, trying to change a literal would be very bad. I would still prefer creating a local editable allocation initialized to this string value rather than passing in a literal as non-const.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Only add __attribute__((fallthrough)) for LLVM_C_FALLTHROUGH. Enable warnings explicitly. Add const instead of use const_cast.
// First OpCode token | ||
m_pCurrentToken = (CShaderToken*)&pBuffer[2]; | ||
m_pCurrentToken = const_cast<CShaderToken *>(&pBuffer[2]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why these three const_casts are necessary. Since we're assigning to constant pointers, why cast to non constant pointers before that assignment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:( Missed after mark m_pCurrentToken to const.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks!
Add -Wno-unused-parameter -Wno-unknown-pragams -Wno-switch which are enabled for clang in linux build.
Fix
-Wimplicit-fallthrough
-Wconstant-logical-operand (Thanks patch from Chris)
-Wunused-function
-Wunused-variable
-Wtrigraphs
-Wnonportable-include-path
Still more warnings to be fixed.