On Thu, 14 Aug 2025 14:06:07 GMT, Thomas Stuefe <stu...@openjdk.org> wrote:

> googletest uses C++ exceptions:
> 
> ```
> thomas@starfish:/shared/projects/openjdk/gtest/googletest-1.14.0$ ack 'throw 
> [a-zA-Z]' | wc -l
> 68

That just says there is source code that could potentially use exceptions, 
depending on configuration.
It doesn't mean they are used if configured to be disabled.  After all, there's 
`GTEST_HAS_EXCEPTIONS`.
And spot-checking some of the uses of `throw`, they are appropriately protected 
by that macro.

So as long as the macro is set properly...

If not explicitly set, it gets auto-set to 1 for `defined(_MSC_VER) && 
defined(_CPPUNWIND)`
with a comment saying the latter is set iff exceptions are enabled. And that 
seems true according to
https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170
"_CPPUNWIND Defined as 1 if one or more of the [/GX (Enable Exception 
Handling)](https://learn.microsoft.com/en-us/cpp/build/reference/gx-enable-exception-handling?view=msvc-170),
 [/clr (Common Language Runtime 
Compilation)](https://learn.microsoft.com/en-us/cpp/build/reference/clr-common-language-runtime-compilation?view=msvc-170),
 or [/EH (Exception Handling 
Model)](https://learn.microsoft.com/en-us/cpp/build/reference/eh-exception-handling-model?view=msvc-170)
 compiler options are set. Otherwise, undefined."

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

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

Reply via email to