Remove Unused Project Includes and Forward-Declare Where a Type Is Only Referenced

Generated with include-what-you-use and applied conservatively. Only OrcaSlicer's own headers, the ones under src/ and tests/, are removed or forward-declared; standard-library and third-party includes are left alone. An include is removed only when both the Release and the Debug configuration leave it unused, never from inside a conditional block, and never from a file with platform-specific blocks, which only gain includes. Files whose only use of a header sits behind a feature or debug macro (libvgcode's OpenGL ES and marker code, the ARACHNE/TESTS_EXPORT_SVGS debug output) keep their includes.

clonable_ptr.hpp gains #pragma once; it had no include guard and was only safe while Config.hpp was its sole includer.
This commit is contained in:
Hanif Koh committed 2026-10-05 11:02:06 +08:00
1 parent f3d0b8a553
commit e540bbcf35
562 files changed
+1420 -560

No files matched your search

-1
View File
@@ -1,4 +1,3 @@
#include "libslic3r/libslic3r.h"
#define NANOSVG_IMPLEMENTATION
#include "nanosvg/nanosvg.h"
#define NANOSVGRAST_IMPLEMENTATION
+2 -1
View File
@@ -11,8 +11,9 @@
#include "libslic3r/ExtrusionEntity.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Line.hpp"
#include "libslic3r/Polyline.hpp"
#include "test_helpers.hpp"
using namespace Slic3r;
@@ -32,6 +32,7 @@
#include <string>
#include <string_view>
#include <vector>
#include <catch2/interfaces/catch_interfaces_capture.hpp>
using namespace Slic3r;
using namespace Slic3r::Test;
-3
View File
@@ -9,9 +9,6 @@
#include "test_helpers.hpp" // get access to init_print, etc
#include "libslic3r/Config.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/Config.hpp"
#include "libslic3r/GCodeReader.hpp"
#include "libslic3r/Flow.hpp"
#include "libslic3r/libslic3r.h"
+3 -2
View File
@@ -4,7 +4,6 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers.hpp>
#include <catch2/catch_message.hpp>
#include "libslic3r/libslic3r.h"
#include "libslic3r/GCode/GCodeProcessor.hpp"
#include "libslic3r/MultiNozzleUtils.hpp"
#include "libslic3r/PrintConfig.hpp"
@@ -15,7 +14,6 @@
#include <cstddef>
#include <fstream>
#include <iomanip>
#include "libslic3r/ExtrusionEntity.hpp"
#include <ios>
#include <map>
#include <math.h>
@@ -23,6 +21,9 @@
#include <sstream>
#include <string>
#include <vector>
#include "libslic3r/Config.hpp"
namespace Slic3r { enum ExtrusionRole : uint8_t; }
using namespace Slic3r;
using Catch::Matchers::WithinAbs;
+1
View File
@@ -36,6 +36,7 @@
#include <boost/filesystem.hpp>
#include "test_helpers.hpp"
#include "libslic3r/Arrange.hpp"
using namespace Slic3r;
using namespace Slic3r::Test;
+8 -2
View File
@@ -5,8 +5,6 @@
#include "libslic3r/GCodeReader.hpp"
#include "libslic3r/Config.hpp"
#include "libslic3r/Print.hpp"
#include "libslic3r/Format/OBJ.hpp"
#include "libslic3r/Format/STL.hpp"
#include <algorithm>
#include <cstdlib>
@@ -488,6 +486,14 @@ std::vector<std::string> role_sequence(const std::string &gcode, const std::vect
} } // namespace Slic3r::Test
#include <catch2/catch_all.hpp>
#include "libslic3r/Arrange.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/Arrange.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/Arrange.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/Arrange.hpp"
#include "libslic3r/Model.hpp"
SCENARIO("init_print functionality", "[test_helpers]") {
GIVEN("A default config") {
+2
View File
@@ -15,6 +15,8 @@
#include "test_helpers.hpp"
#include "test_utils.hpp"
#include "libslic3r/Arrange.hpp"
#include "libslic3r/Print.hpp"
using namespace Slic3r;
using namespace Slic3r::Test;
+3
View File
@@ -43,6 +43,9 @@
#include <string_view>
#include <utility>
#include <vector>
#include "libslic3r/ObjectID.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/SurfaceCollection.hpp"
using namespace Slic3r;
using namespace Slic3r::Test;
+3
View File
@@ -35,6 +35,9 @@
#include <string>
#include <utility>
#include <vector>
#include "libslic3r/ExPolygon.hpp"
#include "libslic3r/ExtrusionEntityCollection.hpp"
#include "libslic3r/SurfaceCollection.hpp"
using namespace Slic3r;
using namespace Slic3r::Test;
+4
View File
@@ -22,6 +22,10 @@
#include "libslic3r/ExtrusionEntity.hpp"
#include "libslic3r/Polyline.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/BoundingBox.hpp"
#include "libslic3r/ExtrusionEntityCollection.hpp"
#include "libslic3r/ObjectID.hpp"
#include "libslic3r/Print.hpp"
using namespace Slic3r;
+6 -1
View File
@@ -7,7 +7,6 @@
#include <catch2/matchers/catch_matchers.hpp>
#include <catch2/matchers/catch_matchers_floating_point.hpp>
#include "libslic3r/GCodeReader.hpp"
#include "libslic3r/Config.hpp"
#include "libslic3r/Geometry.hpp"
#include "libslic3r/Geometry/ConvexHull.hpp"
#include "libslic3r/Layer.hpp"
@@ -27,6 +26,12 @@
#include <string_view>
#include "test_helpers.hpp" // get access to init_print, etc
#include "libslic3r/BoundingBox.hpp"
#include "libslic3r/BrimEarsPoint.hpp"
#include "libslic3r/ExPolygon.hpp"
#include "libslic3r/ExtrusionEntityCollection.hpp"
#include "libslic3r/ObjectID.hpp"
#include "libslic3r/Print.hpp"
using namespace Slic3r::Test;
using namespace Slic3r;
@@ -496,6 +496,9 @@ TEST_CASE("refreshing lslices after a slice mutation makes islands track the geo
}
#include <random> // deterministic RNG for the fuzzy-skin analogue below
#include "libslic3r/ExPolygon.hpp"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/SurfaceCollection.hpp"
// Fuzzy skin applied to the slice contours at the Slice boundary, matching what the Fuzzy
// Slices sample (sandboxes/orca_fuzzy_slices_plugin_any.py) does: resample every ring at
@@ -30,6 +30,8 @@
// Not self-contained: its inline constructor uses PrintObject, PrintRegion, SlicingParameters and
// Geometry, so it must follow the headers (pulled in via test_helpers.hpp) that define them.
#include "libslic3r/Support/SupportParameters.hpp"
#include "libslic3r/Config.hpp"
#include "libslic3r/Print.hpp"
using namespace Slic3r::Test;
using namespace Slic3r;
@@ -24,6 +24,7 @@
#include "libslic3r/TriangleSelector.hpp"
#include "test_helpers.hpp"
#include "libslic3r/TriangleMesh.hpp"
using namespace Slic3r;
using namespace Slic3r::Test;
+2
View File
@@ -14,6 +14,8 @@
#include "libslic3r/TriangleMesh.hpp"
#include "test_helpers.hpp"
#include "libslic3r/ExtrusionEntityCollection.hpp"
#include "libslic3r/Print.hpp"
using namespace Slic3r::Test;
using namespace Slic3r;
+2 -3
View File
@@ -4,8 +4,6 @@
#include "libslic3r/TriangleMesh.hpp"
#include "libslic3r/TriangleMeshSlicer.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/Config.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/libslic3r.h"
#include <algorithm>
@@ -17,9 +15,10 @@
#include <vector>
#include <math.h>
#include "libslic3r/ExPolygon.hpp"
#include "libslic3r/BoundingBox.hpp"
#include "libslic3r/MultiMaterialSegmentation.hpp"
//#include "test_options.hpp"
#include "test_helpers.hpp"
using namespace Slic3r;
using namespace std;
+1
View File
@@ -29,6 +29,7 @@
#include "libslic3r/Layer.hpp"
#include "test_helpers.hpp"
#include "libslic3r/Polyline.hpp"
using namespace Slic3r;
using namespace Slic3r::Test;
+2
View File
@@ -25,6 +25,8 @@
#include "libslic3r/PrintConfig.hpp"
#include "test_helpers.hpp"
#include "libslic3r/PrintBase.hpp"
#include "libslic3r/TriangleMesh.hpp"
using namespace Slic3r;
using namespace Slic3r::Test;