From 6b7ce19161d352dd8f479e9fef6ffe8cefb46b3c Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Mon, 2 Jan 2023 16:57:12 +0100 Subject: [PATCH] Everywhere: Remove unused includes of LibC/stdlib.h These instances were detected by searching for files that include stdlib.h, but don't match the regex: \\b(_abort|abort|abs|aligned_alloc|arc4random|arc4random_buf|arc4random_ uniform|atexit|atof|atoi|atol|atoll|bsearch|calloc|clearenv|div|div_t|ex it|_Exit|EXIT_FAILURE|EXIT_SUCCESS|free|getenv|getprogname|grantpt|labs| ldiv|ldiv_t|llabs|lldiv|lldiv_t|malloc|malloc_good_size|malloc_size|mble n|mbstowcs|mbtowc|mkdtemp|mkstemp|mkstemps|mktemp|posix_memalign|posix_o penpt|ptsname|ptsname_r|putenv|qsort|qsort_r|rand|RAND_MAX|random|reallo c|realpath|secure_getenv|serenity_dump_malloc_stats|serenity_setenv|sete nv|setprogname|srand|srandom|strtod|strtof|strtol|strtold|strtoll|strtou l|strtoull|system|unlockpt|unsetenv|wcstombs|wctomb)\\b (Without the linebreaks.) This regex is pessimistic, so there might be more files that don't actually use anything from the stdlib. In theory, one might use LibCPP to detect things like this automatically, but let's do this one step after another. --- AK/Memory.h | 1 - Tests/Kernel/TestMemoryDeviceMmap.cpp | 1 - Tests/Kernel/crash-fcntl-invalid-cmd.cpp | 1 - Tests/LibC/TestLibCInodeWatcher.cpp | 1 - Tests/LibC/TestScanf.cpp | 1 - Tests/LibGfx/TestImageDecoder.cpp | 1 - Tests/UserspaceEmulator/ue-write-oob.cpp | 1 - Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp | 1 - Userland/Demos/Cube/Cube.cpp | 1 - Userland/DevTools/Inspector/RemoteProcess.cpp | 1 - Userland/Libraries/LibC/crt0_shared.cpp | 1 - Userland/Libraries/LibC/getsubopt.cpp | 1 - Userland/Libraries/LibC/grp.cpp | 1 - Userland/Libraries/LibC/math.cpp | 1 - Userland/Libraries/LibC/pwd.cpp | 1 - Userland/Libraries/LibC/shadow.cpp | 1 - Userland/Libraries/LibC/spawn.cpp | 1 - Userland/Libraries/LibC/time.cpp | 1 - Userland/Libraries/LibCore/GetPassword.cpp | 1 - Userland/Libraries/LibDNS/Packet.cpp | 1 - Userland/Libraries/LibDesktop/Launcher.cpp | 1 - Userland/Libraries/LibGUI/EmojiInputDialog.cpp | 1 - Userland/Libraries/LibGfx/Color.cpp | 1 - Userland/Libraries/LibGfx/Font/FontDatabase.cpp | 1 - Userland/Libraries/LibGfx/Line.h | 1 - Userland/Libraries/LibIPC/Connection.h | 1 - Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp | 1 - Userland/Libraries/LibLine/Style.h | 1 - Userland/Libraries/LibLine/SuggestionDisplay.h | 1 - Userland/Libraries/LibLine/SuggestionManager.h | 1 - Userland/Libraries/LibVT/TerminalWidget.cpp | 1 - Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp | 1 - Userland/Services/AudioServer/Mixer.cpp | 1 - Userland/Utilities/flock.cpp | 1 - Userland/Utilities/nc.cpp | 1 - Userland/Utilities/pidof.cpp | 1 - Userland/Utilities/pmemdump.cpp | 1 - Userland/Utilities/shuf.cpp | 1 - Userland/Utilities/strace.cpp | 1 - 39 files changed, 39 deletions(-) diff --git a/AK/Memory.h b/AK/Memory.h index b891a9b0721..e3af860807f 100644 --- a/AK/Memory.h +++ b/AK/Memory.h @@ -12,7 +12,6 @@ #if defined(KERNEL) # include #else -# include # include #endif diff --git a/Tests/Kernel/TestMemoryDeviceMmap.cpp b/Tests/Kernel/TestMemoryDeviceMmap.cpp index 40a983dce43..afa9f096cda 100644 --- a/Tests/Kernel/TestMemoryDeviceMmap.cpp +++ b/Tests/Kernel/TestMemoryDeviceMmap.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include diff --git a/Tests/Kernel/crash-fcntl-invalid-cmd.cpp b/Tests/Kernel/crash-fcntl-invalid-cmd.cpp index cd81095c584..076113e2268 100644 --- a/Tests/Kernel/crash-fcntl-invalid-cmd.cpp +++ b/Tests/Kernel/crash-fcntl-invalid-cmd.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include int main(int, char**) diff --git a/Tests/LibC/TestLibCInodeWatcher.cpp b/Tests/LibC/TestLibCInodeWatcher.cpp index 3c8b604411e..285bc23df38 100644 --- a/Tests/LibC/TestLibCInodeWatcher.cpp +++ b/Tests/LibC/TestLibCInodeWatcher.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include diff --git a/Tests/LibC/TestScanf.cpp b/Tests/LibC/TestScanf.cpp index 7e8623b16c4..4905d940e7a 100644 --- a/Tests/LibC/TestScanf.cpp +++ b/Tests/LibC/TestScanf.cpp @@ -8,7 +8,6 @@ #include #include -#include #include typedef long double longdouble; diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp index aedfcd329c9..366f2f00526 100644 --- a/Tests/LibGfx/TestImageDecoder.cpp +++ b/Tests/LibGfx/TestImageDecoder.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include TEST_CASE(test_bmp) diff --git a/Tests/UserspaceEmulator/ue-write-oob.cpp b/Tests/UserspaceEmulator/ue-write-oob.cpp index 70663a24f8f..a6b251fd76a 100644 --- a/Tests/UserspaceEmulator/ue-write-oob.cpp +++ b/Tests/UserspaceEmulator/ue-write-oob.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include static void write8(void* ptr) { *(uint8_t volatile*)ptr = 1; } diff --git a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp index d25eee8c882..dff9615e3c5 100644 --- a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp +++ b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp @@ -16,7 +16,6 @@ #include #include #include -#include REGISTER_WIDGET(SystemMonitor, MemoryStatsWidget) diff --git a/Userland/Demos/Cube/Cube.cpp b/Userland/Demos/Cube/Cube.cpp index 82f188f5bf9..8e47f8f53e0 100644 --- a/Userland/Demos/Cube/Cube.cpp +++ b/Userland/Demos/Cube/Cube.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include int const WIDTH = 200; diff --git a/Userland/DevTools/Inspector/RemoteProcess.cpp b/Userland/DevTools/Inspector/RemoteProcess.cpp index d3787130de7..636579eacea 100644 --- a/Userland/DevTools/Inspector/RemoteProcess.cpp +++ b/Userland/DevTools/Inspector/RemoteProcess.cpp @@ -8,7 +8,6 @@ #include "RemoteObject.h" #include "RemoteObjectGraphModel.h" #include "RemoteObjectPropertyModel.h" -#include namespace Inspector { diff --git a/Userland/Libraries/LibC/crt0_shared.cpp b/Userland/Libraries/LibC/crt0_shared.cpp index d763a6f696c..b3ca3a5c8f4 100644 --- a/Userland/Libraries/LibC/crt0_shared.cpp +++ b/Userland/Libraries/LibC/crt0_shared.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include diff --git a/Userland/Libraries/LibC/getsubopt.cpp b/Userland/Libraries/LibC/getsubopt.cpp index 1f8c65635b1..ea24411bec2 100644 --- a/Userland/Libraries/LibC/getsubopt.cpp +++ b/Userland/Libraries/LibC/getsubopt.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include diff --git a/Userland/Libraries/LibC/grp.cpp b/Userland/Libraries/LibC/grp.cpp index e5058066855..376f95e872b 100644 --- a/Userland/Libraries/LibC/grp.cpp +++ b/Userland/Libraries/LibC/grp.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include diff --git a/Userland/Libraries/LibC/math.cpp b/Userland/Libraries/LibC/math.cpp index 1db9f22c0a7..ada821963a0 100644 --- a/Userland/Libraries/LibC/math.cpp +++ b/Userland/Libraries/LibC/math.cpp @@ -20,7 +20,6 @@ #include #include #include -#include #if defined(AK_COMPILER_CLANG) # pragma clang diagnostic push diff --git a/Userland/Libraries/LibC/pwd.cpp b/Userland/Libraries/LibC/pwd.cpp index ba2424e4525..6ea61a4fa99 100644 --- a/Userland/Libraries/LibC/pwd.cpp +++ b/Userland/Libraries/LibC/pwd.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include diff --git a/Userland/Libraries/LibC/shadow.cpp b/Userland/Libraries/LibC/shadow.cpp index 9464e87d42b..207c1240fd0 100644 --- a/Userland/Libraries/LibC/shadow.cpp +++ b/Userland/Libraries/LibC/shadow.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include diff --git a/Userland/Libraries/LibC/spawn.cpp b/Userland/Libraries/LibC/spawn.cpp index 00213798f79..5d4a3b3bf80 100644 --- a/Userland/Libraries/LibC/spawn.cpp +++ b/Userland/Libraries/LibC/spawn.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/Userland/Libraries/LibC/time.cpp b/Userland/Libraries/LibC/time.cpp index b771e5799c6..a83b440ffbb 100644 --- a/Userland/Libraries/LibC/time.cpp +++ b/Userland/Libraries/LibC/time.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include diff --git a/Userland/Libraries/LibCore/GetPassword.cpp b/Userland/Libraries/LibCore/GetPassword.cpp index 74b3b5dd296..a0d2987b21d 100644 --- a/Userland/Libraries/LibCore/GetPassword.cpp +++ b/Userland/Libraries/LibCore/GetPassword.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include diff --git a/Userland/Libraries/LibDNS/Packet.cpp b/Userland/Libraries/LibDNS/Packet.cpp index 8f15c08ac92..9d0c2414415 100644 --- a/Userland/Libraries/LibDNS/Packet.cpp +++ b/Userland/Libraries/LibDNS/Packet.cpp @@ -12,7 +12,6 @@ #include #include #include -#include namespace DNS { diff --git a/Userland/Libraries/LibDesktop/Launcher.cpp b/Userland/Libraries/LibDesktop/Launcher.cpp index eaa253cb555..68f8a821db9 100644 --- a/Userland/Libraries/LibDesktop/Launcher.cpp +++ b/Userland/Libraries/LibDesktop/Launcher.cpp @@ -10,7 +10,6 @@ #include #include #include -#include namespace Desktop { diff --git a/Userland/Libraries/LibGUI/EmojiInputDialog.cpp b/Userland/Libraries/LibGUI/EmojiInputDialog.cpp index d7fb5dd912b..1cc0dff1277 100644 --- a/Userland/Libraries/LibGUI/EmojiInputDialog.cpp +++ b/Userland/Libraries/LibGUI/EmojiInputDialog.cpp @@ -25,7 +25,6 @@ #include #include #include -#include namespace GUI { diff --git a/Userland/Libraries/LibGfx/Color.cpp b/Userland/Libraries/LibGfx/Color.cpp index b8e8da487b3..76d169c4958 100644 --- a/Userland/Libraries/LibGfx/Color.cpp +++ b/Userland/Libraries/LibGfx/Color.cpp @@ -14,7 +14,6 @@ #include #include #include -#include namespace Gfx { diff --git a/Userland/Libraries/LibGfx/Font/FontDatabase.cpp b/Userland/Libraries/LibGfx/Font/FontDatabase.cpp index b99d7e953ab..42c66122fcf 100644 --- a/Userland/Libraries/LibGfx/Font/FontDatabase.cpp +++ b/Userland/Libraries/LibGfx/Font/FontDatabase.cpp @@ -15,7 +15,6 @@ #include #include #include -#include namespace Gfx { diff --git a/Userland/Libraries/LibGfx/Line.h b/Userland/Libraries/LibGfx/Line.h index 6192a705a2f..867428317f8 100644 --- a/Userland/Libraries/LibGfx/Line.h +++ b/Userland/Libraries/LibGfx/Line.h @@ -12,7 +12,6 @@ #include #include #include -#include namespace Gfx { diff --git a/Userland/Libraries/LibIPC/Connection.h b/Userland/Libraries/LibIPC/Connection.h index d4e9dcf9910..bbe99f2fd0d 100644 --- a/Userland/Libraries/LibIPC/Connection.h +++ b/Userland/Libraries/LibIPC/Connection.h @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index 6e32e5181bc..a02d3ef495d 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp @@ -24,7 +24,6 @@ #include #include #include -#include namespace JS::Temporal { diff --git a/Userland/Libraries/LibLine/Style.h b/Userland/Libraries/LibLine/Style.h index d054a17c144..e05bf5fa9e7 100644 --- a/Userland/Libraries/LibLine/Style.h +++ b/Userland/Libraries/LibLine/Style.h @@ -10,7 +10,6 @@ #include #include #include -#include namespace Line { diff --git a/Userland/Libraries/LibLine/SuggestionDisplay.h b/Userland/Libraries/LibLine/SuggestionDisplay.h index 40d19454e05..113df0ccfbc 100644 --- a/Userland/Libraries/LibLine/SuggestionDisplay.h +++ b/Userland/Libraries/LibLine/SuggestionDisplay.h @@ -10,7 +10,6 @@ #include #include #include -#include namespace Line { diff --git a/Userland/Libraries/LibLine/SuggestionManager.h b/Userland/Libraries/LibLine/SuggestionManager.h index f7509f3a9c0..849f3c90df3 100644 --- a/Userland/Libraries/LibLine/SuggestionManager.h +++ b/Userland/Libraries/LibLine/SuggestionManager.h @@ -11,7 +11,6 @@ #include #include #include -#include namespace Line { diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp index 60a95add7e1..cc83670d077 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.cpp +++ b/Userland/Libraries/LibVT/TerminalWidget.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp index 6e948ce59a5..d31e5e8107d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp @@ -11,7 +11,6 @@ #include #include #include -#include namespace Web::HTML { diff --git a/Userland/Services/AudioServer/Mixer.cpp b/Userland/Services/AudioServer/Mixer.cpp index 72273929961..5cfbd648908 100644 --- a/Userland/Services/AudioServer/Mixer.cpp +++ b/Userland/Services/AudioServer/Mixer.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include namespace AudioServer { diff --git a/Userland/Utilities/flock.cpp b/Userland/Utilities/flock.cpp index 57d16092110..f7a0c314671 100644 --- a/Userland/Utilities/flock.cpp +++ b/Userland/Utilities/flock.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include diff --git a/Userland/Utilities/nc.cpp b/Userland/Utilities/nc.cpp index 8d11fd61e75..1aca02ab1d3 100644 --- a/Userland/Utilities/nc.cpp +++ b/Userland/Utilities/nc.cpp @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include diff --git a/Userland/Utilities/pidof.cpp b/Userland/Utilities/pidof.cpp index 64b437b21a6..7ad4ad9fd7f 100644 --- a/Userland/Utilities/pidof.cpp +++ b/Userland/Utilities/pidof.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include diff --git a/Userland/Utilities/pmemdump.cpp b/Userland/Utilities/pmemdump.cpp index de8185fd7fb..77293db453e 100644 --- a/Userland/Utilities/pmemdump.cpp +++ b/Userland/Utilities/pmemdump.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include diff --git a/Userland/Utilities/shuf.cpp b/Userland/Utilities/shuf.cpp index 6e6e908c10f..30a1c9f379b 100644 --- a/Userland/Utilities/shuf.cpp +++ b/Userland/Utilities/shuf.cpp @@ -12,7 +12,6 @@ #include #include #include -#include ErrorOr serenity_main(Main::Arguments arguments) { diff --git a/Userland/Utilities/strace.cpp b/Userland/Utilities/strace.cpp index f61e3ba9d44..29e29e6ec38 100644 --- a/Userland/Utilities/strace.cpp +++ b/Userland/Utilities/strace.cpp @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include