[benchmark] Disable exceptions in Microsoft STL

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

llvm-svn: 346237
This commit is contained in:
Elizabeth Andrews 2018-11-06 15:57:59 +00:00
parent a166d19d93
commit b3fbba6d15
2 changed files with 3 additions and 0 deletions

View File

@ -99,6 +99,7 @@ if (MSVC)
if (NOT BENCHMARK_ENABLE_EXCEPTIONS) if (NOT BENCHMARK_ENABLE_EXCEPTIONS)
add_cxx_compiler_flag(-EHs-) add_cxx_compiler_flag(-EHs-)
add_cxx_compiler_flag(-EHa-) add_cxx_compiler_flag(-EHa-)
add_definitions(-D_HAS_EXCEPTIONS=0)
endif() endif()
# Link time optimisation # Link time optimisation
if (BENCHMARK_ENABLE_LTO) if (BENCHMARK_ENABLE_LTO)

View File

@ -19,3 +19,5 @@ Changes:
is applied to fix cross compilation with MinGW headers is applied to fix cross compilation with MinGW headers
* https://github.com/google/benchmark/commit/439d6b1c2a6da5cb6adc4c4dfc555af235722396 * https://github.com/google/benchmark/commit/439d6b1c2a6da5cb6adc4c4dfc555af235722396
is applied to fix building with MinGW headers for ARM 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