Skip to content

Commit 4408a02

Browse files
Abseil Teamcopybara-github
Abseil Team
authored andcommitted
Remove incorrect usage of GTEST_ATTRIBUTE_UNUSED_ on classes.
Fixes: #4054 PiperOrigin-RevId: 488721587 Change-Id: I8742d8475376635c83edcf524796a6107042e89b
1 parent 0e6aac2 commit 4408a02

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

googletest/include/gtest/gtest.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,9 +2075,7 @@ class GTEST_API_ ScopedTrace {
20752075

20762076
ScopedTrace(const ScopedTrace&) = delete;
20772077
ScopedTrace& operator=(const ScopedTrace&) = delete;
2078-
} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
2079-
// c'tor and d'tor. Therefore it doesn't
2080-
// need to be used otherwise.
2078+
};
20812079

20822080
// Causes a trace (including the source file path, the current line
20832081
// number, and the given message) to be included in every test failure

googletest/include/gtest/internal/gtest-death-test-internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class GTEST_API_ DeathTest {
9999
DeathTest* const test_;
100100
ReturnSentinel(const ReturnSentinel&) = delete;
101101
ReturnSentinel& operator=(const ReturnSentinel&) = delete;
102-
} GTEST_ATTRIBUTE_UNUSED_;
102+
};
103103

104104
// An enumeration of possible roles that may be taken when a death
105105
// test is encountered. EXECUTE means that the death test logic should

googletest/include/gtest/internal/gtest-port.h

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -668,17 +668,11 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
668668
#define GTEST_HAVE_FEATURE_(x) 0
669669
#endif
670670

671-
// Use this annotation at the end of a struct/class definition to
672-
// prevent the compiler from optimizing away instances that are never
673-
// used. This is useful when all interesting logic happens inside the
674-
// c'tor and / or d'tor. Example:
675-
//
676-
// struct Foo {
677-
// Foo() { ... }
678-
// } GTEST_ATTRIBUTE_UNUSED_;
679-
//
680-
// Also use it after a variable or parameter declaration to tell the
671+
// Use this annotation after a variable or parameter declaration to tell the
681672
// compiler the variable/parameter does not have to be used.
673+
// Example:
674+
//
675+
// GTEST_ATTRIBUTE_UNUSED_ int foo = bar();
682676
#if GTEST_HAVE_ATTRIBUTE_(unused)
683677
#define GTEST_ATTRIBUTE_UNUSED_ __attribute__((unused))
684678
#else

googletest/src/gtest-internal-inl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class GTestFlagSaver {
212212
int32_t stack_trace_depth_;
213213
std::string stream_result_to_;
214214
bool throw_on_failure_;
215-
} GTEST_ATTRIBUTE_UNUSED_;
215+
};
216216

217217
// Converts a Unicode code point to a narrow string in UTF-8 encoding.
218218
// code_point parameter is of type UInt32 because wchar_t may not be

0 commit comments

Comments
 (0)