[PATCH] D73677: MSVC Buggy version detection: turn pre-processor error into CMake configuration time check

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 17:54:24 PST 2020


mehdi_amini created this revision.
mehdi_amini added a reviewer: aganea.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.
mehdi_amini updated this revision to Diff 241334.
mehdi_amini added a comment.

(Header fix)


mehdi_amini added a comment.

I don't have a windows machine to check if this correctly check the MSVC version, can you check that?


This allows consumer to override in a cleaner way while still prevent
them from hitting bug without knowing they run an unsupported
configuration.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73677

Files:
  llvm/cmake/modules/CheckCompilerVersion.cmake
  llvm/include/llvm/Support/Compiler.h


Index: llvm/include/llvm/Support/Compiler.h
===================================================================
--- llvm/include/llvm/Support/Compiler.h
+++ llvm/include/llvm/Support/Compiler.h
@@ -22,17 +22,6 @@
 #endif
 #include <stddef.h>
 
-#if defined(_MSC_VER)
-#include <sal.h>
-
-#if _MSC_VER == 1924 && !defined(__clang__)
-// See https://developercommunity.visualstudio.com/content/problem/845933/miscompile-boolean-condition-deduced-to-be-always.html
-// and thread "[llvm-dev] Longstanding failing tests - clang-tidy, MachO, Polly"
-// on llvm-dev Jan 21-23 2020.
-#error "MSVC 19.24 (Visual Studio 2019 version 16.4) is known to miscompile LLVM. Please upgrade to version 16.5+ or use clang-cl."
-#endif
-#endif
-
 #ifndef __has_feature
 # define __has_feature(x) 0
 #endif
Index: llvm/cmake/modules/CheckCompilerVersion.cmake
===================================================================
--- llvm/cmake/modules/CheckCompilerVersion.cmake
+++ llvm/cmake/modules/CheckCompilerVersion.cmake
@@ -50,6 +50,18 @@
 check_compiler_version("AppleClang" "Apple Clang" ${APPLECLANG_MIN} ${APPLECLANG_SOFT_ERROR})
 check_compiler_version("MSVC" "Visual Studio" ${MSVC_MIN} ${MSVC_SOFT_ERROR})
 
+# See https://developercommunity.visualstudio.com/content/problem/845933/miscompile-boolean-condition-deduced-to-be-always.html
+# and thread "[llvm-dev] Longstanding failing tests - clang-tidy, MachO, Polly"
+# on llvm-dev Jan 21-23 2020.
+if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 19.24)
+  if(LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN)
+    message(WARNING "Host Visual Studio version 19.24 is known to miscompile part of LLVM")
+  else()
+    message(FATAL_ERROR "Host Visual Studio version 19.24 is known to miscompile part of LLVM (use -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON to ignore)")
+  endif()
+endif()
+
+
 if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
   if (CMAKE_CXX_SIMULATE_ID MATCHES "MSVC")
     if (CMAKE_CXX_SIMULATE_VERSION VERSION_LESS MSVC_MIN)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73677.241334.patch
Type: text/x-patch
Size: 2013 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200130/a0d68592/attachment.bin>


More information about the llvm-commits mailing list