Some refactoring and cleanup (#1806)

* Use clang-tidy `misc-include-cleaner` for IWYU `#include` cleanup

* Use `std::optional<size_t>` instead of `ssize_t`

* Rename some functions in linkdefs.hpp

* Fix header order
This commit is contained in:
Rangi
2025-08-20 16:09:04 -04:00
committed by GitHub
parent 92ed6ece53
commit 3d155d5695
63 changed files with 271 additions and 118 deletions

View File

@@ -3,6 +3,10 @@
#include "gfx/color_set.hpp"
#include <algorithm>
#include <iterator>
#include <stdint.h>
#include <stdlib.h>
#include <utility>
#include "helpers.hpp"

View File

@@ -4,10 +4,11 @@
#include <algorithm>
#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
#include <ios>
#include <limits>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -17,6 +18,7 @@
#include "diagnostics.hpp"
#include "extern/getopt.hpp"
#include "file.hpp"
#include "helpers.hpp"
#include "platform.hpp"
#include "style.hpp"
#include "usage.hpp"
@@ -27,6 +29,7 @@
#include "gfx/pal_spec.hpp"
#include "gfx/process.hpp"
#include "gfx/reverse.hpp"
#include "gfx/rgba.hpp"
#include "gfx/warning.hpp"
using namespace std::literals::string_view_literals;

View File

@@ -5,15 +5,19 @@
#include <algorithm>
#include <deque>
#include <inttypes.h>
#include <iterator>
#include <numeric>
#include <optional>
#include <queue>
#include <stdint.h>
#include <stdio.h>
#include <type_traits>
#include <unordered_set>
#include <utility>
#include <vector>
#include "helpers.hpp"
#include "style.hpp"
#include "verbosity.hpp"
#include "gfx/color_set.hpp"

View File

@@ -3,11 +3,16 @@
#include "gfx/pal_sorting.hpp"
#include <algorithm>
#include <array>
#include <optional>
#include <stdint.h>
#include <vector>
#include "helpers.hpp"
#include "verbosity.hpp"
#include "gfx/main.hpp"
#include "gfx/rgba.hpp"
void sortIndexed(std::vector<Palette> &palettes, std::vector<Rgba> const &embPal) {
verbosePrint(VERB_NOTICE, "Sorting palettes using embedded palette...\n");

View File

@@ -3,19 +3,20 @@
#include "gfx/pal_spec.hpp"
#include <algorithm>
#include <array>
#include <charconv>
#include <errno.h>
#include <fstream>
#include <inttypes.h>
#include <limits.h>
#include <ios>
#include <optional>
#include <stdint.h>
#include <stdio.h>
#include <streambuf>
#include <string.h>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "diagnostics.hpp"
#include "helpers.hpp"
@@ -24,6 +25,7 @@
#include "gfx/main.hpp"
#include "gfx/png.hpp"
#include "gfx/rgba.hpp"
#include "gfx/warning.hpp"
using namespace std::string_view_literals;

View File

@@ -2,11 +2,23 @@
#include "gfx/png.hpp"
#include <array>
#include <errno.h>
#include <inttypes.h>
#include <ios>
#include <png.h>
#include <pngconf.h>
#include <stdint.h>
#include <stdio.h>
#include <streambuf>
#include <string.h>
#include <vector>
#include "diagnostics.hpp"
#include "helpers.hpp"
#include "style.hpp"
#include "verbosity.hpp"
#include "gfx/main.hpp"
#include "gfx/rgba.hpp"
#include "gfx/warning.hpp"

View File

@@ -3,13 +3,17 @@
#include "gfx/process.hpp"
#include <algorithm>
#include <array>
#include <errno.h>
#include <inttypes.h>
#include <ios>
#include <optional>
#include <png.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_set>
#include <utility>
#include <vector>
@@ -18,6 +22,7 @@
#include "file.hpp"
#include "helpers.hpp"
#include "itertools.hpp"
#include "style.hpp"
#include "verbosity.hpp"
#include "gfx/color_set.hpp"
@@ -25,6 +30,7 @@
#include "gfx/pal_packing.hpp"
#include "gfx/pal_sorting.hpp"
#include "gfx/png.hpp"
#include "gfx/rgba.hpp"
#include "gfx/warning.hpp"
static bool isBgColorTransparent() {
@@ -610,7 +616,7 @@ public:
template<>
struct std::hash<TileData> {
std::size_t operator()(TileData const &tile) const { return tile.hash(); }
size_t operator()(TileData const &tile) const { return tile.hash(); }
};
static void outputUnoptimizedTileData(

View File

@@ -6,10 +6,16 @@
#include <array>
#include <errno.h>
#include <inttypes.h>
#include <ios>
#include <math.h>
#include <optional>
#include <png.h>
#include <pngconf.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
#include "diagnostics.hpp"
@@ -18,6 +24,7 @@
#include "verbosity.hpp"
#include "gfx/main.hpp"
#include "gfx/rgba.hpp"
#include "gfx/warning.hpp"
static std::vector<uint8_t> readInto(std::string const &path) {

View File

@@ -3,6 +3,7 @@
#include "gfx/rgba.hpp"
#include <algorithm>
#include <array>
#include <math.h>
#include <stdint.h>

View File

@@ -2,11 +2,12 @@
#include "gfx/warning.hpp"
#include <inttypes.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "diagnostics.hpp"
#include "style.hpp"
// clang-format off: nested initializers