Skip to content

Commit

Permalink
Apply iwyu recommendations to utility/
Browse files Browse the repository at this point in the history
include-what-you-use is a tool to sanitize includes in order to maximize
independence between headers and increase compilation speed by reducing their
size. This patch applies IWYU recommendations to utility/ and fixes the build
in other files (they were often relying on transitive includes).
  • Loading branch information
lmoureaux authored and jwrober committed Jan 6, 2024
1 parent 134b076 commit 5bd9681
Show file tree
Hide file tree
Showing 59 changed files with 116 additions and 92 deletions.
2 changes: 2 additions & 0 deletions ai/default/aiplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "city.h"
#include "game.h"
#include "multipliers.h"
#include "registry_ini.h"

// server
#include "citytools.h"

Expand Down
5 changes: 1 addition & 4 deletions ai/default/aiunit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@
#include "bitvector.h"
#include "rand.h"
#include "registry.h"
#include "shared.h"
#include "timing.h"
#include "registry_ini.h"

// common
#include "city.h"
#include "combat.h"
#include "game.h"
#include "government.h"
#include "map.h"
#include "movement.h"
#include "nation.h"
#include "packets.h"
#include "specialist.h"
#include "traderoutes.h"
#include "unit.h"
Expand Down
1 change: 1 addition & 0 deletions ai/default/daicity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// utility
#include "rand.h"
#include "registry.h"
#include "registry_ini.h"

// common
#include "actions.h"
Expand Down
1 change: 1 addition & 0 deletions client/audio/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ received a copy of the GNU General Public License along with Freeciv21.
#include "log.h"
#include "rand.h"
#include "registry.h"
#include "registry_ini.h"
#include "shared.h"

// client
Expand Down
4 changes: 2 additions & 2 deletions client/connectdlg_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// Qt
#include <QCoreApplication>
#include <QDebug>
#include <QDir>
#include <QProcess>
#include <QStandardPaths>
#include <QTcpServer>
Expand All @@ -30,17 +31,16 @@
#include "log.h"
#include "rand.h"
#include "registry.h"
#include "registry_ini.h"
#include "shared.h"
#include "support.h"

// client
#include "chatline_common.h"
#include "client_main.h"
#include "climisc.h"
#include "clinet.h" // connect_to_server()
#include "connectdlg_common.h"
#include "packhand_gen.h"
#include "tileset/tilespec.h"

// gui-qt
#include "qtg_cxxside.h"
Expand Down
1 change: 1 addition & 0 deletions client/global_worklist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "fcintl.h"
#include "log.h"
#include "registry.h"
#include "registry_ini.h"
#include "shared.h"
#include "support.h"

Expand Down
2 changes: 1 addition & 1 deletion client/luascript/script_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
extern "C" {
/* dependencies/lua */
#include "lua.h"
#include "lualib.h"

/* dependencies/tolua */
#include "tolua.h"
}
// utility
#include "log.h"
#include "section_file.h"

// common
#include "featured_text.h"
Expand Down
4 changes: 3 additions & 1 deletion client/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

#include <cstring>
#include <sys/stat.h>

// Qt
#include <QDir>
#include <QHash>
#include <QUrl>

Expand All @@ -24,6 +26,7 @@
#include "fcintl.h"
#include "log.h"
#include "registry.h"
#include "registry_ini.h"
#include "shared.h"
#include "support.h"

Expand All @@ -35,7 +38,6 @@
#include "version.h"

/* client/include */
#include "dialogs_g.h"
#include "gui_main_g.h"
#include "menu_g.h"
#include "optiondlg_g.h"
Expand Down
9 changes: 4 additions & 5 deletions client/page_load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@

// utility
#include "fcintl.h"
#include "section_file.h"

// common
#include "chatline_common.h"
#include "connectdlg_common.h"
#include "rgbcolor.h"

// client
#include "client_main.h"
#include "options.h"
// gui-qt
#include "fc_client.h"
#include "options.h"

static struct terrain *char2terrain(char ch);

Expand Down
7 changes: 1 addition & 6 deletions client/page_scenario.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@

// utility
#include "fcintl.h"

// common
#include "chatline_common.h"
#include "connectdlg_common.h"
#include "section_file.h"

// generated
#include "fc_version.h"

// client
#include "client_main.h"
#include "dialogs.h"
#include "fc_client.h"

// Qt
Expand Down
3 changes: 2 additions & 1 deletion client/servers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@

// utility
#include "net_types.h"
#include "registry_ini.h"

// generated
#include "fc_version.h"

// common
#include "capstr.h"
#include "dataio.h"
#include "dataio_raw.h"
#include "version.h"

// client
Expand Down
1 change: 1 addition & 0 deletions common/helpdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "fcintl.h"
#include "log.h"
#include "registry.h"
#include "registry_ini.h"
#include "requirements.h"
#include "support.h"

Expand Down
1 change: 1 addition & 0 deletions common/path_finder.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <optional>
#include <queue>
#include <set>
#include <utility>

struct tile;

