[PATCH] D52998: [benchmark] Disable exceptions in Microsoft STL

Elizabeth Andrews via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 8 13:54:27 PDT 2018


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()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52998.168706.patch
Type: text/x-patch
Size: 612 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181008/8903c05c/attachment-0001.bin>


More information about the cfe-commits mailing list