aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCopybara-Service <copybara-worker@google.com>2023-07-18 10:18:14 -0700
committerCopybara-Service <copybara-worker@google.com>2023-07-18 10:18:14 -0700
commitd66ce585109eed6d2d891b7ed7ab3ca96e854483 (patch)
tree65081dcb60319ed593da958e768e5458a660b26d
parentc541e7c11044b1e0303103ef8a47d7a9632c479b (diff)
parentc88e0b4673f9b08818e0e74c4ed718db5f9b809c (diff)
downloadgoogletest-d66ce585109eed6d2d891b7ed7ab3ca96e854483.tar.gz
Merge pull request #4313 from kimvaleen:main
PiperOrigin-RevId: 549039222 Change-Id: I96bea310beede5ba0ed6160155251ffd9d7a2103
-rw-r--r--googletest/include/gtest/gtest.h4
-rw-r--r--googletest/include/gtest/internal/gtest-internal.h27
2 files changed, 16 insertions, 15 deletions
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h
index 86777c85..de7d528f 100644
--- a/googletest/include/gtest/gtest.h
+++ b/googletest/include/gtest/gtest.h
@@ -2101,8 +2101,8 @@ class GTEST_API_ ScopedTrace {
// Assuming that each thread maintains its own stack of traces.
// Therefore, a SCOPED_TRACE() would (correctly) only affect the
// assertions in its own thread.
-#define SCOPED_TRACE(message) \
- ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)( \
+#define SCOPED_TRACE(message) \
+ const ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)( \
__FILE__, __LINE__, (message))
// Compile-time assertion for type equality.
diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h
index 317894e7..a04a9201 100644
--- a/googletest/include/gtest/internal/gtest-internal.h
+++ b/googletest/include/gtest/internal/gtest-internal.h
@@ -1497,19 +1497,20 @@ class NeverThrown {
gtest_ar_, text, #actual, #expected) \
.c_str())
-#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__) \
- : fail("Expected: " #statement \
- " doesn't generate new fatal " \
- "failures in the current thread.\n" \
+#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+ if (::testing::internal::AlwaysTrue()) { \
+ const ::testing::internal::HasNewFatalFailureHelper \
+ gtest_fatal_failure_checker; \
+ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
+ if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
+ goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
+ } \
+ } else /* NOLINT */ \
+ GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__) \
+ : fail("Expected: " #statement \
+ " doesn't generate new fatal " \
+ "failures in the current thread.\n" \
" Actual: it does.")
// Expands to the name of the class that implements the given test.