From 07fb7a871697e38d27c4a325c11d0036bb005c3d Mon Sep 17 00:00:00 2001 From: Sinan Kaya Date: Sat, 16 Feb 2019 20:16:53 +0000 Subject: [PATCH 1/4] Suppress compiler warnings remove no attribute Commit migrated from https://github.com/dotnet/coreclr/commit/30c6f1cf8280f49ec38369793b1fc07bb239a6dc --- src/coreclr/configurecompiler.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreclr/configurecompiler.cmake b/src/coreclr/configurecompiler.cmake index 39c2e7e410bd1..c893e442823d5 100644 --- a/src/coreclr/configurecompiler.cmake +++ b/src/coreclr/configurecompiler.cmake @@ -485,6 +485,7 @@ if (CLR_CMAKE_PLATFORM_UNIX) add_compile_options(-Wno-unused-variable) add_compile_options(-Wno-unused-but-set-variable) add_compile_options(-fms-extensions) + add_compile_options(-Wno-unknown-pragmas) endif() # Some architectures (e.g., ARM) assume char type is unsigned while CoreCLR assumes char is signed From faaa8b801486b8974fcc91dea1b6411c5e27f918 Mon Sep 17 00:00:00 2001 From: Sinan Kaya Date: Sun, 17 Mar 2019 20:24:40 +0000 Subject: [PATCH 2/4] Fix conversion issues Commit migrated from https://github.com/dotnet/coreclr/commit/07f9f2f101754c38570ed75ce9a7083090769a0f --- src/coreclr/src/debug/daccess/daccess.cpp | 4 ++-- src/coreclr/src/debug/ee/debugger.cpp | 2 +- src/coreclr/src/gc/unix/gcenv.unix.cpp | 2 +- src/coreclr/src/pal/src/numa/numa.cpp | 2 +- src/coreclr/src/vm/gchandleutilities.cpp | 2 +- src/coreclr/src/vm/gchandleutilities.h | 2 +- src/coreclr/src/zap/zapimport.cpp | 8 ++++---- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/coreclr/src/debug/daccess/daccess.cpp b/src/coreclr/src/debug/daccess/daccess.cpp index a5e1387caf074..237a9b67daefb 100644 --- a/src/coreclr/src/debug/daccess/daccess.cpp +++ b/src/coreclr/src/debug/daccess/daccess.cpp @@ -7554,8 +7554,8 @@ BOOL OutOfProcessExceptionEventGetProcessIdAndThreadId(HANDLE hProcess, HANDLE h #ifdef FEATURE_PAL // UNIXTODO: mikem 1/13/15 Need appropriate PAL functions for getting ids - *pPId = (DWORD)hProcess; - *pThreadId = (DWORD)hThread; + *pPId = (DWORD)(SIZE_T)hProcess; + *pThreadId = (DWORD)(SIZE_T)hThread; #else #if !defined(FEATURE_CORESYSTEM) HMODULE hKernel32 = WszGetModuleHandle(W("kernel32.dll")); diff --git a/src/coreclr/src/debug/ee/debugger.cpp b/src/coreclr/src/debug/ee/debugger.cpp index d1eabb2d0096b..cb083c32145fd 100644 --- a/src/coreclr/src/debug/ee/debugger.cpp +++ b/src/coreclr/src/debug/ee/debugger.cpp @@ -11100,7 +11100,7 @@ bool Debugger::HandleIPCEvent(DebuggerIPCEvent * pEvent) { // Get the appdomain IGCHandleManager *mgr = GCHandleUtilities::GetGCHandleManager(); - ADIndex appDomainIndex = ADIndex(reinterpret_cast(mgr->GetHandleContext(objectHandle))); + ADIndex appDomainIndex = ADIndex((DWORD)(SIZE_T)(mgr->GetHandleContext(objectHandle))); pAppDomain = SystemDomain::GetAppDomainAtIndex(appDomainIndex); _ASSERTE(pAppDomain != NULL); diff --git a/src/coreclr/src/gc/unix/gcenv.unix.cpp b/src/coreclr/src/gc/unix/gcenv.unix.cpp index ed09e89f26413..572fc3b12f6d1 100644 --- a/src/coreclr/src/gc/unix/gcenv.unix.cpp +++ b/src/coreclr/src/gc/unix/gcenv.unix.cpp @@ -449,7 +449,7 @@ the processors enabled. --*/ static uintptr_t GetFullAffinityMask(int cpuCount) { - if (cpuCount < sizeof(uintptr_t) * 8) + if ((size_t)cpuCount < sizeof(uintptr_t) * 8) { return ((uintptr_t)1 << cpuCount) - 1; } diff --git a/src/coreclr/src/pal/src/numa/numa.cpp b/src/coreclr/src/pal/src/numa/numa.cpp index 8793a09b85002..9283a044da540 100644 --- a/src/coreclr/src/pal/src/numa/numa.cpp +++ b/src/coreclr/src/pal/src/numa/numa.cpp @@ -166,7 +166,7 @@ the processors enabled. --*/ KAFFINITY GetFullAffinityMask(int cpuCount) { - if (cpuCount < sizeof(KAFFINITY) * 8) + if ((size_t)cpuCount < sizeof(KAFFINITY) * 8) { return ((KAFFINITY)1 << (cpuCount)) - 1; } diff --git a/src/coreclr/src/vm/gchandleutilities.cpp b/src/coreclr/src/vm/gchandleutilities.cpp index 220445a1cc31d..a4fdec3c3fc69 100644 --- a/src/coreclr/src/vm/gchandleutilities.cpp +++ b/src/coreclr/src/vm/gchandleutilities.cpp @@ -33,7 +33,7 @@ void ValidateHandleAssignment(OBJECTHANDLE handle, OBJECTREF objRef) #endif IGCHandleManager *mgr = GCHandleUtilities::GetGCHandleManager(); - ADIndex appDomainIndex = ADIndex(reinterpret_cast(mgr->GetHandleContext(handle))); + ADIndex appDomainIndex = ADIndex((DWORD)((SIZE_T)mgr->GetHandleContext(handle))); ValidateObjectAndAppDomain(objRef, appDomainIndex); #endif // _DEBUG_IMPL diff --git a/src/coreclr/src/vm/gchandleutilities.h b/src/coreclr/src/vm/gchandleutilities.h index 86227cdd6a0c2..8c267372845c2 100644 --- a/src/coreclr/src/vm/gchandleutilities.h +++ b/src/coreclr/src/vm/gchandleutilities.h @@ -42,7 +42,7 @@ inline OBJECTREF ObjectFromHandle(OBJECTHANDLE handle) #if defined(_DEBUG_IMPL) && !defined(DACCESS_COMPILE) // not allowed to dispatch virtually on a IGCHandleManager when compiling for DAC - DWORD context = (DWORD)GCHandleUtilities::GetGCHandleManager()->GetHandleContext(handle); + DWORD context = (DWORD)(SIZE_T)GCHandleUtilities::GetGCHandleManager()->GetHandleContext(handle); OBJECTREF objRef = ObjectToOBJECTREF(*(Object**)handle); ValidateObjectAndAppDomain(objRef, ADIndex(context)); diff --git a/src/coreclr/src/zap/zapimport.cpp b/src/coreclr/src/zap/zapimport.cpp index d84ea79e8a4ea..9bdc1d94995bd 100644 --- a/src/coreclr/src/zap/zapimport.cpp +++ b/src/coreclr/src/zap/zapimport.cpp @@ -1831,7 +1831,7 @@ ZapImport * ZapImportTable::GetDictionaryLookupCell(CORCOMPILE_FIXUP_BLOB_KIND k ThrowHR(E_NOTIMPL); } - _ASSERTE(((DWORD)pResolvedToken->tokenContext & 1) == 0); + _ASSERTE(((DWORD)(SIZE_T)pResolvedToken->tokenContext & 1) == 0); return GetImportForSignature((void*)pResolvedToken->tokenContext, &sigBuilder); } @@ -1894,12 +1894,12 @@ class ZapIndirectHelperThunk : public ZapImport ReadyToRunHelper GetReadyToRunHelper() { - return (ReadyToRunHelper)((DWORD)GetHandle() & ~READYTORUN_HELPER_FLAG_VSD); + return (ReadyToRunHelper)((DWORD)(SIZE_T)GetHandle() & ~READYTORUN_HELPER_FLAG_VSD); } DWORD GetSectionIndex() { - return (DWORD)GetHandle2(); + return (DWORD)(SIZE_T)GetHandle2(); } BOOL IsDelayLoadHelper() @@ -1919,7 +1919,7 @@ class ZapIndirectHelperThunk : public ZapImport BOOL IsVSD() { - return ((DWORD)GetHandle() & READYTORUN_HELPER_FLAG_VSD) != 0; + return ((DWORD)(SIZE_T)GetHandle() & READYTORUN_HELPER_FLAG_VSD) != 0; } BOOL IsLazyHelper() From 9084e60d832abc49b7989dab17569ee20660d977 Mon Sep 17 00:00:00 2001 From: Sinan Kaya Date: Sun, 17 Mar 2019 20:36:22 +0000 Subject: [PATCH 3/4] Const has static linkage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bin/obj/Linux.x64.Debug/src/dlls/mscorrc/full/mscorrc_debug.cpp:1002:110: error: ‘visibility’ attribute ignored [-Werror=attributes] const NativeStringResourceTable nativeStringResourceTable_mscorrc_debug __attribute__((visibility("default"))) = { Commit migrated from https://github.com/dotnet/coreclr/commit/45d5b3a7c3b426965defd7b264d24ef00e955751 --- src/coreclr/src/nativeresources/rctocpp.awk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/src/nativeresources/rctocpp.awk b/src/coreclr/src/nativeresources/rctocpp.awk index 6f8d597cf4a48..cef49ce4a559c 100644 --- a/src/coreclr/src/nativeresources/rctocpp.awk +++ b/src/coreclr/src/nativeresources/rctocpp.awk @@ -62,7 +62,7 @@ function writeheader(arrayName, tableName) print "// This code was generated by rctocpp.awk and is not meant to be modified manually." print "#include "; print ""; - print "extern const NativeStringResourceTable " tableName ";"; + print "extern NativeStringResourceTable " tableName ";"; print "const NativeStringResource " arrayName "[] = {"; } @@ -78,7 +78,7 @@ function writefooter(arrayName, tableName) print "};"; print ""; - print "const NativeStringResourceTable " tableName " __attribute__((visibility(\"default\"))) = {"; + print "NativeStringResourceTable " tableName " __attribute__((visibility(\"default\"))) = {"; print numEntries ","; print arrayName "};"; } From f60647d8dd04247903f1b0b88739b0bd48d706e3 Mon Sep 17 00:00:00 2001 From: Sinan Kaya Date: Sun, 17 Mar 2019 20:39:59 +0000 Subject: [PATCH 4/4] Correct ignored align attribute MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit src/vm/threadpoolrequest.h:166:48: error: attribute ignored in declaration of ‘struct ManagedPerAppDomainTPCount::’ [-Werror=attributes] DECLSPEC_ALIGN(MAX_CACHE_LINE_SIZE) struct { ^ Commit migrated from https://github.com/dotnet/coreclr/commit/5d3eeaa1a16dc9bcb3279e6503cc3489d644a82f --- src/coreclr/src/vm/threadpoolrequest.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/src/vm/threadpoolrequest.h b/src/coreclr/src/vm/threadpoolrequest.h index 17df7a790f901..0eb037523eb78 100644 --- a/src/coreclr/src/vm/threadpoolrequest.h +++ b/src/coreclr/src/vm/threadpoolrequest.h @@ -163,7 +163,7 @@ class ManagedPerAppDomainTPCount : public IPerAppDomainTPCount { private: ADID m_id; TPIndex m_index; - DECLSPEC_ALIGN(MAX_CACHE_LINE_SIZE) struct { + struct DECLSPEC_ALIGN(MAX_CACHE_LINE_SIZE) { BYTE m_padding1[MAX_CACHE_LINE_SIZE - sizeof(LONG)]; // Only use with VolatileLoad+VolatileStore+FastInterlockCompareExchange LONG m_numRequestsPending; @@ -256,7 +256,7 @@ class UnManagedPerAppDomainTPCount : public IPerAppDomainTPCount { private: SpinLock m_lock; ULONG m_NumRequests; - DECLSPEC_ALIGN(MAX_CACHE_LINE_SIZE) struct { + struct DECLSPEC_ALIGN(MAX_CACHE_LINE_SIZE) { BYTE m_padding1[MAX_CACHE_LINE_SIZE - sizeof(LONG)]; // Only use with VolatileLoad+VolatileStore+FastInterlockCompareExchange LONG m_outstandingThreadRequestCount;