Fix next round of warning types
authorJan Vorlicek <janvorli@microsoft.com>
Fri, 27 Mar 2015 22:30:10 +0000 (23:30 +0100)
committerJan Vorlicek <janvorli@microsoft.com>
Wed, 1 Apr 2015 19:39:28 +0000 (21:39 +0200)
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.

51 files changed:
CMakeLists.txt
src/ToolBox/SOS/Strike/stressLogDump.cpp
src/ToolBox/SOS/Strike/util.h
src/binder/applicationcontext.cpp
src/binder/assemblybinder.cpp
src/binder/textualidentityparser.cpp
src/binder/variables.cpp
src/classlibnative/bcltype/decimal.cpp
src/classlibnative/bcltype/number.cpp
src/debug/daccess/dacdbiimpl.cpp
src/debug/di/rsthread.cpp
src/debug/ee/debugger.cpp
src/debug/ee/debugger.h
src/debug/ee/funceval.cpp
src/debug/ee/rcthread.cpp
src/debug/inc/dacdbistructures.inl
src/dlls/mscoree/mscoree.cpp
src/gc/gc.cpp
src/inc/CMakeLists.txt
src/inc/arraylist.h
src/inc/ceefilegenwriter.h
src/inc/cortypeinfo.h
src/inc/gcinfoencoder.h
src/inc/internalunknownimpl.h
src/jit/assertionprop.cpp
src/jit/emitxarch.cpp
src/jit/flowgraph.cpp
src/jit/importer.cpp
src/jit/lsra.cpp
src/jit/morph.cpp
src/jit/utils.cpp
src/md/ceefilegen/blobfetcher.cpp
src/pal/inc/rt/palrt.h
src/palrt/decarith.cpp
src/palrt/decconv.cpp
src/utilcode/corimage.cpp
src/utilcode/ex.cpp
src/utilcode/rangetree.cpp
src/utilcode/util.cpp
src/vm/clsload.cpp
src/vm/codeman.cpp
src/vm/exceptionhandling.cpp
src/vm/frames.cpp
src/vm/gcenv.cpp
src/vm/hash.h
src/vm/interoputil.cpp
src/vm/jitinterface.cpp
src/vm/object.cpp
src/vm/securitymeta.cpp
src/vm/siginfo.cpp
src/vm/stackwalk.cpp

index 4db7946..0ee0d95 100644 (file)
@@ -264,26 +264,23 @@ add_definitions(-DDISABLE_CONTRACTS)
 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)
 
index 6d6d924..1cd1e38 100644 (file)
@@ -249,7 +249,7 @@ void formatOutput(struct IDebugDataSpaces* memCallBack, __in FILE* file, __inout
                     }
                 }
             }
-            else if (*ptr == 's' || *ptr == 'h' && *(ptr+1) == 's' && ++ptr
+            else if (*ptr == 's' || (*ptr == 'h' && *(ptr+1) == 's' && ++ptr)
             {
                 HRESULT     hr;
 
@@ -266,7 +266,7 @@ void formatOutput(struct IDebugDataSpaces* memCallBack, __in FILE* file, __inout
 
                 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;
 
index 9476b75..6f88a7b 100644 (file)
@@ -1427,7 +1427,7 @@ DllsName(
 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;
 }
 
index 8aadd40..d560a1d 100644 (file)
 
 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)
     {
@@ -407,8 +325,8 @@ namespace BINDER_SPACE
                 // 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;
index 308e122..89a3c0f 100644 (file)
@@ -469,66 +469,6 @@ namespace BINDER_SPACE
         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 */
@@ -700,8 +640,7 @@ namespace BINDER_SPACE
 #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
index e1ca4a5..2162629 100644 (file)
@@ -189,19 +189,6 @@ namespace BINDER_SPACE
             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);
index c291524..b2c5655 100644 (file)
@@ -19,6 +19,7 @@
 
 namespace BINDER_SPACE
 {
+#ifdef FEATURE_VERSIONING_LOG
     namespace
     {
         HRESULT CheckFileExistence(LPCWSTR pwzFile, LPDWORD pdwAttrib)
@@ -51,6 +52,7 @@ namespace BINDER_SPACE
             return hr;
         }
     };
+#endif // FEATURE_VERSIONING_LOG
 
     Variables *g_BinderVariables = NULL;
 
index c3fbc31..ac1ffa5 100644 (file)
@@ -335,10 +335,10 @@ int COMDecimal::NumberToDecimal(NUMBER* number, DECIMAL* value)
         }
     } 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--;
@@ -1306,10 +1306,10 @@ HaveScale64:
         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;
       }
