From 765936ebaedfaa3a339d99a9865b555ddd7c23e2 Mon Sep 17 00:00:00 2001 From: Lenny Maiorani Date: Sun, 20 Dec 2020 16:09:48 -0700 Subject: Everywhere: Switch from (void) to [[maybe_unused]] (#4473) Problem: - `(void)` simply casts the expression to void. This is understood to indicate that it is ignored, but this is really a compiler trick to get the compiler to not generate a warning. Solution: - Use the `[[maybe_unused]]` attribute to indicate the value is unused. Note: - Functions taking a `(void)` argument list have also been changed to `()` because this is not needed and shows up in the same grep command. --- Userland/more.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'Userland/more.cpp') diff --git a/Userland/more.cpp b/Userland/more.cpp index 4ff672000b..94b34e44cb 100644 --- a/Userland/more.cpp +++ b/Userland/more.cpp @@ -36,15 +36,12 @@ static void wait_for_key() printf("\033[7m--[ more ]--\033[0m"); fflush(stdout); char dummy; - (void)read(key_fd, &dummy, 1); + [[maybe_unused]] auto rc = read(key_fd, &dummy, 1); printf("\n"); } -int main(int argc, char** argv) +int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv) { - (void)argc; - (void)argv; - if (pledge("stdio rpath tty", nullptr) < 0) { perror("pledge"); return 1; -- cgit v1.2.3