eandrews created this revision.
eandrews added reviewers: rnk, kbobyrev, omtcyfz, lebedev.ri, erichkeane.
Herald added a subscriber: mgorny.

Define _HAS_EXCEPTIONS=0, when compiling benchmark files, to disable exceptions 
in Microsoft STL.

Windows builds were failing due to C4530 warnings (C++ exception handler used, 
but unwind semantics are not enabled) thrown by MSVC standard library.


https://reviews.llvm.org/D52998

Files:
  CMakeLists.txt


Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -1089,7 +1089,8 @@
   set(BENCHMARK_ENABLE_GTEST_TESTS OFF CACHE BOOL "Disable Google Test in 
benchmark" FORCE)
   # Since LLVM requires C++11 it is safe to assume that std::regex is 
available.
   set(HAVE_STD_REGEX ON CACHE BOOL "OK" FORCE)
-
+  # Disable exceptions in Microsoft STL to prevent warnings about exception 
handlers in STL.
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_HAS_EXCEPTIONS=0")
   add_subdirectory(utils/benchmark)
   add_subdirectory(benchmarks)
 endif()


Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -1089,7 +1089,8 @@
   set(BENCHMARK_ENABLE_GTEST_TESTS OFF CACHE BOOL "Disable Google Test in benchmark" FORCE)
   # Since LLVM requires C++11 it is safe to assume that std::regex is available.
   set(HAVE_STD_REGEX ON CACHE BOOL "OK" FORCE)
-
+  # Disable exceptions in Microsoft STL to prevent warnings about exception handlers in STL.
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_HAS_EXCEPTIONS=0")
   add_subdirectory(utils/benchmark)
   add_subdirectory(benchmarks)
 endif()
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to