clean up list of disabled warnings.#18318
Conversation
For example C4171 was deleted after VS 6.0 (https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-6.0/aa233011(v=vs.60))
because its default value is 4, so this line is useless.
and fix places that trigger it.
f3cac22 to
85b1478
Compare
| _ASSERTE(((INT32)(UINT32)n) >= 0); | ||
| _ASSERTE((base > 0) && (base < BITS_PER_SIZE_T)); | ||
| size_t numEncodings = 1 << base; | ||
| size_t numEncodings = size_t{ 1 } << base; |
There was a problem hiding this comment.
The previous line checks that base is lower then BITS_PER_SIZE_T, on TARGET_64 it would be 64.
So then if 32 < base < 64 it would produce the wrong result in the old variant.
| DWORD j; | ||
|
|
||
| if (IS_ALIGNED(dwCumulativeInstanceFieldPos, 1<<(i+1))) | ||
| size_t alignment = size_t{ 1 } << i; |
There was a problem hiding this comment.
There is VS bug that keep showing this warning even when you have an explicit cast to size_t:
size_t alignment = static_cast<size_t>(1 << I); , the issue was reported.
but there is not harm to declare 1 as size_t.
|
As usual please review per commit. |
3f2dcfa to
257cc07
Compare
|
This simple PR affects non only jit, so I am not sure who can review it. |
|
What does |
| if (loByte == 0xFF) | ||
| { | ||
| imm8 |= (1 << pos); | ||
| imm8 |= (size_t{1} << pos); |
There was a problem hiding this comment.
The cast here is not necessary, the pos is guaranteed to be less than 8. Doesn't hurt to have it here though. Maybe use ssize_t here to match the target variable type?
There was a problem hiding this comment.
Yes, you are right, I have missed the diff between ssize_t and size_t.
| for (unsigned b = 0; b < 8; b++) | ||
| { | ||
| if (imm & (1 << b)) | ||
| if (imm & (size_t{1} << b)) |
There was a problem hiding this comment.
The case is not necessary, the loop goes from 0 to 7.
There was a problem hiding this comment.
You are right, but because imm has type of ssize_t there is implicit conversion from int to ssize_t here. It generates warning C4334 ('operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?), https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4334), that was disabled before.
The right thing to do here is to right:
if (imm & static_cast<ssize_t>(1 << b)) , but it also generates warnings, I think it is VC++ compiler issue and I have reported it.
| { | ||
| printf("*"); | ||
| emitDispImm(1 << imm, false); | ||
| emitDispImm(size_t{1} << imm, false); |
There was a problem hiding this comment.
The cast is not necessary here, the function asserts at the beginning:
assert((imm >= 0) && (imm <= 4));.
Moreover, the emitDispImm parameter type is int.
| DWORD j; | ||
|
|
||
| if (IS_ALIGNED(dwCumulativeInstanceFieldPos, 1<<(i+1))) | ||
| if (IS_ALIGNED(dwCumulativeInstanceFieldPos, size_t{ 1 } << (i + 1))) |
There was a problem hiding this comment.
The cast is not necessary here, the I goes from 0 to MAX_LOG2_PRIMITIVE_FIELD_SIZE which is 3
|
|
||
| // Place the field | ||
| dwCumulativeInstanceFieldPos = (DWORD)ALIGN_UP(dwCumulativeInstanceFieldPos, 1 << i); | ||
| dwCumulativeInstanceFieldPos = (DWORD)ALIGN_UP(dwCumulativeInstanceFieldPos, size_t{ 1 } << i); |
There was a problem hiding this comment.
The cast is not necessary here, the I goes from 0 to MAX_LOG2_PRIMITIVE_FIELD_SIZE which is 3
There was a problem hiding this comment.
VS team agreed that static_cast<size_t>(1 << I) should not produce the warning, but I think the fix will get some time, so it is better to go with the current solution.
|
|
Any additional comments for this PR? |
* delete warnings that do not longer exist For example C4171 was deleted after VS 6.0 (https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-6.0/aa233011(v=vs.60)) * delete C4206 fromm the list because its default value is 4, so this line is useless. * reenable warning as error. * enable warning C4430 and fix places that trigger it. * fix C4334 * format the list * fix ssize_t Commit migrated from dotnet/coreclr@1c8c96e
contributes to #18128