Fix -Wsubobject-linkage warning (#6243)

* Fix -Wsubobject-linkage warning

Having tk::spline header-only implementation included from
SmallAreaInfillFlowCompensator.hpp makes
SmallAreaInfillFlowCompensator::flowModel have separate (albeit the
same) implementation in each translation unit.

In order to fix this issue, SmallAreaInfillFlowCompensator::flowModel
converted to opaque 'pimpl'

* spline: remove anonymous namespace

Remove outer anonymous namespace from splice.h to make
forward declaration for tk::spline possible.
This commit is contained in:
Dima Buzdyk
2024-08-04 08:48:24 +06:00
committed by GitHub
parent 9ff0e9335f
commit e6ed93f0c6
3 changed files with 9 additions and 21 deletions

View File

@@ -4,25 +4,20 @@
#include "../libslic3r.h"
#include "../PrintConfig.hpp"
#include "../ExtrusionEntity.hpp"
#include "spline/spline.h"
#include <memory>
namespace Slic3r {
namespace tk {
class spline;
} // namespace tk
#ifndef _WIN32
// Currently on Linux/macOS, this class spits out large amounts of subobject linkage
// warnings because of the flowModel field. tk::spline is in an anonymous namespace which
// causes this issue. Until the issue can be solved, this is a temporary solution.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsubobject-linkage"
#endif
namespace Slic3r {
class SmallAreaInfillFlowCompensator
{
public:
SmallAreaInfillFlowCompensator() = delete;
explicit SmallAreaInfillFlowCompensator(const Slic3r::GCodeConfig& config);
~SmallAreaInfillFlowCompensator() = default;
~SmallAreaInfillFlowCompensator();
double modify_flow(const double line_length, const double dE, const ExtrusionRole role);
@@ -39,10 +34,6 @@ private:
double max_modified_length() { return eLengths.back(); }
};
#ifndef _WIN32
#pragma GCC diagnostic pop
#endif
} // namespace Slic3r
#endif /* slic3r_GCode_SmallAreaInfillFlowCompensator_hpp_ */