@@ -1707,10 +1707,10 @@ HaveScale64:
         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;
       }
index 89bb493..04fe9f6 100644 (file)
@@ -1046,7 +1046,7 @@ wchar ParseFormatSpecifier(STRINGREF str, int* digits)
         _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') {
index aed15c0..8151f79 100644 (file)
@@ -1887,7 +1887,7 @@ TypeHandle DacDbiInterfaceImpl::TypeDataWalk::ReadLoadedTypeArg(TypeHandleReadTy
     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
index 8210369..601d21f 100644 (file)
@@ -8915,7 +8915,7 @@ HRESULT CordbJITILFrame::GetReturnValueForILOffsetImpl(ULONG32 ILoffset, ICorDeb
     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)
index 582a395..11460ec 100644 (file)
@@ -8146,7 +8146,7 @@ void Debugger::SendCatchHandlerFound(
 
     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"));
index 25c1ad5..9610384 100644 (file)
@@ -225,7 +225,7 @@ private:
         startInCoop = bStartInCoop;
         conditional = bConditional;
 
-        if (!conditional || IFTHREAD && g_pEEInterface->GetThread() == NULL)
+        if (!conditional || (IFTHREAD && g_pEEInterface->GetThread() == NULL))
         {
             return;
         }
@@ -245,7 +245,7 @@ private:
 
     void LeaveInternal()
     {
-        if (!conditional || IFTHREAD && g_pEEInterface->GetThread() == NULL)
+        if (!conditional || (IFTHREAD && g_pEEInterface->GetThread() == NULL))
         {
             return;
         }
index 93f5dcd..a15e6ad 100644 (file)
@@ -1805,7 +1805,7 @@ void GatherFuncEvalArgInfo(DebuggerEval *pDE,
         // 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));
 
index 896db99..cf19d6f 100644 (file)
@@ -809,7 +809,7 @@ static LONG _debugFilter(LPEXCEPTION_POINTERS ep, PVOID pv)
     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
index 0471426..fe591c8 100644 (file)
@@ -343,7 +343,7 @@ DWORD SequencePoints::MapNativeOffsetToIL(DWORD                  dwNativeOffset,
         // 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;
index 4d935d2..3f207b5 100644 (file)
@@ -728,6 +728,10 @@ STDAPI LoadStringRCEx(
 
 #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\".
@@ -788,10 +792,6 @@ HRESULT CopySystemDirectory(__in WCHAR *pFileName,
     return hr;
 }
 
-extern HINSTANCE            g_pMSCorEE;
-
-#ifndef FEATURE_PAL
-
 BOOL PAL_GetPALDirectory(__out_ecount(cchBuffer) LPWSTR pbuffer, 
                          DWORD  cchBuffer)
 {
index b9e0707..f942b36 100644 (file)
@@ -6041,7 +6041,7 @@ size_t& gc_heap::bpromoted_bytes(int thread)
 #ifdef MULTIPLE_HEAPS
     return g_bpromoted [thread*16];
 #else //MULTIPLE_HEAPS
-    thread = thread;
+    UNREFERENCED_PARAMETER(thread);
     return g_bpromoted;
 #endif //MULTIPLE_HEAPS
 }
@@ -16269,7 +16269,7 @@ size_t& gc_heap::promoted_bytes(int thread)
 #ifdef MULTIPLE_HEAPS
     return g_promoted [thread*16];
 #else //MULTIPLE_HEAPS
-    thread = thread;
+    UNREFERENCED_PARAMETER(thread);
     return g_promoted;
 #endif //MULTIPLE_HEAPS
 }
@@ -16913,7 +16913,7 @@ __declspec(naked) void __fastcall Prefetch(void* addr)
 #else //PREFETCH
 inline void Prefetch (void* addr)
 {
-    addr = addr;
+    UNREFERENCED_PARAMETER(addr);
 }
 #endif //PREFETCH
 #ifdef MH_SC_MARK
@@ -17856,7 +17856,7 @@ void gc_heap::background_verify_mark (Object*& object, ScanContext* sc, DWORD fl
 
 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);
@@ -21434,7 +21434,7 @@ void gc_heap::plan_phase (int condemned_gen_number)
                     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));
@@ -25824,7 +25824,7 @@ void gc_heap::background_grow_c_mark_list()
 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);
@@ -31326,7 +31326,7 @@ void gc_heap::descr_card_table ()
         {
             if (card_set_p (i))
             {
-                if ((min == -1))
+                if (min == -1)
                 {
                     min = i;
                 }
@@ -32415,7 +32415,7 @@ gc_heap::verify_heap (BOOL begin_gc_p)
         }
 
         // Are we at the end of the youngest_generation?
-        if ((seg == ephemeral_heap_segment))
+        if (seg == ephemeral_heap_segment)
         {
             if (curr_object >= end_youngest)
             {
@@ -34550,7 +34550,7 @@ GCHeap::GarbageCollectGeneration (unsigned int gen, gc_reason reason)
 #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();
@@ -34668,7 +34668,7 @@ bool GCHeap::IsThreadUsingAllocationContextHeap(alloc_context* acontext, int thr
 {
 #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
index 51f7a8d..be7f6d4 100644 (file)
@@ -50,6 +50,11 @@ add_compile_options(/TC)
 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)
index f6f4014..b22fb2e 100644 (file)
@@ -421,7 +421,7 @@ public:
         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;
@@ -436,7 +436,7 @@ public:
         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)
index cbd5d87..5d0df4d 100644 (file)
@@ -190,7 +190,7 @@ inline LPWSTR CeeFileGenWriter::getResourceFileName() {
 }
 
 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() {
@@ -198,7 +198,7 @@ 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() {
index a7f53a3..e35ae6f 100644 (file)
@@ -5,9 +5,11 @@
 
 // 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
@@ -26,18 +28,18 @@ TYPEINFO(ELEMENT_TYPE_R8,           "System", "Double",        8,              T
 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
index 2450ffe..9987d67 100644 (file)
@@ -554,7 +554,7 @@ public:
             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
index 0fe54be..cf72a0a 100644 (file)
@@ -70,7 +70,7 @@ namespace ComUtil
         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);
index b3c1da6..8181957 100644 (file)
@@ -3769,7 +3769,7 @@ EXPSET_TP Compiler::optImpliedByConstAssertion(AssertionDsc* constAssertion)
         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;
         }
 
index 2112fae..44632da 100644 (file)
@@ -1925,12 +1925,11 @@ UNATIVE_OFFSET      emitter::emitInsSizeAM(instrDesc* id, size_t code)
         // 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++;
         }
index 6bd2f62..5447260 100644 (file)
@@ -5382,8 +5382,8 @@ DECODE_OPCODE:
         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.
@@ -21716,7 +21716,7 @@ JitInlineResult       Compiler::fgInvokeInlineeCompiler(GenTreeCall* call)
                          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
index 6522310..70e0379 100644 (file)
@@ -1913,9 +1913,9 @@ void                Compiler::impSpillSideEffects(bool      spillGlobEffects,
         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));
@@ -6085,8 +6085,12 @@ var_types           Compiler::impImportCall (OPCODE         opcode,
     }
     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)
@@ -10488,8 +10492,12 @@ _CONV:
             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)))
                 {
index 3019f3e..691db80 100644 (file)
@@ -7802,7 +7802,7 @@ LinearScan::handleOutoingCriticalEdges(BasicBlock*  block)
             // 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;
             }
