Make prototypes static for autoclear unit test

With the explicit prototypes not marked as static unit test builds on Debian
Buster (using buster-backports) fail with

error: testing::internal::ParamGenerator<TestCase*> gtest_InstantiationAutoClearTestAutoClearTest_EvalGenerator_() was declared extern and later static [-fpermissive]

According to the comment preceding the declaration the only intent of the
explicit prototype (in newer versions of googletest implicitly defined by the
GTEST macros) seems to be to silence a warning which would cause a build
failure on Ubuntu 18.04 when using -Werror.

Builds on Debian unstable seem to build just fine without this explicit
declaration, hence I consider it safe to just drop it. However, builds on
Ubuntu 18.04 then fail (see above).

Making the prototypes as static should make both build environments happy.
This commit is contained in:
Micha Lenk 2021-01-16 15:30:07 +01:00 committed by John Ralls
parent fa1be8f375
commit 9386b276e5

View File

@ -157,9 +157,9 @@ TEST_P(AutoClearTest, DoesAutoClear) {
}
#ifndef INSTANTIATE_TEST_SUITE_P
// Silence "no previous declaration for" which is treated as error, due to -Werror
testing::internal::ParamGenerator<TestCase*> gtest_InstantiationAutoClearTestAutoClearTest_EvalGenerator_();
std::string gtest_InstantiationAutoClearTestAutoClearTest_EvalGenerateName_(const testing::TestParamInfo<TestCase*>&);
// Silence "no previous declaration for" (treated as error due to -Werror) when building with GoogleTest < 1.8.1
static testing::internal::ParamGenerator<TestCase*> gtest_InstantiationAutoClearTestAutoClearTest_EvalGenerator_();
static std::string gtest_InstantiationAutoClearTestAutoClearTest_EvalGenerateName_(const testing::TestParamInfo<TestCase*>&);
INSTANTIATE_TEST_CASE_P(
#else // INSTANTIATE_TEST_SUITE_P