Skip to content

Commit

Permalink
Merge pull request dotnet/coreclr#23307 from franksinankaya/gcc_clean…
Browse files Browse the repository at this point in the history
…up_13

Fix conversion, unknown pragmas and Visibility Issues for GCC

Commit migrated from dotnet/coreclr@d9781f1
  • Loading branch information
janvorli authored Mar 18, 2019
2 parents f6cbe70 + f60647d commit f05963e
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/coreclr/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/src/debug/daccess/daccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/debug/ee/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11100,7 +11100,7 @@ bool Debugger::HandleIPCEvent(DebuggerIPCEvent * pEvent)
{
// Get the appdomain
IGCHandleManager *mgr = GCHandleUtilities::GetGCHandleManager();
ADIndex appDomainIndex = ADIndex(reinterpret_cast<DWORD>(mgr->GetHandleContext(objectHandle)));
ADIndex appDomainIndex = ADIndex((DWORD)(SIZE_T)(mgr->GetHandleContext(objectHandle)));
pAppDomain = SystemDomain::GetAppDomainAtIndex(appDomainIndex);

_ASSERTE(pAppDomain != NULL);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/gc/unix/gcenv.unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/src/nativeresources/rctocpp.awk
Original file line number Diff line number Diff line change
Expand Up @@ -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 <resourcestring.h>";
print "";
print "extern const NativeStringResourceTable " tableName ";";
print "extern NativeStringResourceTable " tableName ";";
print "const NativeStringResource " arrayName "[] = {";
}

Expand All @@ -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 "};";
}
2 changes: 1 addition & 1 deletion src/coreclr/src/pal/src/numa/numa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/vm/gchandleutilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void ValidateHandleAssignment(OBJECTHANDLE handle, OBJECTREF objRef)
#endif

IGCHandleManager *mgr = GCHandleUtilities::GetGCHandleManager();
ADIndex appDomainIndex = ADIndex(reinterpret_cast<DWORD>(mgr->GetHandleContext(handle)));
ADIndex appDomainIndex = ADIndex((DWORD)((SIZE_T)mgr->GetHandleContext(handle)));

ValidateObjectAndAppDomain(objRef, appDomainIndex);
#endif // _DEBUG_IMPL
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/vm/gchandleutilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/src/vm/threadpoolrequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/src/zap/zapimport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ZapDynamicHelperCell, ZapNodeType_DynamicHelperCell>((void*)pResolvedToken->tokenContext, &sigBuilder);
}
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand Down

0 comments on commit f05963e

Please sign in to comment.