Disable exceptions in MSVC headers using -D_HAS_EXCEPTIONS=0
to silence compiler warning instead of using /Ehsc.
Details
Diff Detail
- Repository
- rCRT Compiler Runtime
Event Timeline
Hm, I can't find fno-exceptions anywhere in the libfuzzer cmake files, so I'm questioning my original assumption that this code is supposed to have exceptions disabled. If libfuzzer is supposed to have exceptions enabled, we should leave /EHsc in place as is.
Maybe Matt knows the answer to this?
AFAIK though, libFuzzer doesn't use exceptions.
Would there be a reason to allow exceptions even though one isn't using them?
libFuzzer doesn't disable exceptions itself, but the private libc++ it builds has exceptions disabled. So this should be fine for MSVC STL.
I'm a bit curious about the root causes of this patch - is it for builds with MS STL or libc++, and what were the actual issues it was trying to fix? I'm getting mixed signals from the comments in the discussion thread above.
As things stand right now, the -D_HAS_EXCEPTIONS=0 option breaks libc++ when it runs on top of vcruntime, see D103947 for a fix for that and for discussion whether this is a setup that libc++ wants to commit to supporting.