RFR: 8365231: Don't build gtest with /EHsc

Kim Barrett kbarrett at openjdk.org
Thu Aug 14 19:27:11 UTC 2025


On Mon, 11 Aug 2025 09:55:20 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

> According to https://github.com/openjdk/jdk/pull/26661#issuecomment-3162014034, we should not build gtest with `/EHsc`. 
> 
> I can honestly say I don't fully understand the consequences of this change, but at least it passes building and testing on Oracle CI. And it does seem to make sense that we build the gtest version of libjvm as close as possible to the real version. For libgtest I just thought it was prudent to keep the flags in sync with how we build libjvm. This might not be the correct decision.
> 
> I have not tested how or if this affects the ability for gtest to handle bugs or crashes in the JVM, nor do I really have any idea about any such consequences. This PR is opened more to start a discussion than with the intention of just integrating this.

My guess is that MSVC C4530 needs to be disabled when building libgtest even
when we're not enabling exceptions for the same reason that I expected that
warning from our jfr/test_networkUtilization.cpp.

That jfr test includes `<vector>`, and vector::at throws, and that apparently
isn't protected by anything that knows about exceptions being disabled. (At
least, that's the problem I ran into a while ago.) So even if it's never
called, it still triggers the warning.

googletest also includes `<vector>` in a bunch of places, so I'd expect the same
issue there. Again, warnings even though that code is never called.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/26721#issuecomment-3189625063


More information about the build-dev mailing list