Skip to content

Commit

Permalink
Merge pull request #2223 from joto/iwyu-cleanup
Browse files Browse the repository at this point in the history
Clean up some includes
  • Loading branch information
lonvia authored Aug 15, 2024
2 parents f83b6b5 + 3e4611a commit e63f84b
Show file tree
Hide file tree
Showing 30 changed files with 73 additions and 29 deletions.
8 changes: 6 additions & 2 deletions src/db-copy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
* For a full list of authors see the git log.
*/

#include <cassert>

#include "db-copy.hpp"

#include "format.hpp"
#include "logging.hpp"
#include "pgsql.hpp"

#include <cassert>
#include <cstdlib>
#include <iterator>
#include <stdexcept>

void db_deleter_by_id_t::delete_rows(std::string const &table,
std::string const &column,
pg_conn_t const &db_connection)
Expand Down
7 changes: 4 additions & 3 deletions src/db-copy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
* For a full list of authors see the git log.
*/

#include "osmtypes.hpp"
#include "pgsql.hpp"
#include "pgsql-params.hpp"

#include <cassert>
#include <condition_variable>
#include <deque>
Expand All @@ -22,9 +26,6 @@
#include <variant>
#include <vector>

#include "osmtypes.hpp"
#include "pgsql.hpp"

/**
* Table information necessary for building SQL queries.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/debug-output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#include "debug-output.hpp"

#include "expire-output.hpp"
#include "flex-table.hpp"
#include "logging.hpp"

void write_expire_output_list_to_debug_log(
Expand Down
6 changes: 4 additions & 2 deletions src/debug-output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
* For a full list of authors see the git log.
*/

#include "expire-output.hpp"
#include "flex-table.hpp"
#include <vector>

class expire_output_t;
class flex_table_t;

void write_expire_output_list_to_debug_log(
std::vector<expire_output_t> const &expire_outputs);
Expand Down
1 change: 1 addition & 0 deletions src/expire-output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "pgsql.hpp"
#include "tile.hpp"

#include <cerrno>
#include <system_error>

std::size_t
Expand Down
1 change: 1 addition & 0 deletions src/expire-output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "tile.hpp"

#include <cassert>
#include <cstddef>
#include <cstdint>
#include <string>
#include <utility>
Expand Down
6 changes: 5 additions & 1 deletion src/flex-lua-index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@
*/

#include "flex-lua-index.hpp"

#include "flex-index.hpp"
#include "flex-table.hpp"
#include "format.hpp"
#include "lua-utils.hpp"
#include "output-flex.hpp"
#include "pgsql-capabilities.hpp"
#include "util.hpp"

#include <stdexcept>
#include <string>
#include <vector>

Expand Down
1 change: 0 additions & 1 deletion src/flex-table-column.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "pgsql-capabilities.hpp"
#include "util.hpp"

#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdlib>
Expand Down
3 changes: 3 additions & 0 deletions src/flex-table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@

#include <osmium/osm/item_type.hpp>

#include <cassert>
#include <chrono>
#include <cstddef>
#include <future>
#include <limits>
#include <memory>
#include <string>
Expand Down
5 changes: 4 additions & 1 deletion src/flex-write.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
* For a full list of authors see the git log.
*/

#include "expire-tiles.hpp"
#include "flex-table.hpp"

#include <lua.hpp>

#include <stdexcept>
#include <string>
#include <vector>

class expire_tiles;

class not_null_exception : public std::runtime_error
{
Expand Down
3 changes: 3 additions & 0 deletions src/gen/canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
#include "canvas.hpp"

#include "raster.hpp"
#include "tile.hpp"

#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>

#include <cassert>

void canvas_t::open_close(unsigned int buffer_size)
{
auto const kernel1 = cv::getStructuringElement(
Expand Down
5 changes: 4 additions & 1 deletion src/gen/canvas.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
*/

#include "geom.hpp"
#include "tile.hpp"

#include <opencv2/core.hpp>

#include <cstddef>
#include <string>
#include <vector>

class tile_t;

/**
* This class wraps the image class from the OpenCV library.
Expand Down
2 changes: 2 additions & 0 deletions src/gen/gen-base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include <fmt/args.h>

#include <cassert>

gen_base_t::gen_base_t(pg_conn_t *connection, bool append, params_t *params)
: m_connection(connection), m_params(params), m_append(append)
{
Expand Down
1 change: 1 addition & 0 deletions src/gen/gen-base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <cstdint>
#include <cstdlib>
#include <string>
#include <string_view>
#include <vector>

class params_t;
Expand Down
2 changes: 2 additions & 0 deletions src/gen/gen-create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#include "gen-create.hpp"

#include "format.hpp"
#include "gen-base.hpp"
#include "gen-discrete-isolation.hpp"
#include "gen-rivers.hpp"
#include "gen-tile-builtup.hpp"
Expand Down
3 changes: 1 addition & 2 deletions src/gen/gen-create.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
* For a full list of authors see the git log.
*/

#include "gen-base.hpp"

#include <memory>
#include <string>

class gen_base_t;
class params_t;
class pg_conn_t;

Expand Down
6 changes: 4 additions & 2 deletions src/gen/gen-discrete-isolation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@

#include "gen-discrete-isolation.hpp"

#include "logging.hpp"
#include "params.hpp"
#include "pgsql.hpp"
#include "util.hpp"

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <vector>

gen_di_t::gen_di_t(pg_conn_t *connection, bool append, params_t *params)
Expand Down Expand Up @@ -115,7 +117,7 @@ FROM {src} WHERE {importance_column} > 0
min = dist;
}
}
data[n].di = sqrt(min);
data[n].di = std::sqrt(min);
}
data[0].di = data[1].di + 1;
}
Expand Down
4 changes: 4 additions & 0 deletions src/gen/gen-discrete-isolation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@