Expand Down
2 changes: 1 addition & 1 deletion common/rgbcolor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ _ ._ Copyright (c) 1996-2021 Freeciv21 and Freeciv contributors.
#include <cstdarg>

// utility
#include "fcintl.h"
#include "log.h"
#include "registry.h"
#include "registry_ini.h"

// common
#include "rgbcolor.h"
Expand Down
2 changes: 1 addition & 1 deletion common/scriptcore/luascript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ extern "C" {
#include "sol/sol.hpp"

// utility
#include "fcintl.h"
#include "log.h"
#include "registry.h"
#include "registry_ini.h"

// common
#include "map.h"
Expand Down
1 change: 1 addition & 0 deletions server/connecthand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "capability.h"
#include "fcintl.h"
#include "log.h"
#include "registry_ini.h"
#include "support.h"

// generated
Expand Down
5 changes: 2 additions & 3 deletions server/fcdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ _ ._ Copyright (c) 1996-2021 Freeciv21 and Freeciv contributors.
// utility
#include "fcintl.h"
#include "log.h"
#include "registry.h"
#include "section_file.h"
#include "support.h"

// common
#include "packets.h"

/* server/scripting */
#include "script_fcdb.h"

Expand Down
2 changes: 1 addition & 1 deletion server/gamehand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "fcintl.h"
#include "log.h"
#include "rand.h"
#include "section_file.h"
#include "shared.h"
#include "support.h"

Expand All @@ -28,7 +29,6 @@
#include "game.h"
#include "movement.h"
#include "nation.h"
#include "packets.h"

// server
#include "citytools.h"
Expand Down
1 change: 1 addition & 0 deletions server/notify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "fcintl.h"
#include "log.h"
#include "registry.h"
#include "registry_ini.h"

// common
#include "connection.h"
Expand Down
2 changes: 1 addition & 1 deletion server/rscompat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
#include "capability.h"
#include "fcintl.h"
#include "registry.h"
#include "section_file.h"

// common
#include "actions.h"
#include "effects.h"
#include "game.h"
#include "movement.h"
#include "requirements.h"
#include "unittype.h"
Expand Down
5 changes: 2 additions & 3 deletions server/rssanity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

// utility
#include "deprecations.h"
#include "fcintl.h"
#include "registry_ini.h"

// common
#include "achievements.h"
Expand All @@ -22,10 +22,9 @@
#include "game.h"
#include "government.h"
#include "movement.h"
#include "multipliers.h"
#include "nation.h"
#include "player.h"
#include "road.h"
#include "server_settings.h"
#include "specialist.h"
#include "style.h"
#include "tech.h"
Expand Down
1 change: 1 addition & 0 deletions server/savegame/savecompat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "capability.h"
#include "fcintl.h"
#include "log.h"
#include "registry_ini.h"

// common
#include "map.h"
Expand Down
2 changes: 2 additions & 0 deletions server/savegame/savemain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
#include <QString>

// utility
#include "fcthread.h"
#include "log.h"
#include "registry.h"
#include "registry_ini.h"

// common
#include "ai.h"
Expand Down
2 changes: 1 addition & 1 deletion server/scripting/script_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
/* dependencies/lua */
extern "C" {
#include "lua.h"
#include "lualib.h"

/* dependencies/tolua */
#include "tolua.h"
}
// utility
#include "log.h"
#include "registry.h"
#include "registry_ini.h"

/* common/scriptcore */
#include "api_game_specenum.h"
Expand Down
9 changes: 4 additions & 5 deletions server/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@

#pragma once

// utility
#include "shared.h"

// common
#include "game.h"
#include "server_settings.h"
#include "connection.h"

// utility
#include "registry_ini.h"

struct sset_val_name {
const char *support; /* Untranslated long support name, used
Expand Down
4 changes: 2 additions & 2 deletions server/srv_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "calendar.h"
#include "city.h"
#include "culture.h"
#include "dataio.h"
#include "dataio_raw.h"
#include "effects.h"
#include "events.h"
#include "fc_interface.h"
Expand All @@ -53,7 +53,6 @@
#include "tech.h"
#include "unit.h"
#include "unitlist.h"
#include "version.h"
#include "victory.h"

// server
Expand All @@ -79,6 +78,7 @@
#include "sanitycheck.h"
#include "score.h"
#include "sernet.h"
#include "server_settings.h"
#include "settings.h"
#include "spacerace.h"
#include "srv_log.h"
Expand Down
2 changes: 1 addition & 1 deletion tools/fcmp/download.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <cerrno>

// Qt
#include <QDir>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
Expand All @@ -29,7 +30,6 @@
#include "capability.h"
#include "fcintl.h"
#include "netfile.h"
#include "registry.h"

// tools
#include "mpdb.h"
Expand Down
4 changes: 1 addition & 3 deletions tools/fcmp/mpdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
#include "capability.h"
#include "fcintl.h"
#include "registry.h"

// modinst
#include "download.h"
#include "registry_ini.h"

#include "mpdb.h"

Expand Down
Loading

0 comments on commit 5bd9681

Please sign in to comment.