Repository navigation
Clang warnings cleanup - #755
Stephan T. Lavavej (StephanTLavavej) merged 28 commits into
Conversation
Clang-cl suppresses all warning generated in files which are present in the INCLUDE environment variable. This is undesirable to us in general, but especially when builing the test binaries.
One of our tests instantiates a _Static_partition_team with the type of _Count as a short. We store the result of a short-short division and a short-short mod operation into a short which results in a narrowing warning from int to short. This is due to short to int promotion for arithmetic binary operations.
We shouldn't be trying to find a signed value in an array of unsigned values. I chose to change the search value to an unsinged literal but casting would have worked too.
Clang complains about unused side-effects when using _STL_VERIFY.
When doing memchr optimizations in find we fallback to the standard find algorithm when the values are eligible for memchr optimization but we are constant evaluated. This can result in emitting sign-mismatch warnings which are pointless since we already do bounds checking of the search element. Just cast the search element to the type of the container's values.
We were incorrectly detecting whether or not the second byte in a 2-byte sjis glyph was valid. Also update the test to cover the full range of valid sjis 0208 characters.
We do this to avoid overriding /Od with /O2.
Currently std::terminate under _HAS_EXCEPTIONS=0 does not actually terminate the program and is therefore not noreturn. Just call _CSTD abort() directly in this case. Make _Raise [[noreturn]]
|
|
||
| inline void __CRTDECL terminate() noexcept { // handle exception termination | ||
| [[noreturn]] inline void __CRTDECL terminate() noexcept { // handle exception termination | ||
| _CSTD abort(); |
There was a problem hiding this comment.
I suspect we should just unconditionally using ::terminate; instead of defining this, but I'll allow that investigating this machinery is out of scope for the change in this PR. Stephan T. Lavavej (@StephanTLavavej) mentioned this stuff is in his super-secret TODO list - should we have an issue?
There was a problem hiding this comment.
I noticed this a while ago and thought I had recorded a TODO, but didn't. (I'm migrating the TODO list to enhancement issues - 5 pages to go!) I agree that we should file an issue for this.
Co-Authored-By: Casey Carter
| Mysconvert myconv(""); | ||
|
|
||
| // All ASCII and modified ASCII characters single byte characters | ||
| for (unsigned long ch = 0; ch <= 0x7f; ++ch) { |
There was a problem hiding this comment.
Hm, I guess this introduces a ton of unnecessary nul characters to be tested but still works.
|
Thanks for fixing all of these warnings, and the cvt bugfix, and especially enhancing our test coverage so we remain clean in the future! I had dreamed of this but didn't know how to achieve it in the old infrastructure (as |
I noticed that our code emits a fair number of warnings with
clang-clwhen building the tests. Previously we were not seeing these warnings because of the wayclangtreats "system headers".This change causes
clang-clto emit warnings on our headers and fixes up the existing warnings.I also resolved Microsoft-internal VSO-609129 " appears to have impossible condition" which was being warned about by clang.