From 9386b276e5faaf692b33e757f86acbdbf8eb2f5c Mon Sep 17 00:00:00 2001 From: Micha Lenk Date: Sat, 16 Jan 2021 15:30:07 +0100 Subject: [PATCH] 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 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. --- libgnucash/app-utils/test/test-autoclear.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libgnucash/app-utils/test/test-autoclear.cpp b/libgnucash/app-utils/test/test-autoclear.cpp index abb84e1c56..92b6d7404f 100644 --- a/libgnucash/app-utils/test/test-autoclear.cpp +++ b/libgnucash/app-utils/test/test-autoclear.cpp @@ -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 gtest_InstantiationAutoClearTestAutoClearTest_EvalGenerator_(); -std::string gtest_InstantiationAutoClearTestAutoClearTest_EvalGenerateName_(const testing::TestParamInfo&); +// Silence "no previous declaration for" (treated as error due to -Werror) when building with GoogleTest < 1.8.1 +static testing::internal::ParamGenerator gtest_InstantiationAutoClearTestAutoClearTest_EvalGenerator_(); +static std::string gtest_InstantiationAutoClearTestAutoClearTest_EvalGenerateName_(const testing::TestParamInfo&); INSTANTIATE_TEST_CASE_P( #else // INSTANTIATE_TEST_SUITE_P