From 179aeb01082df9e7c19a285ae4d703a7714f4e2f Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Wed, 29 Nov 2023 17:44:20 +0100 Subject: [PATCH] Add includes for config.h as per the discussion in PR #1337 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Many thanks to @Explorer09 Kang-Che Sung (宋岡哲). Also add a #error stanza to XUtils.h in case somebody forgets the beautiful mess GNU forces on us. --- AvailableColumnsPanel.c | 2 ++ AvailableMetersPanel.c | 2 ++ BatteryMeter.c | 2 ++ CategoriesPanel.c | 2 ++ ColumnsPanel.c | 2 ++ DiskIOMeter.c | 2 ++ DynamicScreen.c | 2 ++ FileDescriptorMeter.c | 2 ++ Header.c | 2 ++ LoadAverageMeter.c | 2 ++ Machine.c | 2 ++ MainPanel.c | 2 ++ MemorySwapMeter.c | 2 ++ NetworkIOMeter.c | 2 ++ OptionItem.c | 2 ++ Panel.c | 2 ++ RichString.c | 2 ++ Scheduling.c | 2 ++ ScreenTabsPanel.c | 2 ++ ScreensPanel.c | 2 ++ Settings.c | 2 ++ SignalsPanel.c | 2 ++ TasksMeter.c | 2 ++ UptimeMeter.c | 2 ++ Vector.c | 2 ++ XUtils.h | 7 ++++++- dragonflybsd/Platform.c | 2 ++ freebsd/FreeBSDProcess.c | 2 ++ linux/CGroupUtils.c | 2 ++ linux/IOPriorityPanel.c | 2 ++ linux/LinuxProcess.c | 2 ++ linux/PressureStallMeter.c | 2 ++ linux/SELinuxMeter.c | 2 ++ linux/SystemdMeter.c | 2 ++ netbsd/NetBSDMachine.c | 2 ++ netbsd/NetBSDProcess.c | 2 ++ netbsd/NetBSDProcessTable.c | 2 ++ netbsd/Platform.c | 2 ++ openbsd/OpenBSDMachine.c | 2 ++ openbsd/OpenBSDProcess.c | 2 ++ openbsd/OpenBSDProcessTable.c | 2 ++ openbsd/Platform.c | 2 ++ pcp/InDomTable.c | 2 ++ pcp/PCPDynamicScreen.c | 2 ++ pcp/PCPProcess.c | 2 ++ solaris/Platform.c | 2 ++ zfs/ZfsCompressedArcMeter.c | 2 ++ 47 files changed, 98 insertions(+), 1 deletion(-) diff --git a/AvailableColumnsPanel.c b/AvailableColumnsPanel.c index a590bac2..1b328db0 100644 --- a/AvailableColumnsPanel.c +++ b/AvailableColumnsPanel.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "AvailableColumnsPanel.h" #include diff --git a/AvailableMetersPanel.c b/AvailableMetersPanel.c index de1dd211..dabb3870 100644 --- a/AvailableMetersPanel.c +++ b/AvailableMetersPanel.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "AvailableMetersPanel.h" #include diff --git a/BatteryMeter.c b/BatteryMeter.c index 24b2e682..92eecb3f 100644 --- a/BatteryMeter.c +++ b/BatteryMeter.c @@ -7,6 +7,8 @@ in the source distribution for its full text. This meter written by Ian P. Hands (iphands@gmail.com, ihands@redhat.com). */ +#include "config.h" // IWYU pragma: keep + #include "BatteryMeter.h" #include diff --git a/CategoriesPanel.c b/CategoriesPanel.c index 31c7da05..d653dcbd 100644 --- a/CategoriesPanel.c +++ b/CategoriesPanel.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "CategoriesPanel.h" #include diff --git a/ColumnsPanel.c b/ColumnsPanel.c index e3445a00..f395d9f6 100644 --- a/ColumnsPanel.c +++ b/ColumnsPanel.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "ColumnsPanel.h" #include diff --git a/DiskIOMeter.c b/DiskIOMeter.c index 9740db47..78ae91b6 100644 --- a/DiskIOMeter.c +++ b/DiskIOMeter.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "DiskIOMeter.h" #include diff --git a/DynamicScreen.c b/DynamicScreen.c index 35eb4ee6..6ab52541 100644 --- a/DynamicScreen.c +++ b/DynamicScreen.c @@ -6,6 +6,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "DynamicScreen.h" #include diff --git a/FileDescriptorMeter.c b/FileDescriptorMeter.c index 92dc99ae..4295f21a 100644 --- a/FileDescriptorMeter.c +++ b/FileDescriptorMeter.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "FileDescriptorMeter.h" #include diff --git a/Header.c b/Header.c index 3fafc70a..bb47f0c5 100644 --- a/Header.c +++ b/Header.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "Header.h" #include diff --git a/LoadAverageMeter.c b/LoadAverageMeter.c index be6215db..0a8e7f19 100644 --- a/LoadAverageMeter.c +++ b/LoadAverageMeter.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "LoadAverageMeter.h" #include "CRT.h" diff --git a/Machine.c b/Machine.c index c7b98c9f..6ea08620 100644 --- a/Machine.c +++ b/Machine.c @@ -6,6 +6,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "Machine.h" #include diff --git a/MainPanel.c b/MainPanel.c index 7ca7b201..05093f12 100644 --- a/MainPanel.c +++ b/MainPanel.c @@ -6,6 +6,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "MainPanel.h" #include diff --git a/MemorySwapMeter.c b/MemorySwapMeter.c index 814841f7..0d89ced6 100644 --- a/MemorySwapMeter.c +++ b/MemorySwapMeter.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "MemorySwapMeter.h" #include diff --git a/NetworkIOMeter.c b/NetworkIOMeter.c index ea7ffba2..a43f4d17 100644 --- a/NetworkIOMeter.c +++ b/NetworkIOMeter.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "NetworkIOMeter.h" #include diff --git a/OptionItem.c b/OptionItem.c index 962c0a9c..728113b9 100644 --- a/OptionItem.c +++ b/OptionItem.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "OptionItem.h" #include diff --git a/Panel.c b/Panel.c index d1bc6a7b..64982731 100644 --- a/Panel.c +++ b/Panel.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "Panel.h" #include diff --git a/RichString.c b/RichString.c index daa0c91f..ed852ada 100644 --- a/RichString.c +++ b/RichString.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "RichString.h" #include diff --git a/Scheduling.c b/Scheduling.c index 10846c0b..8383cb10 100644 --- a/Scheduling.c +++ b/Scheduling.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "Scheduling.h" #include "EnvScreen.h" diff --git a/ScreenTabsPanel.c b/ScreenTabsPanel.c index 571db71f..d4757f05 100644 --- a/ScreenTabsPanel.c +++ b/ScreenTabsPanel.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "ScreenTabsPanel.h" #include diff --git a/ScreensPanel.c b/ScreensPanel.c index 1bf557a3..69d1aeb1 100644 --- a/ScreensPanel.c +++ b/ScreensPanel.c @@ -6,6 +6,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "ScreensPanel.h" #include diff --git a/Settings.c b/Settings.c index ed60ff59..b1051a38 100644 --- a/Settings.c +++ b/Settings.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "Settings.h" #include diff --git a/SignalsPanel.c b/SignalsPanel.c index 7e21ce93..28d307e2 100644 --- a/SignalsPanel.c +++ b/SignalsPanel.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "SignalsPanel.h" // the above contains #include so do not add that here again (breaks Solaris build) diff --git a/TasksMeter.c b/TasksMeter.c index 6ea965b8..04b1f938 100644 --- a/TasksMeter.c +++ b/TasksMeter.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "TasksMeter.h" #include "CRT.h" diff --git a/UptimeMeter.c b/UptimeMeter.c index d4b3175e..622deda3 100644 --- a/UptimeMeter.c +++ b/UptimeMeter.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "UptimeMeter.h" #include "CRT.h" diff --git a/Vector.c b/Vector.c index 47a772ce..15133dc5 100644 --- a/Vector.c +++ b/Vector.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "Vector.h" #include diff --git a/XUtils.h b/XUtils.h index afe22112..1babb86e 100644 --- a/XUtils.h +++ b/XUtils.h @@ -3,11 +3,16 @@ /* htop - StringUtils.h (C) 2004-2011 Hisham H. Muhammad +(C) 2020-2023 htop dev team Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ -#include "config.h" // IWYU pragma: keep +// IWYU pragma: no_include "config.h" +#ifndef PACKAGE +// strchrnul() needs _GNU_SOURCE defined, see PR #1337 for details +#error "Must have #include \"config.h\" line at the top of the file that includes these XUtils helper functions" +#endif #include #include diff --git a/dragonflybsd/Platform.c b/dragonflybsd/Platform.c index ff2300aa..25afa8b1 100644 --- a/dragonflybsd/Platform.c +++ b/dragonflybsd/Platform.c @@ -6,6 +6,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "dragonflybsd/Platform.h" #include diff --git a/freebsd/FreeBSDProcess.c b/freebsd/FreeBSDProcess.c index f6d3451d..bf8879a9 100644 --- a/freebsd/FreeBSDProcess.c +++ b/freebsd/FreeBSDProcess.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "freebsd/FreeBSDProcess.h" #include diff --git a/linux/CGroupUtils.c b/linux/CGroupUtils.c index 60922c6e..62924542 100644 --- a/linux/CGroupUtils.c +++ b/linux/CGroupUtils.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "linux/CGroupUtils.h" #include "XUtils.h" diff --git a/linux/IOPriorityPanel.c b/linux/IOPriorityPanel.c index 3e91bc4d..8d0ef7b5 100644 --- a/linux/IOPriorityPanel.c +++ b/linux/IOPriorityPanel.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "linux/IOPriorityPanel.h" #include diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c index 4655d91b..8b119fd9 100644 --- a/linux/LinuxProcess.c +++ b/linux/LinuxProcess.c @@ -6,6 +6,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "linux/LinuxProcess.h" #include diff --git a/linux/PressureStallMeter.c b/linux/PressureStallMeter.c index c4f534ea..f7962475 100644 --- a/linux/PressureStallMeter.c +++ b/linux/PressureStallMeter.c @@ -6,6 +6,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "linux/PressureStallMeter.h" #include diff --git a/linux/SELinuxMeter.c b/linux/SELinuxMeter.c index c35cb686..323c2a17 100644 --- a/linux/SELinuxMeter.c +++ b/linux/SELinuxMeter.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "linux/SELinuxMeter.h" #include "CRT.h" diff --git a/linux/SystemdMeter.c b/linux/SystemdMeter.c index ff178e0e..a154d1b8 100644 --- a/linux/SystemdMeter.c +++ b/linux/SystemdMeter.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "linux/SystemdMeter.h" #include diff --git a/netbsd/NetBSDMachine.c b/netbsd/NetBSDMachine.c index 245b8231..9c04cdd3 100644 --- a/netbsd/NetBSDMachine.c +++ b/netbsd/NetBSDMachine.c @@ -8,6 +8,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "netbsd/NetBSDMachine.h" #include diff --git a/netbsd/NetBSDProcess.c b/netbsd/NetBSDProcess.c index 605b56c8..4166f962 100644 --- a/netbsd/NetBSDProcess.c +++ b/netbsd/NetBSDProcess.c @@ -8,6 +8,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "netbsd/NetBSDProcess.h" #include diff --git a/netbsd/NetBSDProcessTable.c b/netbsd/NetBSDProcessTable.c index 885a2edd..6fa5bfea 100644 --- a/netbsd/NetBSDProcessTable.c +++ b/netbsd/NetBSDProcessTable.c @@ -8,6 +8,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "netbsd/NetBSDProcessTable.h" #include diff --git a/netbsd/Platform.c b/netbsd/Platform.c index 5b09ed16..f458c239 100644 --- a/netbsd/Platform.c +++ b/netbsd/Platform.c @@ -9,6 +9,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "netbsd/Platform.h" #include diff --git a/openbsd/OpenBSDMachine.c b/openbsd/OpenBSDMachine.c index c4b6e47e..0edb90be 100644 --- a/openbsd/OpenBSDMachine.c +++ b/openbsd/OpenBSDMachine.c @@ -6,6 +6,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "openbsd/OpenBSDMachine.h" #include diff --git a/openbsd/OpenBSDProcess.c b/openbsd/OpenBSDProcess.c index c54a1763..b1958a15 100644 --- a/openbsd/OpenBSDProcess.c +++ b/openbsd/OpenBSDProcess.c @@ -6,6 +6,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "openbsd/OpenBSDProcess.h" #include diff --git a/openbsd/OpenBSDProcessTable.c b/openbsd/OpenBSDProcessTable.c index 0b016fbb..26c6c52b 100644 --- a/openbsd/OpenBSDProcessTable.c +++ b/openbsd/OpenBSDProcessTable.c @@ -6,6 +6,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "openbsd/OpenBSDProcessTable.h" #include diff --git a/openbsd/Platform.c b/openbsd/Platform.c index b41900b0..a8b5d212 100644 --- a/openbsd/Platform.c +++ b/openbsd/Platform.c @@ -6,6 +6,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "openbsd/Platform.h" #include diff --git a/pcp/InDomTable.c b/pcp/InDomTable.c index 40a22f1d..68563fb9 100644 --- a/pcp/InDomTable.c +++ b/pcp/InDomTable.c @@ -6,6 +6,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "InDomTable.h" #include diff --git a/pcp/PCPDynamicScreen.c b/pcp/PCPDynamicScreen.c index a4622e34..a66d9dce 100644 --- a/pcp/PCPDynamicScreen.c +++ b/pcp/PCPDynamicScreen.c @@ -6,6 +6,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "pcp/PCPDynamicScreen.h" #include diff --git a/pcp/PCPProcess.c b/pcp/PCPProcess.c index df18b6f2..2ea4e5c6 100644 --- a/pcp/PCPProcess.c +++ b/pcp/PCPProcess.c @@ -7,6 +7,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "pcp/PCPProcess.h" #include diff --git a/solaris/Platform.c b/solaris/Platform.c index c4b121c7..5faa91ae 100644 --- a/solaris/Platform.c +++ b/solaris/Platform.c @@ -7,6 +7,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "solaris/Platform.h" #include diff --git a/zfs/ZfsCompressedArcMeter.c b/zfs/ZfsCompressedArcMeter.c index 2e494736..4d47040c 100644 --- a/zfs/ZfsCompressedArcMeter.c +++ b/zfs/ZfsCompressedArcMeter.c @@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "zfs/ZfsCompressedArcMeter.h" #include