Skip to content

Commit

Permalink
iwyu: always include "input.h" directly; remove excessive includes
Browse files Browse the repository at this point in the history
for all files that iwyu reports as (it should add or remove "input.h")
{
	add / remove "input.h" according to iwyu;
	remove everything iwyu reports to remove;
	while (doesn't compile) {add directly what needs to be added};
	/* note: thanks to indirect includes, we don't need to include most of what iwyu reports
	we obey iwyu only for "input.h", everything else is a suggestion if it doesn't compile without it
}
  • Loading branch information
Brambor committed Jan 21, 2024
1 parent 328b9e4 commit 8b50d73
Show file tree
Hide file tree
Showing 24 changed files with 28 additions and 78 deletions.
2 changes: 1 addition & 1 deletion src/calendar_ui.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "calendar_ui.h"

#include "input.h"
#include "string_formatter.h"
#include "string_input_popup.h"
#include "ui.h"
#include "ui_manager.h"

time_point calendar_ui::select_time_point( time_point initial_value, std::string_view title,
calendar_ui::granularity granularity_level )
Expand Down
2 changes: 1 addition & 1 deletion src/distraction_manager.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "distraction_manager.h"

#include <functional>
#include <string>

#include "color.h"
#include "cursesdef.h"
#include "input.h"
#include "output.h"
#include "point.h"
#include "translations.h"
Expand Down
7 changes: 1 addition & 6 deletions src/do_turn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,18 @@
#include "bionics.h"
#include "cached_options.h"
#include "calendar.h"
#include "character.h"
#include "creature_tracker.h"
#include "event_bus.h"
#include "explosion.h"
#include "game.h"
#include "gamemode.h"
#include "help.h"
#include "kill_tracker.h"
#include "input.h"
#include "make_static.h"
#include "map.h"
#include "mapbuffer.h"
#include "memorial_logger.h"
#include "messages.h"
#include "mission.h"
#include "monattack.h"
#include "mtype.h"
#include "music.h"
#include "npc.h"
Expand All @@ -33,13 +30,11 @@
#include "popup.h"
#include "scent_map.h"
#include "sdlsound.h"
#include "string_input_popup.h"
#include "stats_tracker.h"
#include "timed_event.h"
#include "ui_manager.h"
#include "vehicle.h"
#include "vpart_position.h"
#include "wcwidth.h"
#include "worldfactory.h"

static const activity_id ACT_AUTODRIVE( "ACT_AUTODRIVE" );
Expand Down
7 changes: 0 additions & 7 deletions src/gamemode_tutorial.cpp
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
#include "gamemode_tutorial.h" // IWYU pragma: associated

#include <cstdlib>
#include <iosfwd>
#include <memory>
#include <optional>

#include "action.h"
#include "avatar.h"
#include "calendar.h"
#include "character.h"
#include "colony.h"
#include "coordinates.h"
#include "debug.h"
#include "game.h"
#include "game_constants.h"
#include "input.h"
#include "inventory.h"
#include "item.h"
#include "map.h"
#include "map_iterator.h"
#include "mapdata.h"
#include "output.h"
#include "overmap.h"
#include "overmapbuffer.h"
#include "pimpl.h"
#include "point.h"
#include "profession.h"
#include "scent_map.h"
Expand Down
5 changes: 1 addition & 4 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "butchery_requirements.h"
#include "cata_assert.h"
#include "cata_scope_helpers.h"
#include "cata_utility.h"
#include "character_modifier.h"
#include "city.h"
#include "climbing.h"
Expand All @@ -46,11 +45,11 @@
#include "flag.h"
#include "gates.h"
#include "harvest.h"
#include "input.h"
#include "item_action.h"
#include "item_category.h"
#include "item_factory.h"
#include "itype.h"
#include "json.h"
#include "json_loader.h"
#include "loading_ui.h"
#include "lru_cache.h"
Expand Down Expand Up @@ -79,7 +78,6 @@
#include "overmap.h"
#include "overmap_connection.h"
#include "overmap_location.h"
#include "path_info.h"
#include "profession.h"
#include "profession_group.h"
#include "proficiency.h"
Expand All @@ -98,7 +96,6 @@
#include "speech.h"
#include "speed_description.h"
#include "start_location.h"
#include "string_formatter.h"
#include "test_data.h"
#include "text_snippets.h"
#include "translations.h"
Expand Down
6 changes: 1 addition & 5 deletions src/item_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@
#include <array>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iterator>
#include <limits>
#include <memory>
#include <new>
#include <optional>
#include <stdexcept>
#include <type_traits>
#include <unordered_set>

#include "addiction.h"
#include "ammo.h"
#include "assign.h"
#include "bodypart.h"
Expand All @@ -36,11 +32,11 @@
#include "game_constants.h"
#include "generic_factory.h"
#include "init.h"
#include "input.h"
#include "item.h"
#include "item_contents.h"
#include "item_group.h"
#include "iuse_actor.h"
#include "json.h"
#include "material.h"
#include "options.h"
#include "pocket_type.h"
Expand Down
9 changes: 2 additions & 7 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <iterator>
#include <list>
#include <map>
#include <new>
#include <optional>
#include <set>
#include <sstream>
Expand All @@ -30,9 +29,9 @@
#include "calendar.h"
#include "cata_utility.h"
#include "character.h"
#include "construction.h"
#include "character_martial_arts.h"
#include "city.h"
#include "colony.h"
#include "color.h"
#include "coordinate_conversions.h"
#include "coordinates.h"
Expand All @@ -56,14 +55,14 @@
#include "handle_liquid.h"
#include "harvest.h"
#include "iexamine.h"
#include "input.h"
#include "inventory.h"
#include "inventory_ui.h"
#include "item.h"
#include "item_location.h"
#include "item_pocket.h"
#include "iteminfo_query.h"
#include "itype.h"
#include "iuse_actor.h" // For firestarter
#include "json.h"
#include "json_loader.h"
#include "line.h"
Expand Down Expand Up @@ -103,18 +102,15 @@
#include "string_input_popup.h"
#include "teleport.h"
#include "text_snippets.h"
#include "timed_event.h"
#include "translations.h"
#include "trap.h"
#include "try_parse_integer.h"
#include "type_id.h"
#include "ui.h"
#include "ui_manager.h"
#include "units.h"
#include "units_utility.h"
#include "value_ptr.h"
#include "veh_interact.h"
#include "veh_type.h"
#include "vehicle.h"
#include "viewer.h"
#include "vitamin.h"
Expand Down Expand Up @@ -392,7 +388,6 @@ static constexpr int RADIO_PER_TURN = 25;

#include "iuse_software.h"

struct extended_photo_def;
struct object_names_collection;

static void item_save_monsters( Character &p, item &it, const std::vector<monster *> &monster_vec,
Expand Down
2 changes: 1 addition & 1 deletion src/loading_ui.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "loading_ui.h"

#include <functional>
#include <memory>
#include <vector>

#include "cached_options.h"
#include "input.h"
#include "color.h"
#include "output.h"
#include "translations.h"
Expand Down
7 changes: 1 addition & 6 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <optional>
#include <ostream>
#include <queue>
Expand Down Expand Up @@ -40,8 +39,6 @@
#include "do_turn.h"
#include "drawing_primitives.h"
#include "enums.h"
#include "event.h"
#include "event_bus.h"
#include "explosion.h"
#include "field.h"
#include "field_type.h"
Expand All @@ -51,6 +48,7 @@
#include "game.h"
#include "harvest.h"
#include "iexamine.h"
#include "input.h"
#include "item.h"
#include "item_category.h"
#include "item_factory.h"
Expand All @@ -76,8 +74,6 @@
#include "mongroup.h"
#include "monster.h"
#include "mtype.h"
#include "npc.h"
#include "options.h"
#include "output.h"
#include "overmapbuffer.h"
#include "pathfinding.h"
Expand All @@ -94,7 +90,6 @@
#include "string_formatter.h"
#include "submap.h"
#include "tileray.h"
#include "timed_event.h"
#include "translations.h"
#include "trap.h"
#include "ui_manager.h"
Expand Down
5 changes: 1 addition & 4 deletions src/mapbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@
#include <chrono>
#include <exception>
#include <filesystem>
#include <functional>
#include <ratio>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#include "cata_utility.h"
#include "coordinate_conversions.h"
#include "debug.h"
#include "filesystem.h"
#include "game_constants.h"
#include "input.h"
#include "json.h"
#include "map.h"
#include "output.h"
Expand Down
6 changes: 1 addition & 5 deletions src/mapgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
#include <array>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <list>
#include <map>
#include <memory>
#include <new>
#include <optional>
#include <ostream>
#include <set>
Expand Down Expand Up @@ -39,12 +36,11 @@
#include "game_constants.h"
#include "generic_factory.h"
#include "global_vars.h"
#include "init.h"
#include "input.h"
#include "item.h"
#include "item_factory.h"
#include "item_group.h"
#include "itype.h"
#include "json.h"
#include "level_cache.h"
#include "line.h"
#include "magic_ter_furn_transform.h"
Expand Down
3 changes: 1 addition & 2 deletions src/mattack_actors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <algorithm>
#include <limits>
#include <list>
#include <memory>
#include <optional>
#include <string>
Expand All @@ -17,10 +16,10 @@
#include "game.h"
#include "generic_factory.h"
#include "gun_mode.h"
#include "input.h"
#include "item.h"
#include "item_factory.h"
#include "item_pocket.h"
#include "json.h"
#include "line.h"
#include "map.h"
#include "map_iterator.h"
Expand Down
5 changes: 1 addition & 4 deletions src/medical_ui.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <numeric>
#include <set>
#include <string>
#include <utility>

#include "action.h"
#include "addiction.h"
#include "avatar_action.h"
#include "creature.h"
Expand All @@ -16,9 +13,9 @@
#include "effect.h"
#include "flag.h"
#include "game.h"
#include "input.h"
#include "output.h"
#include "ui_manager.h"
#include "vitamin.h"
#include "weather.h"

static const efftype_id effect_bite( "bite" );
Expand Down
4 changes: 1 addition & 3 deletions src/past_games_info.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#include "past_games_info.h"

#include <algorithm>
#include <functional>
#include <map>
#include <sstream>
#include <stdexcept>
#include <string>
#include <utility>
Expand All @@ -13,7 +11,7 @@
#include "debug.h"
#include "event.h"
#include "filesystem.h"
#include "json.h"
#include "input.h"
#include "json_loader.h"
#include "memorial_logger.h"
#include "output.h"
Expand Down
2 changes: 1 addition & 1 deletion src/player_hardcoded_effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "field_type.h"
#include "fungal_effects.h"
#include "game.h"
#include "input.h"
#include "make_static.h"
#include "map.h"
#include "map_iterator.h"
Expand All @@ -39,7 +40,6 @@
#include "units.h"
#include "vitamin.h"
#include "weather.h"
#include "weather_type.h"

static const activity_id ACT_FIRSTAID( "ACT_FIRSTAID" );

Expand Down
Loading

0 comments on commit 8b50d73

Please sign in to comment.