From de8b85b643ac08d69696ad078846424b69ae651f Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Fri, 27 Mar 2015 23:30:10 +0100 Subject: Fix next round of warning types This change fixes the following warnings: 1) Assignment in a condition should be wrapped in () 2) Priority of && / || should be indicated by parentheses. 3) Unknown #pragma optimize ifdefed out for non MSVC 4) Unused functions deleted or put under #ifdef 5) Extra tokens warning disabling moved to the CMakeLists.txt in the src/inc 6) Self assignment of a member or local variable 7) Assigning ~0 to a bitfield member that was just 8 bit wide It also fixes a bug in the STRESS_LOGxx macro invocation in exceptionhandling.cpp and stackwalk.cpp related to recent adding the DBG_ADDR macro usage. This macro expanded a single parameter into two expressions to extract high / low 32 bits separately. But the STRESS_LOGxx parameters are passed to the StressLog::LogMsg method as follows: (void*)(size_t)(data1) That means that the expanded pair x, y would be inserted as data 1 and that leads to ignoring the x due to the comma operator. --- src/classlibnative/bcltype/decimal.cpp | 24 ++++++++++++------------ src/classlibnative/bcltype/number.cpp | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/classlibnative') diff --git a/src/classlibnative/bcltype/decimal.cpp b/src/classlibnative/bcltype/decimal.cpp index c3fbc31251..ac1ffa59e1 100644 --- a/src/classlibnative/bcltype/decimal.cpp +++ b/src/classlibnative/bcltype/decimal.cpp @@ -335,10 +335,10 @@ int COMDecimal::NumberToDecimal(NUMBER* number, DECIMAL* value) } } else { if (e > DECIMAL_PRECISION) return 0; - while ((e > 0 || *p && e > -28) && - (DECIMAL_HI32(d) < 0x19999999 || DECIMAL_HI32(d) == 0x19999999 && - (DECIMAL_MID32(d) < 0x99999999 || DECIMAL_MID32(d) == 0x99999999 && - (DECIMAL_LO32(d) < 0x99999999 || DECIMAL_LO32(d) == 0x99999999 && *p <= '5')))) { + while ((e > 0 || (*p && e > -28)) && + (DECIMAL_HI32(d) < 0x19999999 || (DECIMAL_HI32(d) == 0x19999999 && + (DECIMAL_MID32(d) < 0x99999999 || (DECIMAL_MID32(d) == 0x99999999 && + (DECIMAL_LO32(d) < 0x99999999 || (DECIMAL_LO32(d) == 0x99999999 && *p <= '5'))))))) { DecMul10(&d); if (*p) DecAddInt32(&d, *p++ - '0'); e--; @@ -1306,10 +1306,10 @@ HaveScale64: rgulRem[1] = (rgulRem[1] << 1) + ulTmp; rgulRem[2] = (rgulRem[2] << 1) + ulTmp1; - if (rgulRem[2] > rgulDivisor[2] || rgulRem[2] == rgulDivisor[2] && - (rgulRem[1] > rgulDivisor[1] || rgulRem[1] == rgulDivisor[1] && - (rgulRem[0] > rgulDivisor[0] || rgulRem[0] == rgulDivisor[0] && - (rgulQuo[0] & 1)))) + if (rgulRem[2] > rgulDivisor[2] || (rgulRem[2] == rgulDivisor[2] && + (rgulRem[1] > rgulDivisor[1] || (rgulRem[1] == rgulDivisor[1] && + (rgulRem[0] > rgulDivisor[0] || (rgulRem[0] == rgulDivisor[0] && + (rgulQuo[0] & 1))))))) goto RoundUp; break; } @@ -1707,10 +1707,10 @@ HaveScale64: rgulRem[1] = (rgulRem[1] << 1) + ulTmp; rgulRem[2] = (rgulRem[2] << 1) + ulTmp1; - if (rgulRem[2] > rgulDivisor[2] || rgulRem[2] == rgulDivisor[2] && - (rgulRem[1] > rgulDivisor[1] || rgulRem[1] == rgulDivisor[1] && - (rgulRem[0] > rgulDivisor[0] || rgulRem[0] == rgulDivisor[0] && - (rgulQuo[0] & 1)))) + if (rgulRem[2] > rgulDivisor[2] || (rgulRem[2] == rgulDivisor[2] && + (rgulRem[1] > rgulDivisor[1] || (rgulRem[1] == rgulDivisor[1] && + (rgulRem[0] > rgulDivisor[0] || (rgulRem[0] == rgulDivisor[0] && + (rgulQuo[0] & 1))))))) goto RoundUp; break; } diff --git a/src/classlibnative/bcltype/number.cpp b/src/classlibnative/bcltype/number.cpp index 89bb49372e..04fe9f6526 100644 --- a/src/classlibnative/bcltype/number.cpp +++ b/src/classlibnative/bcltype/number.cpp @@ -1046,7 +1046,7 @@ wchar ParseFormatSpecifier(STRINGREF str, int* digits) _ASSERTE(p != NULL); wchar ch = *p; if (ch != 0) { - if (ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z') { + if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) { p++; int n = -1; if (*p >= '0' && *p <= '9') { -- cgit v1.2.3