#include "gen-base.hpp"

#include <cstddef>
#include <string_view>

class params_t;
class pg_conn_t;

class gen_di_t : public gen_base_t
{
public:
Expand Down
4 changes: 4 additions & 0 deletions src/gen/gen-rivers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@

#include "gen-base.hpp"

#include <cstddef>
#include <string_view>

class params_t;
class pg_conn_t;

class gen_rivers_t : public gen_base_t
{
public:
Expand Down
10 changes: 3 additions & 7 deletions src/gen/osm2pgsql-gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* in the future.
*/

#include "canvas.hpp"
#include "command-line-app.hpp"
#include "debug-output.hpp"
#include "expire-output.hpp"
Expand All @@ -30,7 +29,6 @@
#include "lua-init.hpp"
#include "lua-setup.hpp"
#include "lua-utils.hpp"
#include "options.hpp"
#include "params.hpp"
#include "pgsql-capabilities.hpp"
#include "pgsql.hpp"
Expand All @@ -45,18 +43,16 @@
#include <lua.hpp>

#include <algorithm>
#include <array>
#include <atomic>
#include <cassert>
#include <chrono>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <getopt.h>
#include <limits>
#include <memory>
#include <mutex>
#include <stdexcept>
#include <string>
#include <thread>
#include <vector>

// Lua can't call functions on C++ objects directly. This macro defines simple
// C "trampoline" functions which are called from Lua which get the current
Expand Down
2 changes: 2 additions & 0 deletions src/gen/tracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

#include "tracer.hpp"

#include "canvas.hpp"
#include "geom-boost-adaptor.hpp"
#include "tile.hpp"

#include <cassert>
#include <cmath>
Expand Down
6 changes: 4 additions & 2 deletions src/gen/tracer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
* For a full list of authors see the git log.
*/

#include "canvas.hpp"
#include "geom.hpp"
#include "tile.hpp"

#include <potracelib.h>

#include <cstddef>
#include <memory>
#include <vector>

class canvas_t;
class tile_t;

class tracer_t
{
public:
Expand Down
2 changes: 2 additions & 0 deletions src/geom-box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#include "geom-box.hpp"

#include <variant>

namespace geom {

box_t &box_t::extend(point_t const &point) noexcept
Expand Down
1 change: 1 addition & 0 deletions src/geom-from-osm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <osmium/area/geom_assembler.hpp>
#include <osmium/osm/way.hpp>

#include <cassert>
#include <utility>

namespace geom {
Expand Down
2 changes: 2 additions & 0 deletions src/geom-functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "geom.hpp"
#include "reprojection.hpp"

#include <cassert>
#include <cstddef>
#include <string_view>
#include <utility>
#include <vector>
Expand Down
1 change: 0 additions & 1 deletion src/lua-utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "format.hpp"

#include <cassert>
#include <stdexcept>

// The lua_getextraspace() function is only available from Lua 5.3. For
// earlier versions we fall back to storing the context pointer in the
Expand Down
1 change: 1 addition & 0 deletions src/middle-ram.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <osmium/memory/buffer.hpp>
#include <osmium/osm.hpp>

#include <cassert>
#include <cstddef>
#include <memory>
#include <string>
Expand Down
3 changes: 2 additions & 1 deletion src/node-persistent-cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
#include "node-persistent-cache.hpp"

#include <cassert>
#include <stdexcept>
#include <cerrno>
#include <system_error>
#include <utility>

void node_persistent_cache::set(osmid_t id, osmium::Location location)
{
Expand Down
2 changes: 1 addition & 1 deletion src/osm2pgsql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "output.hpp"
#include "pgsql.hpp"
#include "pgsql-capabilities.hpp"
#include "pgsql-helper.hpp"
#include "properties.hpp"
#include "util.hpp"
#include "version.hpp"
Expand All @@ -26,6 +25,7 @@
#include <exception>
#include <filesystem>
#include <memory>
#include <string>
#include <utility>

namespace {
Expand Down
Loading

0 comments on commit e63f84b

Please sign in to comment.