From 93f2da739449fbc7b146eff1c471947953a8442f Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Thu, 9 Nov 2023 16:41:51 -0600 Subject: [PATCH] Fix hidden visibility win fix test (#557) Signed-off-by: Jose Luis Rivero Signed-off-by: Michael Carroll Co-authored-by: Jose Luis Rivero --- .../gz/common/testing/CMakeTestPaths.hh | 23 ++++--------------- .../include/gz/common/testing/TestPaths.hh | 9 ++++++-- testing/src/CMakeTestPaths.cc | 6 +++++ 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/testing/include/gz/common/testing/CMakeTestPaths.hh b/testing/include/gz/common/testing/CMakeTestPaths.hh index f37b566c2..19fef93f6 100644 --- a/testing/include/gz/common/testing/CMakeTestPaths.hh +++ b/testing/include/gz/common/testing/CMakeTestPaths.hh @@ -28,24 +28,12 @@ namespace gz::common::testing /// /// It is not intended that users will directly construct this, but rather /// utilize the TestPathFactory. - -/// TODO(jrivero) Remove warning disable when bumping MSVC on CI -/// MSVC v16.11.25 complains about the TestPaths class not having a DLL although -/// relevant members of it have visiblity defined: -/// "non dll-interface class 'gz::common::testing::TestPaths' used as base for -/// dll-interface class 'gz::common::testing::CMakeTestPaths'" -/// -/// Workaround on this problems triggers new warnings and suffering and -/// more recent versions of MSVC do not trigger that warning anymore. -/// Conclusion: disable the warning. -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable: 4275) -#endif class GZ_COMMON_TESTING_VISIBLE CMakeTestPaths: public TestPaths { - /// \brief Constructor from TestPaths - public: using TestPaths::TestPaths; + /// \brief Constructor + /// \param[in] _projectSourcePath Path to the root of the project source + public: explicit CMakeTestPaths( + const std::string &_projectSourcePath = kTestingProjectSourceDir); /// \brief Destructor public: ~CMakeTestPaths() override; @@ -57,7 +45,4 @@ class GZ_COMMON_TESTING_VISIBLE CMakeTestPaths: public TestPaths public: bool TestTmpPath(std::string &_tmpDir) override; }; } // namespace gz::common::testing -#ifdef _MSC_VER -# pragma warning( pop ) -#endif #endif // GZ_COMMON_TESTING_CMAKETESTPATHS_HH_ diff --git a/testing/include/gz/common/testing/TestPaths.hh b/testing/include/gz/common/testing/TestPaths.hh index b234a97b5..00f95f52e 100644 --- a/testing/include/gz/common/testing/TestPaths.hh +++ b/testing/include/gz/common/testing/TestPaths.hh @@ -26,6 +26,8 @@ #include "gz/common/testing/Export.hh" +#include + #ifndef TESTING_PROJECT_SOURCE_DIR #define TESTING_PROJECT_SOURCE_DIR "" #endif @@ -53,17 +55,18 @@ enum class GZ_COMMON_TESTING_VISIBLE BuildType kBazel }; + ////////////////////////////////////////////////// /// \brief Helper interface to generate path information to support /// test access to source/data files /// /// It is intended that there is an implementation of this interface for /// each relevant buildsystem. -class TestPaths +class GZ_COMMON_TESTING_VISIBLE TestPaths { /// \brief Constructor /// \param[in] _projectSourcePath Path to the root of the project source - public: explicit GZ_COMMON_TESTING_VISIBLE TestPaths( + public: explicit TestPaths( const std::string &_projectSourcePath = kTestingProjectSourceDir); /// \brief Destructor @@ -79,7 +82,9 @@ class TestPaths /// \return True if path successfully found and set, false otherwise public: virtual bool TestTmpPath(std::string &_tmpDir) = 0; +GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING protected: std::string projectSourcePath; +GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING }; ////////////////////////////////////////////////// diff --git a/testing/src/CMakeTestPaths.cc b/testing/src/CMakeTestPaths.cc index f17d26b89..f0b84250e 100644 --- a/testing/src/CMakeTestPaths.cc +++ b/testing/src/CMakeTestPaths.cc @@ -20,6 +20,12 @@ namespace gz::common::testing { +////////////////////////////////////////////////// +CMakeTestPaths::CMakeTestPaths(const std::string &_projectSourcePath) + : TestPaths(_projectSourcePath) +{ +} + ////////////////////////////////////////////////// CMakeTestPaths::~CMakeTestPaths() = default;