Переглянути джерело

code quality: fix msvc /permissive- issues

Fix #3055
Fix #4360
Jianchun Xu 8 роки тому
батько
коміт
7a3d45b428

+ 2 - 0
lib/Common/CommonBasic.h

@@ -17,6 +17,8 @@ using std::type_info;
 
 #include "CommonPal.h"
 
+#include "Core/CommonMinMax.h"
+
 // === Core Header Files ===
 #include "Core/CommonTypedefs.h"
 #include "Core/Api.h"

+ 0 - 21
lib/Common/CommonMin.h

@@ -18,27 +18,6 @@
 #endif
 
 // === Core Header Files ===
-// In Debug mode, the PALs definition of max and min are insufficient
-// since some of our code expects the template min-max instead, so
-// including that here
-#if defined(DBG) && !defined(_MSC_VER)
-#pragma push_macro("NO_PAL_MINMAX")
-#pragma push_macro("_Post_equal_to")
-#pragma push_macro("_Post_satisfies_")
-#define NO_PAL_MINMAX
-#define _Post_equal_to_(x)
-#define _Post_satisfies_(x)
-#endif
-
-#include "Core/CommonMinMax.h"
-
-// Restore the macros
-#if defined(DBG) && !defined(_MSC_VER)
-#pragma pop_macro("NO_PAL_MINMAX")
-#pragma pop_macro("_Post_equal_to")
-#pragma pop_macro("_Post_satisfies_")
-#endif
-
 #include "EnumHelp.h"
 #include "Core/Assertions.h"
 #include "Core/SysInfo.h"

+ 8 - 6
lib/Common/CommonPal.h

@@ -498,15 +498,17 @@ DWORD __cdecl CharUpperBuffW(const char16* lpsz, DWORD  cchLength);
 #include <stdint.h>
 #endif
 
-
-#if defined(_MSC_VER) && !defined(__clang__)
-// ms-specific keywords
+// MSVC specific keywords
+#if defined(_MSC_VER)
 #define _ABSTRACT abstract
-// MSVC2015 does not support C++11 semantics for `typename QualifiedName` declarations
-// outside of template code.
-#define _TYPENAME
 #else
 #define _ABSTRACT
+#endif
+
+// `typename QualifiedName` declarations outside of template code not supported before MSVC 2015 update 1
+#if defined(_MSC_VER) && _MSC_VER < 1910
+#define _TYPENAME
+#else
 #define _TYPENAME typename
 #endif
 

+ 1 - 1
lib/Common/Core/FaultInjection.cpp

@@ -377,7 +377,7 @@ namespace Js
 
 #define FAULT_TYPE(x) _u(#x),\
 
-    char16 *FaultInjection::FaultTypeNames[] =
+    const char16 *FaultInjection::FaultTypeNames[] =
     {
 #include "FaultTypes.h"
     };

+ 1 - 1
lib/Common/Core/FaultInjection.h

@@ -51,7 +51,7 @@ namespace Js
             bool IsEnabled(const char16* name);
         };
 
-        static char16 *FaultTypeNames[];
+        static const char16 *FaultTypeNames[];
         void ParseFaultTypes(const char16* szFaultTypes);
 
     public:

+ 1 - 1
lib/Common/Core/ProfileMemory.h

@@ -98,7 +98,7 @@ public:
     }
 
 private:
-    int MemoryProfiler::CreateArenaUsageSummary(ArenaAllocator * alloc, bool liveOnly,
+    int CreateArenaUsageSummary(ArenaAllocator * alloc, bool liveOnly,
         _Outptr_result_buffer_(return) LPWSTR ** name_ptr, _Outptr_result_buffer_(return) ArenaMemoryDataSummary *** summaries_ptr);
 
     template<typename THandler>

+ 1 - 1
lib/Common/Memory/SmallFinalizableHeapBlock.cpp

@@ -155,7 +155,7 @@ SmallRecyclerVisitedHostHeapBlockT<TBlockAttributes>::SetAttributes(void * addre
 #ifdef RECYCLER_FINALIZE_CHECK
     if (attributes & FinalizeBit)
     {
-        finalizeCount++;
+        this->finalizeCount++;
         HeapInfo * heapInfo = this->heapBucket->heapInfo;
         heapInfo->liveFinalizableObjectCount++;
         heapInfo->newFinalizableObjectCount++;