Skip to content

Commit

Permalink
Fix hidden visibility win fix test (#557)
Browse files Browse the repository at this point in the history
Signed-off-by: Jose Luis Rivero <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
Co-authored-by: Jose Luis Rivero <[email protected]>
  • Loading branch information
mjcarroll and j-rivero authored Nov 9, 2023
1 parent 34455da commit 93f2da7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
23 changes: 4 additions & 19 deletions testing/include/gz/common/testing/CMakeTestPaths.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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_
9 changes: 7 additions & 2 deletions testing/include/gz/common/testing/TestPaths.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

#include "gz/common/testing/Export.hh"

#include <gz/utils/SuppressWarning.hh>

#ifndef TESTING_PROJECT_SOURCE_DIR
#define TESTING_PROJECT_SOURCE_DIR ""
#endif
Expand Down Expand Up @@ -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
Expand All @@ -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
};

//////////////////////////////////////////////////
Expand Down
6 changes: 6 additions & 0 deletions testing/src/CMakeTestPaths.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
namespace gz::common::testing
{

//////////////////////////////////////////////////
CMakeTestPaths::CMakeTestPaths(const std::string &_projectSourcePath)
: TestPaths(_projectSourcePath)
{
}

//////////////////////////////////////////////////
CMakeTestPaths::~CMakeTestPaths() = default;

Expand Down

0 comments on commit 93f2da7

Please sign in to comment.