summaryrefslogtreecommitdiff
path: root/src/utilcode
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2015-03-27 23:30:10 +0100
committerJan Vorlicek <janvorli@microsoft.com>2015-04-01 21:39:28 +0200
commitde8b85b643ac08d69696ad078846424b69ae651f (patch)
tree3c8f416945ebb2768eeb1f26a5d09b5f4dcb2202 /src/utilcode
parent898cdcf05ae334252b354a1f5bae9e26be1912ec (diff)
downloadcoreclr-de8b85b643ac08d69696ad078846424b69ae651f.tar.gz
coreclr-de8b85b643ac08d69696ad078846424b69ae651f.tar.bz2
coreclr-de8b85b643ac08d69696ad078846424b69ae651f.zip
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.
Diffstat (limited to 'src/utilcode')
-rw-r--r--src/utilcode/corimage.cpp8
-rw-r--r--src/utilcode/ex.cpp10
-rw-r--r--src/utilcode/rangetree.cpp4
-rw-r--r--src/utilcode/util.cpp2
4 files changed, 14 insertions, 10 deletions
diff --git a/src/utilcode/corimage.cpp b/src/utilcode/corimage.cpp
index b6fd60d785..3763e541e4 100644
--- a/src/utilcode/corimage.cpp
+++ b/src/utilcode/corimage.cpp
@@ -82,8 +82,8 @@ Cor_RtlImageRvaToSection32(PTR_IMAGE_NT_HEADERS32 NtHeaders,
NtSection = PTR_IMAGE_FIRST_SECTION( NtHeaders );
for (i=0; i<NtHeaders->FileHeader.NumberOfSections; i++) {
if (FileLength &&
- ((VAL32(NtSection->PointerToRawData) > FileLength)) ||
- (VAL32(NtSection->SizeOfRawData) > FileLength - VAL32(NtSection->PointerToRawData)))
+ (((VAL32(NtSection->PointerToRawData) > FileLength)) ||
+ (VAL32(NtSection->SizeOfRawData) > FileLength - VAL32(NtSection->PointerToRawData))))
return NULL;
if (Rva >= VAL32(NtSection->VirtualAddress) &&
Rva < VAL32(NtSection->VirtualAddress) + VAL32(NtSection->SizeOfRawData))
@@ -107,8 +107,8 @@ Cor_RtlImageRvaToSection64(PTR_IMAGE_NT_HEADERS64 NtHeaders,
NtSection = PTR_IMAGE_FIRST_SECTION( NtHeaders );
for (i=0; i<VAL16(NtHeaders->FileHeader.NumberOfSections); i++) {
if (FileLength &&
- ((VAL32(NtSection->PointerToRawData) > FileLength)) ||
- (VAL32(NtSection->SizeOfRawData) > FileLength - VAL32(NtSection->PointerToRawData)))
+ (((VAL32(NtSection->PointerToRawData) > FileLength)) ||
+ (VAL32(NtSection->SizeOfRawData) > FileLength - VAL32(NtSection->PointerToRawData))))
return NULL;
if (Rva >= VAL32(NtSection->VirtualAddress) &&
Rva < VAL32(NtSection->VirtualAddress) + VAL32(NtSection->SizeOfRawData))
diff --git a/src/utilcode/ex.cpp b/src/utilcode/ex.cpp
index 032971fb86..1fd997fd60 100644
--- a/src/utilcode/ex.cpp
+++ b/src/utilcode/ex.cpp
@@ -1815,16 +1815,20 @@ Exception *ExThrowWithInnerHelper(Exception *inner)
#ifdef _DEBUG
-#pragma warning(disable: 4748)
+#ifdef _MSC_VER
#pragma optimize("", off)
-#pragma warning(disable: 4748)
-
+#endif // _MSC_VER
void ExThrowTrap(const char *fcn, const char *file, int line, const char *szType, HRESULT hr, const char *args)
{
SUPPORTS_DAC;
return;
}
+
+#ifdef _MSC_VER
+#pragma optimize("", on)
+#endif // _MSC_VER
+
#endif
diff --git a/src/utilcode/rangetree.cpp b/src/utilcode/rangetree.cpp
index 028ebd9769..6d3f644471 100644
--- a/src/utilcode/rangetree.cpp
+++ b/src/utilcode/rangetree.cpp
@@ -357,8 +357,8 @@ BOOL RangeTree::OverlapsNode(Node *node, SIZE_T start, SIZE_T end, SIZE_T mask)
&& (end > node->start && start < node->end))
return TRUE;
- if (node->children[0] != NULL && OverlapsNode(node->children[0], start, end, mask)
- || node->children[1] != NULL && OverlapsNode(node->children[1], start, end, mask))
+ if ((node->children[0] != NULL && OverlapsNode(node->children[0], start, end, mask))
+ || (node->children[1] != NULL && OverlapsNode(node->children[1], start, end, mask)))
return TRUE;
return FALSE;
diff --git a/src/utilcode/util.cpp b/src/utilcode/util.cpp
index 205659831f..ee115c7aa5 100644
--- a/src/utilcode/util.cpp
+++ b/src/utilcode/util.cpp
@@ -1980,7 +1980,7 @@ HRESULT validateTokenSig(
if(i == IMAGE_CEE_CS_CALLCONV_FIELD) return validateOneArg(tk, &sig, NULL, pImport, TRUE);
// EXPLICITTHIS and native call convs are for stand-alone sigs only (for calli)
- if((i != IMAGE_CEE_CS_CALLCONV_DEFAULT)&&( i != IMAGE_CEE_CS_CALLCONV_VARARG)
+ if(((i != IMAGE_CEE_CS_CALLCONV_DEFAULT)&&( i != IMAGE_CEE_CS_CALLCONV_VARARG))
|| (ulCallConv & IMAGE_CEE_CS_CALLCONV_EXPLICITTHIS)) return VLDTR_E_MD_BADCALLINGCONV;
break;