From 91a7b94cec8315f335de5161cdcffd1dd3605eaa Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 23 Sep 2018 19:03:28 +0200 Subject: [PATCH] run iwyu if we have it --- src/CMakeLists.txt | 9 +++++++++ src/gmtool.c | 22 +++++----------------- src/listbox.c | 2 -- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cf96cfbc2..96351cdc9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -169,9 +169,18 @@ set (SERVER_SRC ${SERVER_SRC} ) endif(CURSES_FOUND) +find_program(IWYU_PATH NAMES include-what-you-use iwyu) +if(NOT IWYU_PATH) + message(STATUS "Could not find the program include-what-you-use") +endif() + + add_library(version STATIC ${VERSION_SRC}) add_library(game ${ERESSEA_SRC}) add_executable(eressea ${SERVER_SRC}) +if (IWYU_PATH) +set_property(TARGET eressea PROPERTY C_INCLUDE_WHAT_YOU_USE ${IWYU_PATH}) +endif(IWYU_PATH) target_link_libraries(game version) target_link_libraries(eressea game diff --git a/src/gmtool.c b/src/gmtool.c index c2193bd32..48a51d354 100644 --- a/src/gmtool.c +++ b/src/gmtool.c @@ -18,49 +18,37 @@ #include "gmtool.h" -#include -#include -#include #include #include "kernel/building.h" -#include "kernel/calendar.h" #include "kernel/faction.h" #include "kernel/item.h" #include "kernel/plane.h" -#include "kernel/race.h" #include "kernel/region.h" #include "kernel/terrainid.h" #include "kernel/unit.h" -#include "kernel/resources.h" #include "kernel/save.h" #include "kernel/ship.h" #include "kernel/terrain.h" -#include -#include - #include #include #include -#include #include -#include -#include -#include +#include "util/path.h" +#include "util/rng.h" +#include "util/unicode.h" #include "gmtool_structs.h" #include "console.h" #include "listbox.h" -#include "wormhole.h" #include "teleport.h" -#include -#include - #include #include +#include #include +#include #include #include diff --git a/src/listbox.c b/src/listbox.c index afc04b232..cd7118da7 100644 --- a/src/listbox.c +++ b/src/listbox.c @@ -13,12 +13,10 @@ #endif #include -#include #include "listbox.h" #include "gmtool_structs.h" -#include #include #include