summaryrefslogtreecommitdiff
path: root/src/utilcode
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2015-03-26 08:19:22 +0100
committerJan Vorlicek <janvorli@microsoft.com>2015-03-26 09:03:20 +0100
commit1e787356393276f38f4600232722076d2d9311e2 (patch)
tree35e1a5c85a1c375e681c9b0c45013317ce6e25a6 /src/utilcode
parentab0fb914d6efde5c0b59e7edbbfd04016232c96b (diff)
downloadcoreclr-1e787356393276f38f4600232722076d2d9311e2.tar.gz
coreclr-1e787356393276f38f4600232722076d2d9311e2.tar.bz2
coreclr-1e787356393276f38f4600232722076d2d9311e2.zip
Fix about 12 kinds of warnings over the codebase
This change fixes: 1) Member initiazalization order in class constructor didn't correspond to the member order in some classes 2) Objects with vtables were copied via memcpy. While this is intentional, cast of the pointers to void* is required to silence clang warning 3) Switch case statements containing values of different enums 4) Casting int to pointer 5) Missing return value in methods with _ASSERTE 6) Class name classifier on methods in the .h 7) Invalid position of the DECLSPEC_ALIGN at few places - it had no effect 8) Invalid position of the 'used' attribute 9) Issue with comparing holders to NULL 10) Operator 'new' returning NULL without being marked with throw() or noexcept 11) Variables marked as 'extern' at the declaration / initialization place 12) Data structure declared as struct at one place and forward declared as class at another Some disabled warnings were no longer happening, so options to disable them were removed too
Diffstat (limited to 'src/utilcode')
-rw-r--r--src/utilcode/clrhost_nodependencies.cpp2
-rw-r--r--src/utilcode/ex.cpp2
-rw-r--r--src/utilcode/makepath.cpp6
-rw-r--r--src/utilcode/sigparser.cpp2
-rw-r--r--src/utilcode/splitpath.cpp4
-rw-r--r--src/utilcode/util_nodependencies.cpp6
6 files changed, 11 insertions, 11 deletions
diff --git a/src/utilcode/clrhost_nodependencies.cpp b/src/utilcode/clrhost_nodependencies.cpp
index f5e4133cee..4a85e684b9 100644
--- a/src/utilcode/clrhost_nodependencies.cpp
+++ b/src/utilcode/clrhost_nodependencies.cpp
@@ -647,7 +647,7 @@ IExecutionEngine *GetExecutionEngine()
// Create a local copy on the stack and then copy it over to the static instance.
// This avoids race conditions caused by multiple initializations of vtable in the constructor
UtilExecutionEngine local;
- memcpy(&g_ExecutionEngineInstance, &local, sizeof(UtilExecutionEngine));
+ memcpy((void*)&g_ExecutionEngineInstance, (void*)&local, sizeof(UtilExecutionEngine));
pExecutionEngine = (IExecutionEngine*)(UtilExecutionEngine*)&g_ExecutionEngineInstance;
#else
// statically linked.
diff --git a/src/utilcode/ex.cpp b/src/utilcode/ex.cpp
index af2b4edcb2..032971fb86 100644
--- a/src/utilcode/ex.cpp
+++ b/src/utilcode/ex.cpp
@@ -47,7 +47,7 @@ Exception * Exception::GetOOMException()
// This avoids race conditions caused by multiple initializations of vtable in the constructor
OutOfMemoryException local(TRUE); // Construct a "preallocated" instance.
- memcpy(&g_OOMExceptionInstance, &local, sizeof(OutOfMemoryException));
+ memcpy((void*)&g_OOMExceptionInstance, (void*)&local, sizeof(OutOfMemoryException));
g_OOMException = (OutOfMemoryException*)&g_OOMExceptionInstance;
}
diff --git a/src/utilcode/makepath.cpp b/src/utilcode/makepath.cpp
index 402280bd89..0443b991aa 100644
--- a/src/utilcode/makepath.cpp
+++ b/src/utilcode/makepath.cpp
@@ -40,7 +40,7 @@
*******************************************************************************/
void MakePath (
- __out_ecount (MAX_PATH) register WCHAR *path,
+ __out_ecount (MAX_PATH) WCHAR *path,
__in LPCWSTR drive,
__in LPCWSTR dir,
__in LPCWSTR fname,
@@ -55,8 +55,8 @@ void MakePath (
}
CONTRACTL_END
- register const WCHAR *p;
- register DWORD count = 0;
+ const WCHAR *p;
+ DWORD count = 0;
/* we assume that the arguments are in the following form (although we
* do not diagnose invalid arguments or illegal filenames (such as
diff --git a/src/utilcode/sigparser.cpp b/src/utilcode/sigparser.cpp
index b7f683ca43..00cce7fb24 100644
--- a/src/utilcode/sigparser.cpp
+++ b/src/utilcode/sigparser.cpp
@@ -32,7 +32,7 @@ HRESULT SigParser::SkipExactlyOne()
if (!CorIsPrimitiveType(typ))
{
- switch (typ)
+ switch ((DWORD)typ)
{
default:
// _ASSERT(!"Illegal or unimplement type in COM+ sig.");
diff --git a/src/utilcode/splitpath.cpp b/src/utilcode/splitpath.cpp
index 1be90a828d..ee7d394c46 100644
--- a/src/utilcode/splitpath.cpp
+++ b/src/utilcode/splitpath.cpp
@@ -43,7 +43,7 @@
*******************************************************************************/
void SplitPath(
- register const WCHAR *path,
+ const WCHAR *path,
__inout_z __inout_ecount_opt(driveSizeInWords) WCHAR *drive, int driveSizeInWords,
__inout_z __inout_ecount_opt(dirSizeInWords) WCHAR *dir, int dirSizeInWords,
__inout_z __inout_ecount_opt(fnameSizeInWords) WCHAR *fname, size_t fnameSizeInWords,
@@ -91,7 +91,7 @@ void SplitPathInterior(
_ASSERTE(!!pwszFileName == !!pcchFileName);
_ASSERTE(!!pwszExt == !!pcchExt);
- register WCHAR *p;
+ WCHAR *p;
LPCWSTR last_slash = NULL, dot = NULL;
/* we assume that the path argument has the following form, where any
diff --git a/src/utilcode/util_nodependencies.cpp b/src/utilcode/util_nodependencies.cpp
index f2bb90918c..f29e1df50d 100644
--- a/src/utilcode/util_nodependencies.cpp
+++ b/src/utilcode/util_nodependencies.cpp
@@ -18,9 +18,9 @@
#if !defined(FEATURE_UTILCODE_NO_DEPENDENCIES) || defined(_DEBUG)
-extern RunningOnStatusEnum gRunningOnStatus = RUNNING_ON_STATUS_UNINITED;
-extern BOOL gExInfoAvailable = FALSE;
-extern BOOL gExInfoIsServer = TRUE;
+RunningOnStatusEnum gRunningOnStatus = RUNNING_ON_STATUS_UNINITED;
+BOOL gExInfoAvailable = FALSE;
+BOOL gExInfoIsServer = TRUE;
#define NON_SUPPORTED_PLATFORM_MSGBOX_TITLE W("Platform not supported")
#define NON_SUPPORTED_PLATFORM_MSGBOX_TEXT W("The minimum supported platform is Windows 2000")