[libFuzzer][MSVC] Disable exceptions in MSVC headers
authorJonathan Metzman <metzman@chromium.org>
Fri, 25 Jan 2019 01:10:57 +0000 (01:10 +0000)
committerJonathan Metzman <metzman@chromium.org>
Fri, 25 Jan 2019 01:10:57 +0000 (01:10 +0000)
Summary:
Disable exceptions in MSVC headers using -D_HAS_EXCEPTIONS=0
to silence compiler warning instead of using /Ehsc.

Reviewers: rnk, morehouse, metzman

Reviewed By: rnk, morehouse, metzman

Subscribers: rnk, morehouse, mgorny

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

llvm-svn: 352144

compiler-rt/lib/fuzzer/CMakeLists.txt

index 75d20d39ae7c9b484ede19f71d796ccebb37b496..eaead9ad5b7de37a44534f832165de7ce724d3b8 100644 (file)
@@ -72,9 +72,10 @@ if (CMAKE_CXX_FLAGS MATCHES "fsanitize-coverage")
 endif()
 
 if(MSVC)
-  # Silence warnings with /Ehsc and avoid an error by unecessarily defining
-  # thread_local when it isn't even used on Windows.
-  list(APPEND LIBFUZZER_CFLAGS /EHsc)
+  # Silence warnings by turning off exceptions in MSVC headers and avoid an
+  # error by unecessarily defining thread_local when it isn't even used on
+  # Windows.
+  list(APPEND LIBFUZZER_CFLAGS -D_HAS_EXCEPTIONS=0)
 else()
   if(NOT HAS_THREAD_LOCAL)
     list(APPEND LIBFUZZER_CFLAGS -Dthread_local=__thread)