index 60508c8..0a40c5d 100644 (file)
@@ -3880,11 +3880,11 @@ void            Compiler::fgSetRngChkTarget(GenTreePtr  tree,
 {
     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();
     }
index 4a9c267..a5386ff 100644 (file)
@@ -353,12 +353,13 @@ void                dspRegMask(regMaskTP regMask, size_t minSiz)
 #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);
index 1657326..aa1b06a 100644 (file)
 #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
index 3cd7aee..10e9f13 100644 (file)
@@ -1380,7 +1380,7 @@ typedef VOID (__stdcall *WAITORTIMERCALLBACK)(PVOID, BOOLEAN);
 #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)
index 03b2069..1552dbd 100644 (file)
@@ -1001,10 +1001,10 @@ HaveScale64:
             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;
           }
index 259f72e..2ba6703 100644 (file)
@@ -186,7 +186,7 @@ VarDecFromR4(float fltIn, DECIMAL FAR* pdecOut)
     //
     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)
@@ -333,7 +333,7 @@ VarDecFromR8(double dblIn, DECIMAL FAR* pdecOut)
     //
     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)
@@ -529,7 +529,7 @@ STDAPI VarCyFromDec(DECIMAL FAR* pdecIn, CY FAR* pcyOut)
       // 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 {
@@ -584,8 +584,8 @@ STDAPI VarCyFromDec(DECIMAL FAR* pdecIn, CY FAR* pcyOut)
       // 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++;
     }
 
