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 b891a9b072..e3af860807 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 40a983dce4..afa9f096cd 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 cd81095c58..076113e226 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 3c8b604411..285bc23df3 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 7e8623b16c..4905d940e7 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 aedfcd329c..366f2f0052 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 70663a24f8..a6b251fd76 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 d25eee8c88..dff9615e3c 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 82f188f5bf..8e47f8f53e 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 d3787130de..636579eace 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 d763a6f696..b3ca3a5c8f 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 1f8c65635b..ea24411bec 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 e505806685..376f95e872 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 1db9f22c0a..ada821963a 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 ba2424e452..6ea61a4fa9 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 9464e87d42..207c1240fd 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 00213798f7..5d4a3b3bf8 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 b771e5799c..a83b440ffb 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 74b3b5dd29..a0d2987b21 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 8f15c08ac9..9d0c241441 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 eaa253cb55..68f8a821db 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 d7fb5dd912..1cc0dff127 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 b8e8da487b..76d169c495 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 b99d7e953a..42c66122fc 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 6192a705a2..867428317f 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 d4e9dcf991..bbe99f2fd0 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 6e32e5181b..a02d3ef495 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 d054a17c14..e05bf5fa9e 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 40d19454e0..113df0ccfb 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 f7509f3a9c..849f3c90df 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 60a95add7e..cc83670d07 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 6e948ce59a..d31e5e8107 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 7227392996..5cfbd64890 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 57d1609211..f7a0c31467 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 8d11fd61e7..1aca02ab1d 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 64b437b21a..7ad4ad9fd7 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 de8185fd7f..77293db453 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 6e6e908c10..30a1c9f379 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 f61e3ba9d4..29e29e6ec3 100644 --- a/Userland/Utilities/strace.cpp +++ b/Userland/Utilities/strace.cpp @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include