On Fri, 15 Aug 2025 06:45:35 GMT, Julian Waters <jwat...@openjdk.org> wrote:
>>> But `-fno-exceptions` _is_ used for gcc (and probably for clang, though >>> I've not checked). Verified by examination of ".o.cmdline" files for both >>> libgtest and the HotSpot gtests. >> >> Oh, and once again, thank you thank you thank you for the ".o.cmdline" files! > >> But `-fno-exceptions` _is_ used for gcc > > -fno-exceptions to my knowledge is only set in TOOLCHAIN_CFLAGS_JVM and for > adlc compiled for Linux. That must mean gtest uses the same flags that the > regular JVM does. I was not aware of that, so that would make my previous > statement incorrect. > > I feel uncomfortable about switching off this warning. I agree with > > @TheShermanTanker there. Seems to me that if the compiler warns me that I > > should enable exceptions, I should do that instead of disabling the warning? > > As Kim wrote, this seems to be about a bug in the compiler. If you include > certain standard headers (`<ostream>`), the compiler will give this warning, > regardless if you use any functions from the header or not, if you compile > with exceptions disabled. > > Our normal libjvm is compiled with exceptions disabled. It makes sense to run > tests on a build that is as close as possible to the real thing, so we should > compile libjvm for gtest with exceptions disabled, too. Okay, so we switch the risk of mismatched tests (since we are compiled with a different setting than the production JVM) with the risk of strange errors should we accidentally trigger C++ exceptions in the googletest framework or in system libraries used by it. I guess I can see the logic. Okay. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26721#issuecomment-3191577136