[libFuzzer][MSVC] Disable exceptions in MSVC headers

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
This commit is contained in:
Jonathan Metzman 2019-01-25 01:10:57 +00:00
parent 990f507704
commit 62f1871060
1 changed files with 4 additions and 3 deletions

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