index b6fd60d..3763e54 100644 (file)
@@ -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))
index 032971f..1fd997f 100644 (file)
@@ -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
 
 
index 028ebd9..6d3f644 100644 (file)
@@ -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;
index 2056598..ee115c7 100644 (file)
@@ -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;
             
index f80041c..59ceddd 100644 (file)
@@ -1393,9 +1393,9 @@ TypeHandle ClassLoader::LookupTypeHandleForTypeKeyInner(TypeKey *pKey, BOOL fChe
     // 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()));
     }
@@ -6235,7 +6235,7 @@ BOOL ClassLoader::CheckAccessMember(                // TRUE if access is allowed
     // it was already done in CanAccessClass above.
 
     if (accessCheckOptions.TransparencyCheckNeeded() &&
-        (checkTargetMethodTransparency && pOptionalTargetMethod ||
+        ((checkTargetMethodTransparency && pOptionalTargetMethod) ||
          pOptionalTargetField))
     {
         if (!CheckTransparentAccessToCriticalCode(
index b5243a5..bd9a82f 100644 (file)
@@ -2393,7 +2393,7 @@ EEJitManager::DomainCodeHeapList *EEJitManager::GetCodeHeapList(MethodDesc *pMD,
     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;
index 7e7dc57..e48edc8 100644 (file)
@@ -6226,8 +6226,8 @@ StackFrame ExceptionTracker::FindParentStackFrameHelper(CrawlFrame* pCF,
 
 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;
 }
index bc1d48e..e65aade 100644 (file)
@@ -490,7 +490,7 @@ Frame::~Frame()
         Pop(pThread);
     }
 }
-#endif FEATURE_PAL
+#endif // FEATURE_PAL
 
 //-----------------------------------------------------------------------
 #endif // #ifndef DACCESS_COMPILE
index a342533..68eee62 100644 (file)
@@ -327,25 +327,6 @@ StackWalkAction GcStackCrawlCallBack(CrawlFrame* pCF, VOID* pData)
     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
index 8929c5c..2fd4418 100644 (file)
@@ -491,7 +491,7 @@ public:
         {
             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
index b1943bc..6dbc7c1 100644 (file)
@@ -1509,7 +1509,7 @@ ULONG SafeReleasePreemp(IUnknown * pUnk, RCW * pRCW)
     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 )
@@ -1600,7 +1600,7 @@ ULONG SafeRelease(IUnknown* pUnk, RCW* pRCW)
 
     return res;
 }
-#ifdef _TARGET_AMD64_
+#if defined(_TARGET_AMD64_) && defined(_MSC_VER)
 // turn optimizations back on
 #pragma optimize( "", on )
 #endif
index e677e27..c12351a 100644 (file)
@@ -4050,7 +4050,7 @@ DWORD CEEInfo::getClassAttribsInternal (CORINFO_CLASS_HANDLE clsHnd)
             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())
             {
index 9b57600..648cbf9 100644 (file)
@@ -2176,7 +2176,7 @@ INT32 StringObject::FastCompareStringHelper(DWORD* strAChars, INT32 countA, DWOR
             alignmentA = 0;
         }
 
-        if ((alignmentA == 0))
+        if (alignmentA == 0)
         {
             while (count >= 4)
             {
index f631cc1..b46ac44 100644 (file)
@@ -1723,7 +1723,7 @@ void ModuleSecurityDescriptor::VerifyDataComputed()
 #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
index 3cc9cf1..dd57e63 100644 (file)
@@ -1121,7 +1121,7 @@ TypeHandle SigPointer::GetTypeHandleThrowing(
         ClassLoader::NotFoundAction  notFoundAction;
         CorInternalStates            tdTypes;
 
-        switch(typ) {
+        switch((DWORD)typ) {
         case ELEMENT_TYPE_TYPEDBYREF:
         {
             thRet = TypeHandle(g_TypedReferenceMT);
@@ -1517,7 +1517,7 @@ TypeHandle SigPointer::GetTypeHandleThrowing(
             // 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. 
@@ -1811,7 +1811,7 @@ TypeHandle SigPointer::GetGenericInstType(Module *        pModule,
         }
 
 #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.
@@ -4816,9 +4816,9 @@ BOOL MetaSig::CompareVariableConstraints(const Substitution *pSubst1,
         // 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;
index e78b1eb..d39ce06 100644 (file)
@@ -1972,8 +1972,8 @@ ProcessFuncletsForGCReporting:
                                     _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
@@ -2008,8 +2008,8 @@ ProcessFuncletsForGCReporting:
                                         }
                                         
                                         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;