From ed2fe122f8dc9aca844d724986d1d5cf5b65ea4e Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Tue, 12 Feb 2019 16:35:38 -0800 Subject: [PATCH] Fix -Wunused-private-field issues with clang Provide dummy accessors for private values that are set in initializers, but not actually used. Signed-off-by: Enji Cooper --- googlemock/test/gmock-matchers_test.cc | 2 ++ googletest/test/googletest-param-test-test.cc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index c2f1d0ad..cdca2300 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -982,6 +982,8 @@ class Unprintable { Unprintable() : c_('a') {} bool operator==(const Unprintable& /* rhs */) const { return true; } + // -Wunused-private-field: dummy accessor for `c_`. + char dummy_c() { return c_; } private: char c_; }; diff --git a/googletest/test/googletest-param-test-test.cc b/googletest/test/googletest-param-test-test.cc index 2ab9b1ba..6c187dff 100644 --- a/googletest/test/googletest-param-test-test.cc +++ b/googletest/test/googletest-param-test-test.cc @@ -964,6 +964,8 @@ INSTANTIATE_TEST_SUITE_P(StatefulNamingFunctor, StatefulNamingTest, Range(0, 5), class Unstreamable { public: explicit Unstreamable(int value) : value_(value) {} + // -Wunused-private-field: dummy accessor for `value_`. + const int& dummy_value() const { return value_; } private: int value_;