OSDN Git Service

[benchmark] Disable exceptions in Microsoft STL
authorElizabeth Andrews <elizabeth.andrews@intel.com>
Tue, 6 Nov 2018 15:57:59 +0000 (15:57 +0000)
committerElizabeth Andrews <elizabeth.andrews@intel.com>
Tue, 6 Nov 2018 15:57:59 +0000 (15:57 +0000)
This patch disables exceptions in Microsoft STL when exception
handling is not enabled in Benchmark project. It fixes Windows
builds that were failing due to C4530 warnings thrown by MS STL.

Differential Revision: https://reviews.llvm.org/D52998

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346237 91177308-0d34-0410-b5e6-96231b3b80d8

utils/benchmark/CMakeLists.txt
utils/benchmark/README.LLVM

index 6522ecf..686846b 100644 (file)
@@ -99,6 +99,7 @@ if (MSVC)
   if (NOT BENCHMARK_ENABLE_EXCEPTIONS)
     add_cxx_compiler_flag(-EHs-)
     add_cxx_compiler_flag(-EHa-)
+    add_definitions(-D_HAS_EXCEPTIONS=0)
   endif()
   # Link time optimisation
   if (BENCHMARK_ENABLE_LTO)
index 0121b14..5a20ec6 100644 (file)
@@ -19,3 +19,5 @@ Changes:
   is applied to fix cross compilation with MinGW headers
 * https://github.com/google/benchmark/commit/439d6b1c2a6da5cb6adc4c4dfc555af235722396
   is applied to fix building with MinGW headers for ARM
+* https://github.com/google/benchmark/commit/a9b31c51b1ee7ec7b31438c647123c2cbac5d956
+  is applied to disable exceptions in Microsoft STL when exceptions are disabled