Enable MSVC standard conformance for JIT sources (#67608)
authorJakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
Wed, 6 Apr 2022 19:32:39 +0000 (21:32 +0200)
committerGitHub <noreply@github.com>
Wed, 6 Apr 2022 19:32:39 +0000 (21:32 +0200)
The JIT sources pretty much already compiled under this mode except for
one thing that could just be fixed by removing the code. This will catch
some obvious bugs, like passing 'false' as a pointer.

src/coreclr/jit/CMakeLists.txt
src/coreclr/jit/unwind.h

index 9a088b2..724a71b 100644 (file)
@@ -11,6 +11,10 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_
   add_compile_options(-Wno-error)
 endif()
 
+if (MSVC)
+  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/permissive->)
+endif()
+
 function(create_standalone_jit)
 
   set(oneValueArgs TARGET OS ARCH)
index c578c30..34a546b 100644 (file)
@@ -79,32 +79,6 @@ protected:
     {
     }
 
-// TODO: How do we get the ability to access uwiComp without error on Clang?
-#if defined(DEBUG) && !defined(__GNUC__)
-
-    template <typename T>
-    T dspPtr(T p)
-    {
-        return uwiComp->dspPtr(p);
-    }
-
-    template <typename T>
-    T dspOffset(T o)
-    {
-        return uwiComp->dspOffset(o);
-    }
-
-    static const char* dspBool(bool b)
-    {
-        return (b) ? "true" : "false";
-    }
-
-#endif // DEBUG
-
-    //
-    // Data
-    //
-
     Compiler* uwiComp;
 };