diff options
author | Gennadiy Civil <misterg@google.com> | 2018-03-05 17:26:15 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2018-03-05 17:26:15 (GMT) |
commit | 0d5e01ad7bf0796679417e3acdb0418f5b19fc31 (patch) | |
tree | e57159c96b66be5596ed3c7d4c12618fc3380b9e /googletest/include | |
parent | 447d58b4ee8ea96b4757a5bb5f0b3be75af6c2a1 (diff) | |
download | googletest-0d5e01ad7bf0796679417e3acdb0418f5b19fc31.zip googletest-0d5e01ad7bf0796679417e3acdb0418f5b19fc31.tar.gz googletest-0d5e01ad7bf0796679417e3acdb0418f5b19fc31.tar.bz2 |
Merges-1
Diffstat (limited to 'googletest/include')
-rw-r--r-- | googletest/include/gtest/internal/gtest-death-test-internal.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/googletest/include/gtest/internal/gtest-death-test-internal.h b/googletest/include/gtest/internal/gtest-death-test-internal.h index a9e6610..88e7799 100644 --- a/googletest/include/gtest/internal/gtest-death-test-internal.h +++ b/googletest/include/gtest/internal/gtest-death-test-internal.h @@ -217,14 +217,18 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status); // can be streamed. // This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in -// NDEBUG mode. In this case we need the statements to be executed, the regex is -// ignored, and the macro must accept a streamed message even though the message -// is never printed. -# define GTEST_EXECUTE_STATEMENT_(statement, regex) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::AlwaysTrue()) { \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ - } else \ +// NDEBUG mode. In this case we need the statements to be executed and the macro +// must accept a streamed message even though the message is never printed. +// The regex object is not evaluated, but it is used to prevent "unused" +// warnings and to avoid an expression that doesn't compile in debug mode. +#define GTEST_EXECUTE_STATEMENT_(statement, regex) \ + GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ + if (::testing::internal::AlwaysTrue()) { \ + GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ + } else if (!::testing::internal::AlwaysTrue()) { \ + const ::testing::internal::RE& gtest_regex = (regex); \ + static_cast<void>(gtest_regex); \ + } else \ ::testing::Message() // A class representing the parsed contents of the |