add_compile_options(-ferror-limit=4096)
# Disabled warnings
-add_compile_options(-Wno-unknown-pragmas)
add_compile_options(-Wno-unused-private-field)
add_compile_options(-Wno-dangling-else)
add_compile_options(-Wno-implicit-exception-spec-mismatch)
-# Using the result of an assignment as a condition without parentheses
-add_compile_options(-Wno-parentheses)
+# A derived class defines a virtual method with the same name as its base
+# class, but different set of parameters.
add_compile_options(-Wno-overloaded-virtual)
add_compile_options(-Wno-unused-variable)
# Enum value is not handled in a switch (and there is no default clause)
# Remaining cases are in JIT only
add_compile_options(-Wno-switch)
+# Explicit constructor calls are not supported by clang (this->ClassName::ClassName())
add_compile_options(-Wno-microsoft)
# This warning is caused by comparing 'this' to NULL
add_compile_options(-Wno-tautological-compare)
+# There are constants of type BOOL used in a condition. But BOOL is defined as int
+# and so the compiler thinks that there is a mistake.
add_compile_options(-Wno-constant-logical-operand)
-add_compile_options(-Wno-unused-function)
-add_compile_options(-Wno-extra-tokens)
-add_compile_options(-Wno-self-assign)
-add_compile_options(-Wno-bitfield-constant-conversion)
-add_compile_options(-Wno-unused-value)
add_compile_options(-Wno-unknown-warning-option)
}
}
}
- else if (*ptr == 's' || *ptr == 'h' && *(ptr+1) == 's' && ++ptr)
+ else if (*ptr == 's' || (*ptr == 'h' && *(ptr+1) == 's' && ++ptr))
{
HRESULT hr;
args[iArgCount] = strBuf;
}
- else if (*ptr == 'S' || *ptr == 'l' && *(ptr+1) == 's' && ++ptr)
+ else if (*ptr == 'S' || (*ptr == 'l' && *(ptr+1) == 's' && ++ptr))
{
HRESULT hr;
inline
BOOL IsElementValueType (CorElementType cet)
{
- return cet >= ELEMENT_TYPE_BOOLEAN && cet <= ELEMENT_TYPE_R8
+ return (cet >= ELEMENT_TYPE_BOOLEAN && cet <= ELEMENT_TYPE_R8)
|| cet == ELEMENT_TYPE_VALUETYPE || cet == ELEMENT_TYPE_I || cet == ELEMENT_TYPE_U;
}
namespace BINDER_SPACE
{
- namespace
- {
- void CopyIntoBuffer(/* in */ SBuffer *pPropertyValue,
- /* in */ LPVOID pvValue,
- /* in */ DWORD cbValue)
- {
- _ASSERTE(pPropertyValue != NULL);
-
- BYTE *pRawBuffer = pPropertyValue->OpenRawBuffer(cbValue);
-
- memcpy(pRawBuffer, pvValue, cbValue);
- pPropertyValue->CloseRawBuffer();
- }
-
- const void *GetRawBuffer(SBuffer *pPropertyValue)
- {
- _ASSERTE(pPropertyValue != NULL);
-
- // SBuffer provides const void *() operator
- const void *pPropertyRawBuffer = *pPropertyValue;
-
- _ASSERTE(pPropertyRawBuffer != NULL);
- _ASSERTE(pPropertyRawBuffer != pPropertyValue);
-
- return pPropertyRawBuffer;
- }
-
- HRESULT CheckRequiredBufferSize(/* in */ SBuffer *pPropertyValue,
- /* in */ LPVOID pvValue,
- /* in, out */ LPDWORD pcbValue)
- {
- _ASSERTE(pPropertyValue != NULL);
-
- HRESULT hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- DWORD cbPropertySize = static_cast<DWORD>(pPropertyValue->GetSize());
-
- if (pcbValue == NULL)
- {
- hr = E_INVALIDARG;
- }
- else if ((cbPropertySize <= *pcbValue) && (pvValue != NULL))
- {
- *pcbValue = cbPropertySize;
- hr = S_OK;
- }
- else
- {
- *pcbValue = cbPropertySize;
- }
-
- return hr;
- }
-
- HRESULT CopyTextPropertyIntoBuffer(/* in */ SBuffer *pPropertyValue,
- /* out */ LPWSTR wzPropertyBuffer,
- /* in, out */ DWORD *pdwPropertyBufferSize)
- {
- HRESULT hr = S_OK;
- void *pvValue = static_cast<void *>(wzPropertyBuffer);
- DWORD cbValue = *pdwPropertyBufferSize * sizeof(WCHAR);
-
- if ((hr = CheckRequiredBufferSize(pPropertyValue, pvValue, &cbValue)) == S_OK)
- {
- memcpy(pvValue, GetRawBuffer(pPropertyValue), cbValue);
- }
-
- // Adjust byte size to character count
- _ASSERTE(cbValue % sizeof(WCHAR) == 0);
- *pdwPropertyBufferSize = cbValue / sizeof(WCHAR);
-
- return hr;
- }
-
- BOOL EndsWithPathSeparator(/* in */ PathString &path)
- {
- SString winDirSeparor(SString::Literal, W("\\"));
- SString unixDirSeparor(SString::Literal, W("/"));
-
- return (path.EndsWith(winDirSeparor) || path.EndsWith(unixDirSeparor));
- }
- };
-
STDMETHODIMP ApplicationContext::QueryInterface(REFIID riid,
void **ppv)
{
// we encounter a native image. Since we don't touch IL in the presence of
// native images, we replace the IL entry with the NI.
//
- if (pExistingEntry->m_wszILFileName != nullptr && !isNativeImage ||
- pExistingEntry->m_wszNIFileName != nullptr && isNativeImage)
+ if ((pExistingEntry->m_wszILFileName != nullptr && !isNativeImage) ||
+ (pExistingEntry->m_wszNIFileName != nullptr && isNativeImage))
{
BINDER_LOG_STRING(W("ApplicationContext::SetupBindingPaths: Skipping TPA entry because of already existing IL/NI entry for short name "), fileName.GetUnicode());
continue;
Exit:
return hr;
}
-
- // Host assembly "equivalence" relation
- HRESULT IsValidHostAssembly(AssemblyName *pProposedAssemblyName,
- AssemblyName *pRequestedAssemblyName,
- VersionMatchMode versionMatchMode,
- BOOL fRequireHigherSV,
- BOOL *pFIsValidHostAssembly)
- {
- HRESULT hr = S_OK;
-
- AssemblyVersion *pProposedVersion = pProposedAssemblyName->GetVersion();
- AssemblyVersion *pRequestedVersion = pRequestedAssemblyName->GetVersion();
-
- if (pProposedVersion->IsEqualFeatureVersion(pRequestedVersion))
- {
- if (fRequireHigherSV)
- {
- *pFIsValidHostAssembly =
- pProposedVersion->IsLargerServiceVersion(pRequestedVersion);
- }
- else if (versionMatchMode == kVersionExact)
- {
- *pFIsValidHostAssembly =
- pProposedVersion->IsEqualServiceVersion(pRequestedVersion);
- }
- else
- {
- *pFIsValidHostAssembly =
- (pProposedVersion->IsLargerServiceVersion(pRequestedVersion) ||
- pProposedVersion->IsEqualServiceVersion(pRequestedVersion));
- }
- }
- else if ((versionMatchMode == kVersionFeatureRollForward) &&
- (pProposedVersion->IsLargerFeatureVersion(pRequestedVersion)))
- {
- *pFIsValidHostAssembly = TRUE;
- }
- else
- {
- *pFIsValidHostAssembly = FALSE;
- }
-
- return hr;
- }
-
- inline DWORD BindingStoreEnumToDWORD(INT32 kBindingStore)
- {
- switch (kBindingStore)
- {
- case 0:
- return kBindingStoreGAC;
- case 1:
- return kBindingStoreManifest;
- case 2:
- return kBindingStoreHost;
- default:
- _ASSERTE(0);
- return 0;
- }
- }
};
/* static */
#ifdef FEATURE_VERSIONING_LOG
hr = LogBindResult(pApplicationContext, hr, &bindResult);
#else // FEATURE_VERSIONING_LOG
- // Shut up GCC
- hr = hr;
+ ;
#endif // FEATURE_VERSIONING_LOG
#ifndef CROSSGEN_COMPILE
return NULL;
}
- BOOL ValidateAndConvertContentType(
- SString & ssContentType,
- AssemblyContentType * pkContentType)
- {
- if (EqualsCaseInsensitive(ssContentType, W("WindowsRuntime")))
- {
- *pkContentType = AssemblyContentType_WindowsRuntime;
- return TRUE;
- }
-
- return FALSE;
- }
-
LPCWSTR ContentTypeToString(AssemblyContentType kContentType)
{
_ASSERTE(kContentType != AssemblyContentType_Default);
namespace BINDER_SPACE
{
+#ifdef FEATURE_VERSIONING_LOG
namespace
{
HRESULT CheckFileExistence(LPCWSTR pwzFile, LPDWORD pdwAttrib)
return hr;
}
};
+#endif // FEATURE_VERSIONING_LOG
Variables *g_BinderVariables = NULL;
}
} 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--;
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;
}
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;
}
_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') {
return ReadLoadedTypeHandle(kGetExact);
#else
- if ((retrieveWhich == kGetExact))
+ if (retrieveWhich == kGetExact)
return ReadLoadedTypeHandle(kGetExact);
// This nasty bit of code works out what the "canonicalization" of a
bool found = false;
ULONG32 currentOffset = m_nativeFrame->GetIPOffset();
for (ULONG32 i = 0; i < count; ++i)
- if (found = currentOffset == offsets[i])
+ if ((found = currentOffset == offsets[i]))
break;
if (!found)
LOG((LF_CORDB, LL_INFO10000, "D::FirstChanceManagedExceptionCatcherFound\n"));
- if ((pThread == NULL))
+ if (pThread == NULL)
{
_ASSERTE(!"Bad parameter");
LOG((LF_CORDB, LL_INFO10000, "D::FirstChanceManagedExceptionCatcherFound - Bad parameter.\n"));
startInCoop = bStartInCoop;
conditional = bConditional;
- if (!conditional || IFTHREAD && g_pEEInterface->GetThread() == NULL)
+ if (!conditional || (IFTHREAD && g_pEEInterface->GetThread() == NULL))
{
return;
}
void LeaveInternal()
{
- if (!conditional || IFTHREAD && g_pEEInterface->GetThread() == NULL)
+ if (!conditional || (IFTHREAD && g_pEEInterface->GetThread() == NULL))
{
return;
}
// the sig says value class, but we've got a boxed value class, then remember that we need to unbox it.
//
bool fNeedBoxOrUnbox = ((argSigType == ELEMENT_TYPE_CLASS) && (pFEAD->argElementType == ELEMENT_TYPE_VALUETYPE)) ||
- ((argSigType == ELEMENT_TYPE_VALUETYPE) && ((pFEAD->argElementType == ELEMENT_TYPE_CLASS) || (pFEAD->argElementType == ELEMENT_TYPE_OBJECT)) ||
+ (((argSigType == ELEMENT_TYPE_VALUETYPE) && ((pFEAD->argElementType == ELEMENT_TYPE_CLASS) || (pFEAD->argElementType == ELEMENT_TYPE_OBJECT))) ||
// This is when method signature is expecting a BYREF ValueType, yet we recieve the boxed valuetype's handle.
(pFEAD->argElementType == ELEMENT_TYPE_CLASS && argSigType == ELEMENT_TYPE_BYREF && byrefArgSigType == ELEMENT_TYPE_VALUETYPE));
DWORD tid = GetCurrentThreadId();
DebuggerIPCEventType type = (DebuggerIPCEventType) (event->type & DB_IPCE_TYPE_MASK);
-#endif _DEBUG || !FEATURE_CORESYSTEM
+#endif // _DEBUG || !FEATURE_CORESYSTEM
// We should never AV here. In a debug build, throw up an assert w/ lots of useful (private) info.
#ifdef _DEBUG
// If the end offset is 0, we want to check if we're in the prologue before concluding that the
// value of dwNativeOffset is out of range.
if ((dwNativeOffset >= m_map[i].nativeStartOffset) &&
- ((m_map[i].nativeEndOffset == 0) && (m_map[i].ilOffset != (ULONG)ICorDebugInfo::PROLOG) ||
+ (((m_map[i].nativeEndOffset == 0) && (m_map[i].ilOffset != (ULONG)ICorDebugInfo::PROLOG)) ||
(dwNativeOffset < m_map[i].nativeEndOffset)))
{
ULONG uILOffset = m_map[i].ilOffset;
#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
+extern HINSTANCE g_pMSCorEE;
+
+#ifndef FEATURE_PAL
+
//
// Returns path name from a file name. The path name will be (null-terminated, incl. the last '\' if present).
// Example: For input "C:\Windows\System.dll" returns "C:\Windows\".
return hr;
}
-extern HINSTANCE g_pMSCorEE;
-
-#ifndef FEATURE_PAL
-
BOOL PAL_GetPALDirectory(__out_ecount(cchBuffer) LPWSTR pbuffer,
DWORD cchBuffer)
{
#ifdef MULTIPLE_HEAPS
return g_bpromoted [thread*16];
#else //MULTIPLE_HEAPS
- thread = thread;
+ UNREFERENCED_PARAMETER(thread);
return g_bpromoted;
#endif //MULTIPLE_HEAPS
}
#ifdef MULTIPLE_HEAPS
return g_promoted [thread*16];
#else //MULTIPLE_HEAPS
- thread = thread;
+ UNREFERENCED_PARAMETER(thread);
return g_promoted;
#endif //MULTIPLE_HEAPS
}
#else //PREFETCH
inline void Prefetch (void* addr)
{
- addr = addr;
+ UNREFERENCED_PARAMETER(addr);
}
#endif //PREFETCH
#ifdef MH_SC_MARK
void gc_heap::background_promote (Object** ppObject, ScanContext* sc, DWORD flags)
{
- sc;
+ UNREFERENCED_PARAMETER(sc);
//in order to save space on the array, mark the object,
//knowing that it will be visited later
assert (settings.concurrent);
generation* gen = generation_of (active_new_gen_number);
plan_generation_start (gen, consing_gen, 0);
- if ((demotion_low == MAX_PTR))
+ if (demotion_low == MAX_PTR)
{
demotion_low = pplug;
dprintf (3, ("end plan: dlow->%Ix", demotion_low));
void gc_heap::background_promote_callback (Object** ppObject, ScanContext* sc,
DWORD flags)
{
- sc = sc;
+ UNREFERENCED_PARAMETER(sc);
//in order to save space on the array, mark the object,
//knowing that it will be visited later
assert (settings.concurrent);
{
if (card_set_p (i))
{
- if ((min == -1))
+ if (min == -1)
{
min = i;
}
}
// Are we at the end of the youngest_generation?
- if ((seg == ephemeral_heap_segment))
+ if (seg == ephemeral_heap_segment)
{
if (curr_object >= end_youngest)
{
#endif //!MULTIPLE_HEAPS
#ifdef FEATURE_PREMORTEM_FINALIZATION
- if (!pGenGCHeap->settings.concurrent && pGenGCHeap->settings.found_finalizers ||
+ if ((!pGenGCHeap->settings.concurrent && pGenGCHeap->settings.found_finalizers) ||
FinalizerThread::HaveExtraWorkForFinalizer())
{
FinalizerThread::EnableFinalization();
{
#ifdef MULTIPLE_HEAPS
return ((acontext->home_heap == GetHeap(thread_number)) ||
- (acontext->home_heap == 0) && (thread_number == 0));
+ ((acontext->home_heap == 0) && (thread_number == 0)));
#else
return true;
#endif //MULTIPLE_HEAPS
else()
#The MIDL tool exists for Windows only, so for other systems, we have the prebuilt xxx_i.c files checked in
+
+# The prebuilt files contain extra '!_MIDL_USE_GUIDDEF_' after the #endif, but not in the comment.
+# In order to not to have to modify these prebuilt files, we disable the extra tokens warning.
+add_compile_options(-Wno-extra-tokens)
+
foreach(IDL_SOURCE IN LISTS CORGUIDS_IDL_SOURCES)
get_filename_component(IDLNAME ${IDL_SOURCE} NAME_WE)
set(C_SOURCE ../pal/prebuilt/idl/${IDLNAME}_i.c)
ELEMENT_TYPE *pSrc;
SIZE_T nSrc;
- while (pSrc = iter.GetNext(&nSrc))
+ while ((pSrc = iter.GetNext(&nSrc)))
{
memcpy(pDest, pSrc, nSrc * sizeof(ELEMENT_TYPE));
pDest += nSrc;
SIZE_T count;
SIZE_T chunkBaseIndex = 0;
- while (chunk = iter.GetNext(&count))
+ while ((chunk = iter.GetNext(&count)))
{
SIZE_T nextBaseIndex = chunkBaseIndex + count;
if (nextBaseIndex > index)
}
inline HRESULT CeeFileGenWriter::setDllSwitch(bool dllSwitch) {
- if(m_dllSwitch = dllSwitch) m_objSwitch = FALSE; return S_OK;
+ if((m_dllSwitch = dllSwitch)) m_objSwitch = FALSE; return S_OK;
}
inline bool CeeFileGenWriter::getDllSwitch() {
}
inline HRESULT CeeFileGenWriter::setObjSwitch(bool objSwitch) {
- if(m_objSwitch = objSwitch) m_dllSwitch = FALSE; return S_OK;
+ if((m_objSwitch = objSwitch)) m_dllSwitch = FALSE; return S_OK;
}
inline bool CeeFileGenWriter::getObjSwitch() {
// This describes information about the COM+ primitive types
+#define NO_SIZE 255
+
// TYPEINFO(type (CorElementType), namespace, class, size, gcType, isArray,isPrim, isFloat,isModifier,isGenVariable)
-TYPEINFO(ELEMENT_TYPE_END, NULL, NULL, ~0, TYPE_GC_NONE, false, false, false, false, false) // 0x00
+TYPEINFO(ELEMENT_TYPE_END, NULL, NULL, NO_SIZE, TYPE_GC_NONE, false, false, false, false, false) // 0x00
TYPEINFO(ELEMENT_TYPE_VOID, "System", "Void", 0, TYPE_GC_NONE, false, true, false, false, false) // 0x01
TYPEINFO(ELEMENT_TYPE_BOOLEAN, "System", "Boolean", 1, TYPE_GC_NONE, false, true, false, false, false) // 0x02
TYPEINFO(ELEMENT_TYPE_CHAR, "System", "Char", 2, TYPE_GC_NONE, false, true, false, false, false) // 0x03
TYPEINFO(ELEMENT_TYPE_STRING, "System", "String", sizeof(void*), TYPE_GC_REF, false, false, false, false, false) // 0x0e
TYPEINFO(ELEMENT_TYPE_PTR, NULL, NULL, sizeof(void*), TYPE_GC_NONE, false, false, false, true, false) // 0x0f
TYPEINFO(ELEMENT_TYPE_BYREF, NULL, NULL, sizeof(void*), TYPE_GC_BYREF, false, false, false, true, false) // 0x10
-TYPEINFO(ELEMENT_TYPE_VALUETYPE, NULL, NULL, ~0, TYPE_GC_OTHER, false, false, false, false, false) // 0x11
+TYPEINFO(ELEMENT_TYPE_VALUETYPE, NULL, NULL, NO_SIZE, TYPE_GC_OTHER, false, false, false, false, false) // 0x11
TYPEINFO(ELEMENT_TYPE_CLASS, NULL, NULL, sizeof(void*), TYPE_GC_REF, false, false, false, false, false) // 0x12
TYPEINFO(ELEMENT_TYPE_VAR, NULL, NULL, sizeof(void*), TYPE_GC_OTHER, false, false, false, false, true) // 0x13
TYPEINFO(ELEMENT_TYPE_ARRAY, NULL, NULL, sizeof(void*), TYPE_GC_REF, true, false, false, true, false) // 0x14
TYPEINFO(ELEMENT_TYPE_GENERICINST, NULL, NULL, sizeof(void*), TYPE_GC_OTHER, false, false, false, false, false) // 0x15
TYPEINFO(ELEMENT_TYPE_TYPEDBYREF, "System", "TypedReference",2*sizeof(void*),TYPE_GC_BYREF, false, false, false, false, false) // 0x16
-TYPEINFO(ELEMENT_TYPE_VALUEARRAY_UNSUPPORTED, NULL,NULL, ~0, TYPE_GC_NONE, false, false, false, false, false) // 0x17 (unsupported, not in the ECMA spec)
+TYPEINFO(ELEMENT_TYPE_VALUEARRAY_UNSUPPORTED, NULL,NULL, NO_SIZE, TYPE_GC_NONE, false, false, false, false, false) // 0x17 (unsupported, not in the ECMA spec)
TYPEINFO(ELEMENT_TYPE_I, "System", "IntPtr", sizeof(void*), TYPE_GC_NONE, false, true, false, false, false) // 0x18
TYPEINFO(ELEMENT_TYPE_U, "System", "UIntPtr", sizeof(void*), TYPE_GC_NONE, false, true, false, false, false) // 0x19
-TYPEINFO(ELEMENT_TYPE_R_UNSUPPORTED,NULL, NULL, ~0, TYPE_GC_NONE, false, false, false, false, false) // 0x1a (unsupported, not in the ECMA spec)
+TYPEINFO(ELEMENT_TYPE_R_UNSUPPORTED,NULL, NULL, NO_SIZE, TYPE_GC_NONE, false, false, false, false, false) // 0x1a (unsupported, not in the ECMA spec)
TYPEINFO(ELEMENT_TYPE_FNPTR, NULL, NULL, sizeof(void*), TYPE_GC_NONE, false, false, false, false, false) // 0x1b
TYPEINFO(ELEMENT_TYPE_OBJECT, "System", "Object", sizeof(void*), TYPE_GC_REF, false, false, false, false, false) // 0x1c
size_t currentChunk = ((size_t) n) & (numEncodings-1);
size_t topmostBit = currentChunk & (numEncodings >> 1);
n >>= base; // signed arithmetic shift
- if( topmostBit && (n == (SSIZE_T)-1) || !topmostBit && (n == 0))
+ if((topmostBit && (n == (SSIZE_T)-1)) || (!topmostBit && (n == 0)))
{
// The topmost bit correctly represents the sign
Write( currentChunk, base+1 ); // This sets the extension bit to zero
typedef char (&_Yes)[1];
typedef char (&_No)[2];
- static _No _IsTypeWrapper(...);
+ static inline _No _IsTypeWrapper(...);
template <typename T>
static _Yes _IsTypeWrapper(T *, typename T::wrapped_type * = nullptr);
case O2K_CONST_INT:
// Is the const assertion's constant equal/not equal to the implied assertion?
usable = ((impAssertion->assertionKind == OAK_EQUAL) && (impAssertion->op2.u1.iconVal == iconVal)) ||
- (impAssertion->assertionKind == OAK_NOT_EQUAL) && (impAssertion->op2.u1.iconVal != iconVal);
+ ((impAssertion->assertionKind == OAK_NOT_EQUAL) && (impAssertion->op2.u1.iconVal != iconVal));
break;
}
// Most 16-bit operands will require a size prefix .
// This refers to 66h size prefix override.
- if ( (attrSize == EA_2BYTE)
#if FEATURE_STACK_FP_X87
- && (ins != INS_fldcw)
- && (ins != INS_fnstcw)
+ if ((attrSize == EA_2BYTE) && (ins != INS_fldcw) && (ins != INS_fnstcw))
+#else // FEATURE_STACK_FP_X87
+ if (attrSize == EA_2BYTE)
#endif // FEATURE_STACK_FP_X87
- )
{
size++;
}
case CEE_CALLI:
{
if (compIsForInlining() || // Ignore tail call in the inlinee. Period.
- !tailCall &&
- !compTailCallStress() // A new BB with BBJ_RETURN would have been created
+ (!tailCall &&
+ !compTailCallStress()) // A new BB with BBJ_RETURN would have been created
// after a tailcall statement.
// We need to keep this invariant if we want to stress the tailcall.
pParam->pThis->eeGetMethodFullName(pParam->fncHandle),
pParam->pThis->dspPtr(pParam->inlineInfo->tokenLookupContextHandle)));
- unsigned compileFlagsForInlinee = pParam->pThis->opts.eeFlags & ~CORJIT_FLG_LOST_WHEN_INLINING
+ unsigned compileFlagsForInlinee = (pParam->pThis->opts.eeFlags & ~CORJIT_FLG_LOST_WHEN_INLINING)
| CORJIT_FLG_SKIP_VERIFICATION;
#ifdef DEBUG
GenTreePtr lclVarTree;
if ((tree->gtFlags & spillFlags) != 0 ||
- spillGlobEffects && // Only consider the following when spillGlobEffects == TRUE
+ (spillGlobEffects && // Only consider the following when spillGlobEffects == TRUE
!impIsAddressInLocal(tree, &lclVarTree) && // No need to spill the GT_ADDR node on a local.
- gtHasLocalsWithAddrOp(tree)) // Spill if we still see GT_LCL_VAR that contains lvHasLdAddrOp or lvAddrTaken flag.
+ gtHasLocalsWithAddrOp(tree))) // Spill if we still see GT_LCL_VAR that contains lvHasLdAddrOp or lvAddrTaken flag.
{
impSpillStackEntry(i, BAD_VAR_NUM
DEBUGARG(false) DEBUGARG(reason));
}
else
#endif //INLINE_NDIRECT
- if (opcode == CEE_CALLI &&
- (sig->callConv & CORINFO_CALLCONV_MASK) == CORINFO_CALLCONV_STDCALL ||
+ // TODO-Review: the indentation below suggests different precedence of the && and ||
+ // operators than the one based on the parens around the first && term.
+ // It needs to be investigated whether the indentation is wrong or the
+ // parens are wrong and all the || terms should be grouped together in parens.
+ if ((opcode == CEE_CALLI &&
+ (sig->callConv & CORINFO_CALLCONV_MASK) == CORINFO_CALLCONV_STDCALL) ||
(sig->callConv & CORINFO_CALLCONV_MASK) == CORINFO_CALLCONV_C ||
(sig->callConv & CORINFO_CALLCONV_MASK) == CORINFO_CALLCONV_THISCALL ||
(sig->callConv & CORINFO_CALLCONV_MASK) == CORINFO_CALLCONV_FASTCALL)
if (codeAddr < codeEndp)
{
OPCODE nextOpcode = (OPCODE) getU1LittleEndian(codeAddr);
- if (!opts.compDbgCode &&
- (nextOpcode == CEE_STLOC) ||
+ // TODO-Review: the indentation below suggests different precedence of the && and ||
+ // operators than the one based on the parens around the first && term.
+ // It needs to be investigated whether the indentation is wrong or the
+ // parens are wrong and all the || terms should be grouped together in parens.
+ if ((!opts.compDbgCode &&
+ (nextOpcode == CEE_STLOC)) ||
(nextOpcode == CEE_STLOC_S) ||
((nextOpcode >= CEE_STLOC_0) && (nextOpcode <= CEE_STLOC_3)))
{
// live only at another target), and we can't copy another lclVar into that reg in this block.
regMaskTP sameToRegMask = genRegMask(sameToReg);
if (maybeSameLivePaths &&
- ((sameToRegMask & liveOutRegs) != RBM_NONE) || ((sameToRegMask & sameWriteRegs) != RBM_NONE))
+ (((sameToRegMask & liveOutRegs) != RBM_NONE) || ((sameToRegMask & sameWriteRegs) != RBM_NONE)))
{
sameToReg = REG_NA;
}
{
GenTreeBoundsChk* bndsChk = NULL;
- if ((tree->gtOper == GT_ARR_BOUNDS_CHECK)
#ifdef FEATURE_SIMD
- || (tree->gtOper == GT_SIMD_CHK)
+ if ((tree->gtOper == GT_ARR_BOUNDS_CHECK) || (tree->gtOper == GT_SIMD_CHK))
+#else // FEATURE_SIMD
+ if (tree->gtOper == GT_ARR_BOUNDS_CHECK)
#endif // FEATURE_SIMD
- )
{
bndsChk = tree->AsBoundsChk();
}
#endif // _TARGET_*
}
// We've already printed a register. Is this the end of a range?
- else if ((regNum == REG_INT_LAST)
#if defined(_TARGET_ARM64_)
+ else if ((regNum == REG_INT_LAST)
|| (regNum == REG_R17) // last register before TEB
- || (regNum == REG_R28) // last register before FP
+ || (regNum == REG_R28)) // last register before FP
+#else // _TARGET_ARM64_
+ else if (regNum == REG_INT_LAST)
#endif // _TARGET_ARM64_
- )
{
const char* nam = getRegName(regNum);
printf("%s%s", sep, nam);
#include "log.h"
//-----------------------------------------------------------------------------
-// round a pointer back down to something aligned
-static inline char* truncateTo(__in char* val, unsigned align) {
- _ASSERTE((align & (align - 1)) == 0); // align must be a power of 2
-
- return((char*) ((UINT_PTR)(val) & ~(((UINT_PTR)align)-1)));
-}
-
-//-----------------------------------------------------------------------------
// round up to a certain alignment
static inline unsigned roundUp(unsigned val, unsigned align) {
_ASSERTE((align & (align - 1)) == 0); // align must be a power of 2
#define PORTABILITY_ASSERT(message) _ASSERTE(false && message)
#endif
-#define UNREFERENCED_PARAMETER(P) (P)
+#define UNREFERENCED_PARAMETER(P) (void)(P)
#ifdef _WIN64
#define VALPTR(x) VAL64(x)
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;
}
//
ulMant = (LONG)dbl;
dbl -= (double)ulMant; // difference between input & integer
- if ( dbl > 0.5 || dbl == 0.5 && (ulMant & 1) )
+ if ( dbl > 0.5 || (dbl == 0.5 && (ulMant & 1)) )
ulMant++;
if (ulMant == 0)
//
sdlMant.int64 = (LONGLONG)dbl;
dbl -= (double)(LONGLONG)sdlMant.int64; // dif between input & integer
- if ( dbl > 0.5 || dbl == 0.5 && (sdlMant.u.Lo & 1) )
+ if ( dbl > 0.5 || (dbl == 0.5 && (sdlMant.u.Lo & 1)) )
sdlMant.int64++;
if (sdlMant.int64 == 0)
// Round result based on remainder in sdlTmp1.Hi.
//
ulPwr >>= 1; // compare to power/2 (power always even)
- if (sdlTmp1.u.Hi > ulPwr || sdlTmp1.u.Hi == ulPwr && (sdlTmp.u.Lo & 1))
+ if (sdlTmp1.u.Hi > ulPwr || (sdlTmp1.u.Hi == ulPwr && (sdlTmp.u.Lo & 1)))
sdlTmp.int64++;
}
else {
// Current result is in sdlTmp.
//
ulPwr >>= 1; // compare to power/2 (power always even)
- if (sdlTmp1.u.Lo > ulPwr || sdlTmp1.u.Lo == ulPwr &&
- ((sdlTmp.u.Lo & 1) || sdlTmp1.u.Hi != 0))
+ if (sdlTmp1.u.Lo > ulPwr || (sdlTmp1.u.Lo == ulPwr &&
+ ((sdlTmp.u.Lo & 1) || sdlTmp1.u.Hi != 0)))
sdlTmp.int64++;
}
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))
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))
#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
&& (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;
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;
// Check if it's the typical instantiation. In this case it's not stored in the same
// way as other constructed types.
if (!pKey->IsConstructed() ||
- pKey->GetKind() == ELEMENT_TYPE_CLASS && ClassLoader::IsTypicalInstantiation(pKey->GetModule(),
- pKey->GetTypeToken(),
- pKey->GetInstantiation()))
+ (pKey->GetKind() == ELEMENT_TYPE_CLASS && ClassLoader::IsTypicalInstantiation(pKey->GetModule(),
+ pKey->GetTypeToken(),
+ pKey->GetInstantiation())))
{
return TypeHandle(pKey->GetModule()->LookupTypeDef(pKey->GetTypeToken()));
}
// it was already done in CanAccessClass above.
if (accessCheckOptions.TransparencyCheckNeeded() &&
- (checkTargetMethodTransparency && pOptionalTargetMethod ||
+ ((checkTargetMethodTransparency && pOptionalTargetMethod) ||
pOptionalTargetField))
{
if (!CheckTransparentAccessToCriticalCode(
for (int i=0; i < count; i++)
{
if (ppList[i]->m_pAllocator == pAllocator ||
- !fCanUnload && !ppList[i]->m_pAllocator->CanUnload())
+ (!fCanUnload && !ppList[i]->m_pAllocator->CanUnload()))
{
pList = ppList[i];
break;
lExit: ;
- STRESS_LOG3(LF_EH|LF_GCROOTS, LL_INFO100, "Returning" FMT_ADDR "as the parent stack frame for %s" FMT_ADDR "\n",
- DBG_ADDR(sfResult.SP), fIsFilterFunclet ? "filter funclet" : "funclet", DBG_ADDR(csfCurrent.SP));
+ STRESS_LOG3(LF_EH|LF_GCROOTS, LL_INFO100, "Returning 0x%p as the parent stack frame for %s 0x%p\n",
+ sfResult.SP, fIsFilterFunclet ? "filter funclet" : "funclet", csfCurrent.SP);
return sfResult;
}
Pop(pThread);
}
}
-#endif FEATURE_PAL
+#endif // FEATURE_PAL
//-----------------------------------------------------------------------
#endif // #ifndef DACCESS_COMPILE
return SWA_CONTINUE;
}
-static void CALLBACK CheckPromoted(_UNCHECKED_OBJECTREF *pObjRef, LPARAM *pExtraInfo, LPARAM lp1, LPARAM lp2)
-{
- LIMITED_METHOD_CONTRACT;
-
- LOG((LF_GC, LL_INFO100000, LOG_HANDLE_OBJECT_CLASS("Checking referent of Weak-", pObjRef, "to ", *pObjRef)));
-
- Object **pRef = (Object **)pObjRef;
- if (!GCHeap::GetGCHeap()->IsPromoted(*pRef))
- {
- LOG((LF_GC, LL_INFO100, LOG_HANDLE_OBJECT_CLASS("Severing Weak-", pObjRef, "to unreachable ", *pObjRef)));
-
- *pRef = NULL;
- }
- else
- {
- LOG((LF_GC, LL_INFO1000000, "reachable " LOG_OBJECT_CLASS(*pObjRef)));
- }
-}
-
VOID GCToEEInterface::SyncBlockCacheWeakPtrScan(HANDLESCANPROC scanProc, LPARAM lp1, LPARAM lp2)
{
CONTRACTL
{
LIMITED_METHOD_DAC_CONTRACT;
- for (m_pBucket = m_pBucket;m_pBucket < m_pSentinel; m_pBucket++)
+ for (;m_pBucket < m_pSentinel; m_pBucket++)
{ //loop thru all buckets
for (m_id = m_id+1; m_id < 4; m_id++)
{ //loop through all slots
return res;
}
-#ifdef _TARGET_AMD64_
+#if defined(_TARGET_AMD64_) && defined(_MSC_VER)
// codegen bug on amd64 causes BBT to fail for the following function. as a
// workaround I have disabled optimizations for it until we get an updated toolset.
#pragma optimize( "", off )
return res;
}
-#ifdef _TARGET_AMD64_
+#if defined(_TARGET_AMD64_) && defined(_MSC_VER)
// turn optimizations back on
#pragma optimize( "", on )
#endif
if (pMT->ContainsStackPtr())
ret |= CORINFO_FLG_CONTAINS_STACK_PTR;
- if (pClass->IsNotTightlyPacked() && (!pClass->IsManagedSequential() || pClass->HasExplicitSize()) ||
+ if ((pClass->IsNotTightlyPacked() && (!pClass->IsManagedSequential() || pClass->HasExplicitSize())) ||
pMT == g_TypedReferenceMT ||
VMClsHnd.IsNativeValueType())
{
alignmentA = 0;
}
- if ((alignmentA == 0))
+ if (alignmentA == 0)
{
while (count >= 4)
{
#endif // _DEBUG
#ifdef FEATURE_CORECLR
- if (pAssembly->IsSystem() || pAssembly->GetManifestFile()->HasOpenedILimage() && GetAppDomain()->IsImageFullyTrusted(pAssembly->GetManifestFile()->GetOpenedILimage()))
+ if (pAssembly->IsSystem() || (pAssembly->GetManifestFile()->HasOpenedILimage() && GetAppDomain()->IsImageFullyTrusted(pAssembly->GetManifestFile()->GetOpenedILimage())))
{
// Set the flag if the assembly is microsoft platform. This gets saved in Ngen Image
// to determinne if the NI was genrated as full-trust. If NI is generated as full-trust
ClassLoader::NotFoundAction notFoundAction;
CorInternalStates tdTypes;
- switch(typ) {
+ switch((DWORD)typ) {
case ELEMENT_TYPE_TYPEDBYREF:
{
thRet = TypeHandle(g_TypedReferenceMT);
// Check that the type that we loaded matches the signature
// with regards to ET_CLASS and ET_VALUETYPE
//
- if ((fLoadTypes == ClassLoader::LoadTypes))
+ if (fLoadTypes == ClassLoader::LoadTypes)
{
// Skip this check when using zap sigs; it should have been correctly computed at NGen time
// and a change from one to the other would have invalidated the image.
}
#ifndef DACCESS_COMPILE
- if ((fLoadTypes == ClassLoader::LoadTypes))
+ if (fLoadTypes == ClassLoader::LoadTypes)
{
// Skip this check when using zap sigs; it should have been correctly computed at NGen time
// and a change from one to the other would have invalidated the image. Leave in the code for debug so we can assert below.
// b) may be implicit (ie. absent) in the overriden variable's declaration
if (!(CompareTypeDefOrRefOrSpec(pModule1, tkConstraintType1, NULL,
MscorlibBinder::GetModule(), g_pObjectClass->GetCl(), NULL, NULL) ||
- ((specialConstraints1 & gpNotNullableValueTypeConstraint) != 0) &&
+ (((specialConstraints1 & gpNotNullableValueTypeConstraint) != 0) &&
(CompareTypeDefOrRefOrSpec(pModule1, tkConstraintType1, NULL,
- MscorlibBinder::GetModule(), g_pValueTypeClass->GetCl(), NULL, NULL))))
+ MscorlibBinder::GetModule(), g_pValueTypeClass->GetCl(), NULL, NULL)))))
{
HENUMInternalHolder hEnum2(pInternalImport2);
mdGenericParamConstraint tkConstraint2;
_ASSERTE(m_flags & GC_FUNCLET_REFERENCE_REPORTING);
STRESS_LOG2(LF_GCROOTS, LL_INFO100,
- "STACKWALK: Reached parent of non-filter funclet @ CallerSP: " FMT_ADDR ", m_crawl.pFunc = " FMT_ADDR "\n",
- DBG_ADDR(m_sfParent.SP), DBG_ADDR(m_crawl.pFunc));
+ "STACKWALK: Reached parent of non-filter funclet @ CallerSP: %p, m_crawl.pFunc = %p\n",
+ m_sfParent.SP, m_crawl.pFunc);
// by default a funclet's parent won't report its GC roots since they would have already
// been reported by the funclet. however there is a small window during unwind before
}
STRESS_LOG4(LF_GCROOTS, LL_INFO100,
- "Funclet didn't report references: handling frame: " FMT_ADDR ", m_sfFuncletParent = " FMT_ADDR ", is funclet: %d, skip reporting %d\n",
- DBG_ADDR(pTracker->GetEstablisherOfActualHandlingFrame().SP), DBG_ADDR(m_sfFuncletParent.SP), m_crawl.IsFunclet(), shouldSkipReporting);
+ "Funclet didn't report references: handling frame: %p, m_sfFuncletParent = %p, is funclet: %d, skip reporting %d\n",
+ pTracker->GetEstablisherOfActualHandlingFrame().SP, m_sfFuncletParent.SP, m_crawl.IsFunclet(), shouldSkipReporting);
}
m_crawl.fShouldParentToFuncletSkipReportingGCReferences = shouldSkipReporting;