From f5c3349bdb9cae2eec5adb9892445d3a1b482ec4 Mon Sep 17 00:00:00 2001 From: Christian Goettsche Date: Wed, 18 Nov 2020 15:12:18 +0100 Subject: [PATCH] IWYU update (FreeBSD) --- Action.c | 7 +++++-- Affinity.c | 2 +- Affinity.h | 13 +++++++++---- CPUMeter.c | 2 +- freebsd/FreeBSDProcess.c | 13 ++++++------- freebsd/FreeBSDProcess.h | 1 - freebsd/FreeBSDProcessList.c | 18 +++++++++++++----- freebsd/FreeBSDProcessList.h | 8 ++------ freebsd/Platform.c | 9 +++++++++ freebsd/Platform.h | 3 +++ iwyu/htop.imp | 8 ++++++++ iwyu/run_iwyu.sh | 2 +- zfs/ZfsArcStats.c | 16 ---------------- zfs/openzfs_sysctl.c | 13 +++++-------- 14 files changed, 63 insertions(+), 52 deletions(-) diff --git a/Action.c b/Action.c index edaebc66..ef7caaf4 100644 --- a/Action.c +++ b/Action.c @@ -13,8 +13,6 @@ in the source distribution for its full text. #include #include -#include "Affinity.h" -#include "AffinityPanel.h" #include "CategoriesPanel.h" #include "CommandScreen.h" #include "CRT.h" @@ -36,6 +34,11 @@ in the source distribution for its full text. #include "Vector.h" #include "XUtils.h" +#if (defined(HAVE_LIBHWLOC) || defined(HAVE_LINUX_AFFINITY)) +#include "Affinity.h" +#include "AffinityPanel.h" +#endif + Object* Action_pickFromVector(State* st, Panel* list, int x, bool followProcess) { Panel* panel = st->panel; diff --git a/Affinity.c b/Affinity.c index 6fb5846c..c157885b 100644 --- a/Affinity.c +++ b/Affinity.c @@ -6,7 +6,7 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "config.h" +#include "config.h" // IWYU pragma: keep #include "Affinity.h" diff --git a/Affinity.h b/Affinity.h index 0797b366..97c8e466 100644 --- a/Affinity.h +++ b/Affinity.h @@ -8,18 +8,23 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "config.h" +#include "config.h" // IWYU pragma: keep +#include "ProcessList.h" + +#if defined(HAVE_LIBHWLOC) || defined(HAVE_LINUX_AFFINITY) #include #include "Object.h" #include "Process.h" -#include "ProcessList.h" +#endif + #if defined(HAVE_LIBHWLOC) && defined(HAVE_LINUX_AFFINITY) -#error hwlock and linux affinity are mutual exclusive. +#error hwloc and linux affinity are mutual exclusive. #endif + typedef struct Affinity_ { ProcessList* pl; int size; @@ -39,6 +44,6 @@ Affinity* Affinity_get(Process* proc, ProcessList* pl); bool Affinity_set(Process* proc, Arg arg); -#endif +#endif /* HAVE_LIBHWLOC || HAVE_LINUX_AFFINITY */ #endif diff --git a/CPUMeter.c b/CPUMeter.c index cb5a5e74..61b33cb6 100644 --- a/CPUMeter.c +++ b/CPUMeter.c @@ -5,7 +5,7 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "config.h" +#include "config.h" // IWYU pragma: keep #include "CPUMeter.h" diff --git a/freebsd/FreeBSDProcess.c b/freebsd/FreeBSDProcess.c index 57e64118..c4568677 100644 --- a/freebsd/FreeBSDProcess.c +++ b/freebsd/FreeBSDProcess.c @@ -5,16 +5,15 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "Process.h" -#include "ProcessList.h" #include "FreeBSDProcess.h" -#include "Platform.h" -#include "CRT.h" #include -#include -#include -#include + +#include "CRT.h" +#include "Macros.h" +#include "Process.h" +#include "RichString.h" +#include "XUtils.h" const char* const nodevStr = "nodev"; diff --git a/freebsd/FreeBSDProcess.h b/freebsd/FreeBSDProcess.h index d2fee956..89119764 100644 --- a/freebsd/FreeBSDProcess.h +++ b/freebsd/FreeBSDProcess.h @@ -11,7 +11,6 @@ in the source distribution for its full text. #include "Object.h" #include "Process.h" -#include "RichString.h" #include "Settings.h" diff --git a/freebsd/FreeBSDProcessList.c b/freebsd/FreeBSDProcessList.c index 7ce787f8..7dd432f5 100644 --- a/freebsd/FreeBSDProcessList.c +++ b/freebsd/FreeBSDProcessList.c @@ -10,23 +10,31 @@ in the source distribution for its full text. #include #include #include -#include #include #include #include -#include -#include -#include +#include +#include +#include +#include // needs to be included before for MAXPATHLEN +#include +#include +#include +#include #include #include +#include #include #include -#include "Compat.h" #include "CRT.h" +#include "Compat.h" #include "FreeBSDProcess.h" #include "Macros.h" +#include "Object.h" +#include "Process.h" #include "ProcessList.h" +#include "Settings.h" #include "XUtils.h" #include "zfs/ZfsArcStats.h" #include "zfs/openzfs_sysctl.h" diff --git a/freebsd/FreeBSDProcessList.h b/freebsd/FreeBSDProcessList.h index cbe4742c..f18275df 100644 --- a/freebsd/FreeBSDProcessList.h +++ b/freebsd/FreeBSDProcessList.h @@ -8,14 +8,10 @@ in the source distribution for its full text. */ #include -#include // needs to be included before for MAXPATHLEN -#include -#include -#include +#include +#include -#include "FreeBSDProcess.h" #include "Hashtable.h" -#include "Process.h" #include "ProcessList.h" #include "UsersTable.h" #include "zfs/ZfsArcStats.h" diff --git a/freebsd/Platform.c b/freebsd/Platform.c index 8efa4e68..f73b48bd 100644 --- a/freebsd/Platform.c +++ b/freebsd/Platform.c @@ -9,10 +9,16 @@ in the source distribution for its full text. #include #include +#include +#include #include #include #include +#include +#include +#include #include +#include #include #include #include @@ -31,9 +37,12 @@ in the source distribution for its full text. #include "MemoryMeter.h" #include "Meter.h" #include "NetworkIOMeter.h" +#include "ProcessList.h" +#include "Settings.h" #include "SwapMeter.h" #include "TasksMeter.h" #include "UptimeMeter.h" +#include "XUtils.h" #include "zfs/ZfsArcMeter.h" #include "zfs/ZfsCompressedArcMeter.h" diff --git a/freebsd/Platform.h b/freebsd/Platform.h index 5e3b29fb..b3cb6717 100644 --- a/freebsd/Platform.h +++ b/freebsd/Platform.h @@ -13,9 +13,12 @@ in the source distribution for its full text. #include "Action.h" #include "BatteryMeter.h" #include "DiskIOMeter.h" +#include "Meter.h" +#include "Process.h" #include "ProcessLocksScreen.h" #include "SignalsPanel.h" + extern ProcessFieldData Process_fields[]; extern ProcessField Platform_defaultFields[]; diff --git a/iwyu/htop.imp b/iwyu/htop.imp index c95bfaff..7fe432c4 100644 --- a/iwyu/htop.imp +++ b/iwyu/htop.imp @@ -7,4 +7,12 @@ { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, + + { include: ["", "private", "", "public"] }, + + { include: ["", "private", "", "public"] }, + + { include: ["", "private", "", "public"] }, + + { include: ["", "private", "", "public"] }, ] diff --git a/iwyu/run_iwyu.sh b/iwyu/run_iwyu.sh index 37843dcf..6139ebec 100755 --- a/iwyu/run_iwyu.sh +++ b/iwyu/run_iwyu.sh @@ -11,4 +11,4 @@ IWYU=${IWYU:-iwyu} cd "$SOURCEDIR" || exit make clean -make --keep-going --silent CC="$IWYU" CFLAGS="-Xiwyu --no_comments -Xiwyu --no_fwd_decl -Xiwyu --mapping_file='$SCRIPTDIR/htop.imp' $PKG_NL3" +make -k -s CC="$IWYU" CFLAGS="-Xiwyu --no_comments -Xiwyu --no_fwd_decl -Xiwyu --mapping_file='$SCRIPTDIR/htop.imp' $PKG_NL3" diff --git a/zfs/ZfsArcStats.c b/zfs/ZfsArcStats.c index ae565633..bead8461 100644 --- a/zfs/ZfsArcStats.c +++ b/zfs/ZfsArcStats.c @@ -5,22 +5,6 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -/*{ -typedef struct ZfsArcStats_ { - int enabled; - int isCompressed; - unsigned long long int max; - unsigned long long int size; - unsigned long long int MFU; - unsigned long long int MRU; - unsigned long long int anon; - unsigned long long int header; - unsigned long long int other; - unsigned long long int compressed; - unsigned long long int uncompressed; -} ZfsArcStats; -}*/ - #include "Macros.h" static int make_iso_compilers_happy ATTR_UNUSED; diff --git a/zfs/openzfs_sysctl.c b/zfs/openzfs_sysctl.c index 59d7469f..fd00d61b 100644 --- a/zfs/openzfs_sysctl.c +++ b/zfs/openzfs_sysctl.c @@ -6,12 +6,13 @@ in the source distribution for its full text. */ #include "zfs/openzfs_sysctl.h" + +#include +#include // IWYU pragma: keep +#include // needs for u_int with gcc + #include "zfs/ZfsArcStats.h" -#include -#include -#include -#include static int MIB_kstat_zfs_misc_arcstats_size[5]; static int MIB_kstat_zfs_misc_arcstats_c_max[5]; @@ -23,10 +24,6 @@ static int MIB_kstat_zfs_misc_arcstats_other_size[5]; static int MIB_kstat_zfs_misc_arcstats_compressed_size[5]; static int MIB_kstat_zfs_misc_arcstats_uncompressed_size[5]; -/*{ -#include "zfs/ZfsArcStats.h" -}*/ - void openzfs_sysctl_init(ZfsArcStats* stats) { size_t len; unsigned long long int arcSize;